Message ID | 20220418045314.360785-12-hch@lst.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 0000f2f7205d88e0d97f8b47b2c8a98e86137708 |
Headers | show |
Series | [01/11] ubd: don't set the discard_alignment queue limit | expand |
On 4/18/22 13:53, Christoph Hellwig wrote: > Use 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. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > drivers/block/xen-blkback/xenbus.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c > index b21bffc9c50bc..04c90cb8955f6 100644 > --- a/drivers/block/xen-blkback/xenbus.c > +++ b/drivers/block/xen-blkback/xenbus.c > @@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info > if (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; Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index b21bffc9c50bc..04c90cb8955f6 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info if (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;
Use 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. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/block/xen-blkback/xenbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)