xen-blkfront: rely on the default discard granularity
authorChristoph Hellwig <hch@lst.de>
Wed, 21 Feb 2024 12:58:43 +0000 (13:58 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 27 Feb 2024 16:33:08 +0000 (09:33 -0700)
The block layer now sets the discard granularity to the physical
block size default.  Take advantage of that in xen-blkfront and only
set the discard granularity if explicitly specified.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Link: https://lore.kernel.org/r/20240221125845.3610668-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/xen-blkfront.c

index f78167cd5a6333456da8be6f2812f52ad082507e..1258f24b2855006d28ee896cce339a70bad7bc3b 100644 (file)
@@ -951,8 +951,8 @@ static void blkif_set_queue_limits(struct blkfront_info *info)
 
        if (info->feature_discard) {
                blk_queue_max_discard_sectors(rq, UINT_MAX);
-               rq->limits.discard_granularity = info->discard_granularity ?:
-                                                info->physical_sector_size;
+               if (info->discard_granularity)
+                       rq->limits.discard_granularity = info->discard_granularity;
                rq->limits.discard_alignment = info->discard_alignment;
                if (info->feature_secdiscard)
                        blk_queue_max_secure_erase_sectors(rq, UINT_MAX);