From: David Disseldorp Date: Thu, 2 Nov 2017 00:05:11 +0000 (+0100) Subject: rbd: set discard_alignment to zero X-Git-Tag: Ubuntu-5.10.0-12.13~8946^2~2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7c084289795b;p=mirror_ubuntu-hirsute-kernel.git rbd: set discard_alignment to zero RBD devices are currently incorrectly initialised with the block queue discard_alignment set to the underlying RADOS object size. As per Documentation/ABI/testing/sysfs-block: The discard_alignment parameter indicates how many bytes the beginning of the device is offset from the internal allocation unit's natural alignment. Correcting the discard_alignment parameter from the RADOS object size to zero (the blk_set_default_limits() default) has no effect on how discard requests are propagated through the block layer - @alignment in __blkdev_issue_discard() remains zero. However, it does fix the UNMAP granularity alignment value advertised to SCSI initiators via the Block Limits VPD. Signed-off-by: David Disseldorp Reviewed-by: Ilya Dryomov Signed-off-by: Ilya Dryomov --- diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 53b1ced21a13..8c132a7fbd2c 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4390,7 +4390,6 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) /* enable the discard support */ queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); q->limits.discard_granularity = segment_size; - q->limits.discard_alignment = segment_size; blk_queue_max_discard_sectors(q, segment_size / SECTOR_SIZE); blk_queue_max_write_zeroes_sectors(q, segment_size / SECTOR_SIZE);