fix and cleanup discard_alignment handling
Subsystems (12)
Christoph Hellwig
maintainerHi all,
the somewhat confusing name of the discard_alignment queue limit, that really is an offset for the discard granularity mislead a lot of driver authors to set it to an incorrect value. This series tries to fix up all these cases.
Diffstat:
arch/um/drivers/ubd_kern.c | 1 - drivers/block/loop.c | 1 - drivers/block/nbd.c | 3 --- drivers/block/null_blk/main.c | 1 - drivers/block/rnbd/rnbd-srv-dev.h | 2 +- drivers/block/virtio_blk.c | 7 ++++--- drivers/block/xen-blkback/xenbus.c | 4 ++-- drivers/md/dm-zoned-target.c | 2 +- drivers/md/raid5.c | 1 - drivers/nvme/host/core.c | 1 - drivers/s390/block/dasd_fba.c | 1 - 11 files changed, 8 insertions(+), 16 deletions(-)
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 1/11 ubd: don't set the discard_alignment queue limit
The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by ubd is mostly harmless but also useless.
--- arch/um/drivers/ubd_kern.c | 1 - 1 file changed, 1 deletion(-)
arch/um/drivers/ubd_kern.c +0 -1
@@ -799,7 +799,6 @@ static int ubd_open_dev(struct ubd *ubd_dev) }if (ubd_dev->no_trim ==0 ) { ubd_dev->queue->limits.discard_granularity =SECTOR_SIZE ; - ubd_dev->queue->limits.discard_alignment =SECTOR_SIZE ;blk_queue_max_discard_sectors (ubd_dev->queue,UBD_MAX_REQUEST );blk_queue_max_write_zeroes_sectors (ubd_dev->queue,UBD_MAX_REQUEST ); }
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 2/11 nbd: don't set the discard_alignment queue limit
In reply to Christoph HellwigThe discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by nbd is mostly harmless but also useless.
--- drivers/block/nbd.c | 3 --- 1 file changed, 3 deletions(-)
drivers/block/nbd.c +0 -3
@@ -333,7 +333,6 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,if (nbd->config->flags &NBD_FLAG_SEND_TRIM ) { nbd->disk->queue->limits.discard_granularity = blksize; - nbd->disk->queue->limits.discard_alignment = blksize;blk_queue_max_discard_sectors (nbd->disk->queue,UINT_MAX ); }blk_queue_logical_block_size (nbd->disk->queue, blksize);
@@ -1316,7 +1315,6 @@ static void nbd_config_put(struct nbd_device *nbd) nbd->tag_set.timeout =0 ; nbd->disk->queue->limits.discard_granularity =0 ; - nbd->disk->queue->limits.discard_alignment =0 ;blk_queue_max_discard_sectors (nbd->disk->queue,0 );mutex_unlock (&nbd->config_lock);
@@ -1781,7 +1779,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)blk_queue_flag_set (QUEUE_FLAG_NONROT , disk->queue);blk_queue_flag_clear (QUEUE_FLAG_ADD_RANDOM , disk->queue); disk->queue->limits.discard_granularity =0 ; - disk->queue->limits.discard_alignment =0 ;blk_queue_max_discard_sectors (disk->queue,0 );blk_queue_max_segment_size (disk->queue,UINT_MAX );blk_queue_max_segments (disk->queue,USHRT_MAX );
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 3/11 null_blk: don't set the discard_alignment queue limit
In reply to Christoph HellwigThe discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by null_blk is mostly harmless but also useless.
--- drivers/block/null_blk/main.c | 1 - 1 file changed, 1 deletion(-)
drivers/block/null_blk/main.c +0 -1
@@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb) } nullb->q->limits.discard_granularity = nullb->dev->blocksize; - nullb->q->limits.discard_alignment = nullb->dev->blocksize;blk_queue_max_discard_sectors (nullb->q,UINT_MAX >>9 ); }
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [dm-devel] [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
Quoted 15 lines · Christoph Hellwig
The
discard_alignmentqueue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done bynull_blkis mostly harmless but also useless.Signed-off-by Christoph Hellwig <[email protected]>--- drivers/block/null_blk/main.c | 1 - 1 file changed, 1 deletion(-)drivers/block/null_blk/main.c +0
-0
drivers/block/null_blk/main.c static void null_config_discard(struct nullb *nullb) · line 1770
Quoted 7 lines
drivers/block/null_blk/main.c +0
-1@@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb) } nullb->q->limits.discard_granularity = nullb->dev->blocksize; - nullb->q->limits.discard_alignment = nullb->dev->blocksize;blk_queue_max_discard_sectors (nullb->q,UINT_MAX >>9 ); }
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
In reply to Christoph HellwigQuoted 7 lines · Christoph Hellwig
The
discard_alignmentqueue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done bynull_blkis mostly harmless but also useless.Signed-off-by Christoph Hellwig <[email protected]>---
-ck
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 4/11 virtio_blk: fix the discard_granularity and discard_alignment queue limits
In reply to Christoph HellwigThe discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts.
On the other hand the discard_sector_alignment from the virtio 1.1 looks similar to what Linux uses as discard granularity (even if not very well described):
"discard_sector_alignment can be used by OS when splitting a request
based on alignment. "
And at least qemu does set it to the discard granularity.
So stop setting the discard_alignment and use the virtio discard_sector_alignment to set the discard granularity.
--- drivers/block/virtio_blk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/block/virtio_blk.c +4 -3
@@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev)blk_queue_io_opt (q, blk_size * opt_io_size);if (virtio_has_feature (vdev,VIRTIO_BLK_F_DISCARD )) { - q->limits.discard_granularity = blk_size; - virtio_cread(vdev, struct virtio_blk_config, discard_sector_alignment, &v); - q->limits.discard_alignment = v ? v <<SECTOR_SHIFT :0 ; +if (v) + q->limits.discard_granularity = v <<SECTOR_SHIFT ; +else + q->limits.discard_granularity = blk_size; virtio_cread(vdev, struct virtio_blk_config, max_discard_sectors, &v);
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 5/11 dm-zoned: don't set the discard_alignment queue limit
In reply to Christoph HellwigThe discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by dm-zoned is mostly harmless but also useless.
--- drivers/md/dm-zoned-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-zoned-target.c +1 -1
@@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)blk_limits_io_min (limits,DMZ_BLOCK_SIZE );blk_limits_io_opt (limits,DMZ_BLOCK_SIZE ); - limits->discard_alignment =DMZ_BLOCK_SIZE ; + limits->discard_alignment =0 ; limits->discard_granularity =DMZ_BLOCK_SIZE ; limits->max_discard_sectors = chunk_sectors; limits->max_hw_discard_sectors = chunk_sectors;
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [dm-devel] [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
Quoted 15 lines · Christoph Hellwig
The
discard_alignmentqueue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by dm-zoned is mostly harmless but also useless.Signed-off-by Christoph Hellwig <[email protected]>--- drivers/md/dm-zoned-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/md/dm-zoned-target.c +0
-0
drivers/md/dm-zoned-target.c static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits) · line 1007
Quoted 8 lines
drivers/md/dm-zoned-target.c +1
-1@@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)blk_limits_io_min (limits,DMZ_BLOCK_SIZE );blk_limits_io_opt (limits,DMZ_BLOCK_SIZE ); - limits->discard_alignment =DMZ_BLOCK_SIZE ; + limits->discard_alignment =0 ; limits->discard_granularity =DMZ_BLOCK_SIZE ; limits->max_discard_sectors = chunk_sectors; limits->max_hw_discard_sectors = chunk_sectors
Signature · 2 lines
Damien Le Moal Western Digital Research
Christoph Hellwig
maintainerPATCH 6/11 raid5: don't set the discard_alignment queue limit
In reply to Christoph HellwigThe discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by raid5 is mostly harmless but also useless.
--- drivers/md/raid5.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/raid5.c +0 -1
@@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)*/ stripe = stripe *PAGE_SIZE ; stripe =roundup_pow_of_two (stripe); - mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe;blk_queue_max_write_zeroes_sectors (mddev->queue,0 );
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH 06/11] raid5: don't set the discard_alignment queue limit
Quoted 7 lines · Christoph Hellwig
The
discard_alignmentqueue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by raid5 is mostly harmless but also useless.Signed-off-by Christoph Hellwig <[email protected]>
Quoted 17 lines
--- drivers/md/raid5.c | 1 - 1 file changed, 1 deletion(-)drivers/md/raid5.c +0
-2@@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)*/ stripe = stripe *PAGE_SIZE ; stripe =roundup_pow_of_two (stripe); - mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe;blk_queue_max_write_zeroes_sectors (mddev->queue,0 ); --
Quoted 2 lines
2.30.2
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 7/11 dasd: don't set the discard_alignment queue limit
In reply to Christoph HellwigThe discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to PAGE_SIZE while the discard granularity is the block size that is smaller or the same as PAGE_SIZE as done by dasd is mostly harmless but also useless.
--- drivers/s390/block/dasd_fba.c | 1 - 1 file changed, 1 deletion(-)
drivers/s390/block/dasd_fba.c +0 -1
@@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)blk_queue_segment_boundary (q,PAGE_SIZE -1 ); q->limits.discard_granularity = logical_block_size; - q->limits.discard_alignment =PAGE_SIZE ;/* Calculate max_discard_sectors and make it PAGE aligned */ max_bytes =USHRT_MAX * logical_block_size;
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH 07/11] dasd: don't set the discard_alignment queue limit
Quoted 7 lines · Christoph Hellwig
The
discard_alignmentqueue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it toPAGE_SIZEwhile the discard granularity is the block size that is smaller or the same asPAGE_SIZEas done by dasd is mostly harmless but also useless.Signed-off-by Christoph Hellwig <[email protected]>
Sorry for a rather late answer. I saw that Jens already applied the patches so it's fine when the Ack isn't added anymore. Wanted to send it anyway so that you know we're aware of it.
Quoted 9 lines
--- drivers/s390/block/dasd_fba.c | 1 - 1 file changed, 1 deletion(-)drivers/s390/block/dasd_fba.c +0
-0
drivers/s390/block/dasd_fba.c static void dasd_fba_setup_blk_queue(struct dasd_block *block) · line 787
Quoted 7 lines
drivers/s390/block/dasd_fba.c +0
-1@@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)blk_queue_segment_boundary (q,PAGE_SIZE -1 ); q->limits.discard_granularity = logical_block_size; - q->limits.discard_alignment =PAGE_SIZE ;/* Calculate max_discard_sectors and make it PAGE aligned */ max_bytes =USHRT_MAX * logical_block_size;
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 8/11 loop: remove a spurious clear of discard_alignment
In reply to Christoph HellwigThe loop driver never sets a discard_alignment, so it also doens't need to clear it to zero.
--- drivers/block/loop.c | 1 - 1 file changed, 1 deletion(-)
drivers/block/loop.c +0 -1
@@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)blk_queue_max_discard_sectors (q,0 );blk_queue_max_write_zeroes_sectors (q,0 ); } - q->limits.discard_alignment =0 ; }struct loop_worker {
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [dm-devel] [PATCH 08/11] loop: remove a spurious clear of discard_alignment
Quoted 13 lines · Christoph Hellwig
The loop driver never sets a
discard_alignment, so it also doens't need to clear it to zero.Signed-off-by Christoph Hellwig <[email protected]>--- drivers/block/loop.c | 1 - 1 file changed, 1 deletion(-)drivers/block/loop.c +0
-0
drivers/block/loop.c static void loop_config_discard(struct loop_device *lo) · line 794
Quoted 7 lines
drivers/block/loop.c +0
-1@@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)blk_queue_max_discard_sectors (q,0 );blk_queue_max_write_zeroes_sectors (q,0 ); } - q->limits.discard_alignment =0 ; }struct loop_worker {
Signature · 7 lines
Damien Le Moal Western Digital Research _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH 08/11] loop: remove a spurious clear of discard_alignment
In reply to Christoph HellwigQuoted 1 line · Christoph Hellwig
The loop driver never sets a
discard_alignment, so it also doens't need
s/doens't/doesn't/
Quoted 3 lines
to clear it to zero.
Signed-off-by Christoph Hellwig <[email protected]>
-ck
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 9/11 nvme: remove a spurious clear of discard_alignment
In reply to Christoph HellwigThe nvme driver never sets a discard_alignment, so it also doens't need to clear it to zero.
--- drivers/nvme/host/core.c | 1 - 1 file changed, 1 deletion(-)
drivers/nvme/host/core.c +0 -1
@@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)BUILD_BUG_ON (PAGE_SIZE /sizeof (struct nvme_dsm_range ) <NVME_DSM_MAX_RANGES ); - queue->limits.discard_alignment =0 ; queue->limits.discard_granularity = size;/* If discard is already enabled, don't reset queue limits */
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
Quoted 13 lines · Christoph Hellwig
The nvme driver never sets a
discard_alignment, so it also doens't need to clear it to zero.Signed-off-by Christoph Hellwig <[email protected]>--- drivers/nvme/host/core.c | 1 - 1 file changed, 1 deletion(-)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns) · line 1633
Quoted 7 lines
drivers/nvme/host/core.c +0
-1@@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)BUILD_BUG_ON (PAGE_SIZE /sizeof (struct nvme_dsm_range ) <NVME_DSM_MAX_RANGES ); - queue->limits.discard_alignment =0 ; queue->limits.discard_granularity = size;/* If discard is already enabled, don't reset queue limits */
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
The nvme driver never sets a
discard_alignment, so it also doens't need to clear it to zero.Signed-off-by Christoph Hellwig <[email protected]>---
-ck
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Re: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
In reply to Christoph Hellwig_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 10/11 rnbd-srv: use bdev_discard_alignment
In reply to Christoph HellwigUse bdev_discard_alignment to calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit.
--- drivers/block/rnbd/rnbd-srv-dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rnbd/rnbd-srv-dev.h +1 -1
@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)static inline int rnbd_dev_get_discard_alignment (const struct rnbd_dev *dev) { -return bdev_get_queue (dev->bdev)->limits.discard_alignment; +return bdev_discard_alignment (dev->bdev); }#endif /* RNBD_SRV_DEV_H */
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [dm-devel] [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
Quoted 13 lines · Christoph Hellwig
Use
bdev_discard_alignmentto calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit.Signed-off-by Christoph Hellwig <[email protected]>--- drivers/block/rnbd/rnbd-srv-dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/rnbd/rnbd-srv-dev.h +0
-0
drivers/block/rnbd/rnbd-srv-dev.h static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev) · line 65
Quoted 8 lines
drivers/block/rnbd/rnbd-srv-dev.h +1
-1@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)static inline int rnbd_dev_get_discard_alignment (const struct rnbd_dev *dev) { -return bdev_get_queue (dev->bdev)->limits.discard_alignment; +return bdev_discard_alignment (dev->bdev); }#endif /* RNBD_SRV_DEV_H */
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
Use
bdev_discard_alignmentto calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit.Signed-off-by Christoph Hellwig <[email protected]>
Thx!
Quoted 18 lines
--- drivers/block/rnbd/rnbd-srv-dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/rnbd/rnbd-srv-dev.h +1
-2@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)static inline int rnbd_dev_get_discard_alignment (const struct rnbd_dev *dev) { -return bdev_get_queue (dev->bdev)->limits.discard_alignment; +return bdev_discard_alignment (dev->bdev); }#endif /* RNBD_SRV_DEV_H */ --
Quoted 2 lines
2.30.2
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerPATCH 11/11 xen-blkback: use bdev_discard_alignment
In reply to Christoph HellwigUse bdev_discard_alignment to calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit.
Also switch to use bdev_discard_granularity to get rid of the last direct queue reference in xen_blkbk_discard.
--- drivers/block/xen-blkback/xenbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/xen-blkback/xenbus.c +2 -2
@@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_infoif (bdev_max_discard_sectors (bdev)) { err =xenbus_printf (xbt, dev->nodename,"discard-granularity" ,"%u" , - q->limits.discard_granularity); +bdev_discard_granularity (bdev));if (err) {dev_warn (&dev->dev,"writing discard-granularity (%d)" , err);return ; } err =xenbus_printf (xbt, dev->nodename,"discard-alignment" ,"%u" , - q->limits.discard_alignment); +bdev_discard_alignment (bdev));if (err) {dev_warn (&dev->dev,"writing discard-alignment (%d)" , err);return ;
Signature · 7 lines
2.30.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Re: [dm-devel] [PATCH 11/11] xen-blkback: use bdev_discard_alignment
Quoted 22 lines · Christoph Hellwig
Use
bdev_discard_alignmentto calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit.Also switch to use
bdev_discard_granularityto get rid of the last direct queue reference inxen_blkbk_discard.Signed-off-by Christoph Hellwig <[email protected]>--- drivers/block/xen-blkback/xenbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/block/xen-blkback/xenbus.c +1
-1@@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_infoif (bdev_max_discard_sectors (bdev)) { err =xenbus_printf (xbt, dev->nodename,"discard-granularity" ,"%u" , - q->limits.discard_granularity); +bdev_discard_granularity (bdev));if (err) {
drivers/block/xen-blkback/xenbus.c static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info · line 596
Quoted 10 lines
drivers/block/xen-blkback/xenbus.c +1
-1dev_warn (&dev->dev,"writing discard-granularity (%d)" , err);return ; } err =xenbus_printf (xbt, dev->nodename,"discard-alignment" ,"%u" , - q->limits.discard_alignment); +bdev_discard_alignment (bdev));if (err) {dev_warn (&dev->dev,"writing discard-alignment (%d)" , err);return ;
Signature · 7 lines
Damien Le Moal Western Digital Research _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Martin K. Petersen
Reviewed-byChristoph,
Quoted 4 lines
the somewhat confusing name of the
discard_alignmentqueue limit, that really is an offset for the discard granularity mislead a lot of driver authors to set it to an incorrect value. This series tries to fix up all these cases.
Not sure how I ended up with "discard_alignment" when I called the corresponding I/O parameter "alignment_offset".
Anyway. All this looks good to me.
Signature · 6 lines
Martin K. Petersen Oracle Linux Engineering _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Christoph Hellwig
maintainerping?
_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Quoted 19 lines · Christoph Hellwig
the somewhat confusing name of the
discard_alignmentqueue limit, that really is an offset for the discard granularity mislead a lot of driver authors to set it to an incorrect value. This series tries to fix up all these cases.Diffstat:
arch/um/drivers/ubd_kern.c | 1 - drivers/block/loop.c | 1 - drivers/block/nbd.c | 3 --- drivers/block/null_blk/main.c | 1 - drivers/block/rnbd/rnbd-srv-dev.h | 2 +- drivers/block/virtio_blk.c | 7 ++++--- drivers/block/xen-blkback/xenbus.c | 4 ++-- drivers/md/dm-zoned-target.c | 2 +- drivers/md/raid5.c | 1 - drivers/nvme/host/core.c | 1 - drivers/s390/block/dasd_fba.c | 1 - 11 files changed, 8 insertions(+), 16 deletions(-)
Quoted 1 line
[...]
Applied, thanks!
[01/11] ubd: don't set the discard_alignment queue limit
commit: 07c6e92a8478770a7302f7dde72f03a5465901bd
[02/11] nbd: don't set the discard_alignment queue limit
commit: 4a04d517c56e0616c6f69afc226ee2691e543712
[03/11] null_blk: don't set the discard_alignment queue limit
commit: fb749a87f4536d2fa86ea135ae4eff1072903438
[04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
commit: 62952cc5bccd89b76d710de1d0b43244af0f2903
[05/11] dm-zoned: don't set the discard_alignment queue limit
commit: 44d583702f4429763c558624fac763650a1f05bf
[06/11] raid5: don't set the discard_alignment queue limit
commit: 3d50d368c92ade2f98a3d0d28b842a57c35284e9
[07/11] dasd: don't set the discard_alignment queue limit
commit: c3f765299632727fa5ea5a0acf118665227a4f1a
[08/11] loop: remove a spurious clear of discard_alignment
commit: 4418bfd8fb9602d9cd8747c3ad52fdbaa02e2ffd
[09/11] nvme: remove a spurious clear of discard_alignment
commit: 4e7f0ece41e1be8f876f320a0972a715daec0a50
[10/11] rnbd-srv: use bdev_discard_alignment
commit: 18292faa89d2bff3bdd33ab9c065f45fb6710e47
[11/11] xen-blkback: use bdev_discard_alignment
commit: c899b23533866910c90ef4386b501af50270d320Best regards,
Signature · 1 line
Jens Axboe