block: remove the discard_alignment flag
authorChristoph Hellwig <hch@lst.de>
Wed, 19 Jun 2024 15:45:37 +0000 (17:45 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 20 Jun 2024 12:53:14 +0000 (06:53 -0600)
queue_limits.discard_alignment is never read except in the places
where it is stacked into another limit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240619154623.450048-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-settings.c
drivers/md/dm-cache-target.c
drivers/md/dm-clone-target.c
drivers/md/dm-table.c
include/linux/blkdev.h

index a1b10404e500bc5a497a51e4b835d71f2dae3126..62588d9a38e39a999888c3edfc002c76cba02f85 100644 (file)
@@ -578,16 +578,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
        if (b->discard_granularity) {
                alignment = queue_limit_discard_alignment(b, start);
 
-               if (t->discard_granularity != 0 &&
-                   t->discard_alignment != alignment) {
-                       top = t->discard_granularity + t->discard_alignment;
-                       bottom = b->discard_granularity + alignment;
-
-                       /* Verify that top and bottom intervals line up */
-                       if ((max(top, bottom) % min(top, bottom)) != 0)
-                               t->discard_misaligned = 1;
-               }
-
                t->max_discard_sectors = min_not_zero(t->max_discard_sectors,
                                                      b->max_discard_sectors);
                t->max_hw_discard_sectors = min_not_zero(t->max_hw_discard_sectors,
index 16884b5850532fb5852f8ceb76e310faed600263..2d8dd9283ff4cf76da2327e7ddee5c3bd557569f 100644 (file)
@@ -3403,7 +3403,6 @@ static void set_discard_limits(struct cache *cache, struct queue_limits *limits)
        limits->max_hw_discard_sectors = origin_limits->max_hw_discard_sectors;
        limits->discard_granularity = origin_limits->discard_granularity;
        limits->discard_alignment = origin_limits->discard_alignment;
-       limits->discard_misaligned = origin_limits->discard_misaligned;
 }
 
 static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
index ad79b52ffc1434c06cfa36b033c615513851b3d3..b4384a8b13e36012b2003e69c47e7bcc24e19852 100644 (file)
@@ -2059,7 +2059,6 @@ static void set_discard_limits(struct clone *clone, struct queue_limits *limits)
        limits->max_hw_discard_sectors = dest_limits->max_hw_discard_sectors;
        limits->discard_granularity = dest_limits->discard_granularity;
        limits->discard_alignment = dest_limits->discard_alignment;
-       limits->discard_misaligned = dest_limits->discard_misaligned;
        limits->max_discard_segments = dest_limits->max_discard_segments;
 }
 
index df6313c3fe6ba4e92c3a9fff39b0cdf661af78bb..502ebc78d490f65f486a86b39da6faaf9a4eda5e 100644 (file)
@@ -1808,7 +1808,6 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
                limits->max_hw_discard_sectors = 0;
                limits->discard_granularity = 0;
                limits->discard_alignment = 0;
-               limits->discard_misaligned = 0;
        }
 
        if (!dm_table_supports_write_zeroes(t))
index 7ad2b1240fc0bff687fa3bd7a806225c16b62a9c..86410ce41bf60e82d2932664ba6305ddf544507d 100644 (file)
@@ -377,7 +377,6 @@ struct queue_limits {
        unsigned short          max_integrity_segments;
        unsigned short          max_discard_segments;
 
-       unsigned char           discard_misaligned;
        unsigned char           raid_partial_stripes_expensive;
        unsigned int            max_open_zones;
        unsigned int            max_active_zones;