block: report the correct discard alignment in sysfs
PATCH 1/1 block: report the correct discard alignment in sysfs
disk_discard_alignment_show() reports the physical I/O alignment offset instead of the discard alignment. Devices can specify these offsets independently, so the discard_alignment sysfs attribute can report the wrong value.
Use bdev_discard_alignment() for the whole-disk attribute, as is already done for partitions.
--- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/genhd.c +1 -1
@@ -1146,7 +1146,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev, {struct gendisk *disk =dev_to_disk (dev); -return sysfs_emit (buf,"%d\n" ,bdev_alignment_offset (disk->part0)); +return sysfs_emit (buf,"%u\n" ,bdev_discard_alignment (disk->part0)); } static ssize_t diskseq_show(struct device *dev,
base-commit: 36aad21d50d1af3f6954bb0c988257a908202477
Signature · 1 line
2.43.0
Looks good:
Quoted 9 lines · Avi Weiss
disk_discard_alignment_show()reports the physical I/O alignment offset instead of the discard alignment. Devices can specify these offsets independently, so thediscard_alignmentsysfs attribute can report the wrong value.Use
bdev_discard_alignment()for the whole-disk attribute, as is already done for partitions.[...]
Applied, thanks!
[1/1] block: report the correct discard alignment in sysfs
commit: 2516f0413f8704a7370ef8a2eeae26c9bc438978
Best regards,
Signature · 1 line
Jens Axboe