misc queue_limits fixups
Subsystems (5)
Hi Jens,
this series is a mix of a few fixups for the last round of queue_limits fixed that I had prepared for a rev of the queue limits features series, and a bunch of imcremental conversions that I didn't want to bloat that series with.
Diffstat:
Documentation/block/writeback_cache_control.rst | 6 ++-- block/blk-settings.c | 34 +++++++----------------- block/blk-sysfs.c | 6 ++-- drivers/md/bcache/super.c | 4 +- drivers/md/dm-cache-target.c | 1 drivers/md/dm-clone-target.c | 1 drivers/md/dm-table.c | 1 drivers/md/raid5.c | 2 - include/linux/blkdev.h | 25 +++++++---------- 9 files changed, 29 insertions(+), 51 deletions(-)
PATCH 1/6 block: remove the unused blk_bounce enum
The enum has been replaced with the BLK_FEAT_BOUNCE_HIGH flag.
--- include/linux/blkdev.h | 9 --------- 1 file changed, 9 deletions(-)
include/linux/blkdev.h +0 -9
@@ -343,15 +343,6 @@ enum { BLK_FLAGS_WRITE_CACHE_DISABLED = (1u << 31), }; -/* -* BLK_BOUNCE_NONE: never bounce (default) -* BLK_BOUNCE_HIGH: bounce all highmem pages -*/ -enum blk_bounce { -BLK_BOUNCE_NONE , -BLK_BOUNCE_HIGH , -}; -struct queue_limits {unsigned int features;unsigned int flags;
Signature · 1 line
2.43.0
PATCH 2/6 block: fix spelling and grammar for in writeback_cache_control.rst
In reply to Christoph Hellwig--- Documentation/block/writeback_cache_control.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/block/writeback_cache_control.rst +3 -3
@@ -70,8 +70,8 @@ flag in the features field of the queue_limits structure. Implementation details for bio based block drivers -------------------------------------------------- -For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simplify passed on -to the driver if the drivers sets the BLK_FEAT_WRITE_CACHE flag and the drivers +For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simply passed on to +the driver if the driver sets the BLK_FEAT_WRITE_CACHE flag and the driver needs to handle them. *NOTE*: The REQ_FUA bit also gets passed on when the BLK_FEAT_FUA flags is
@@ -89,7 +89,7 @@ When the BLK_FEAT_WRITE_CACHE flag is set, REQ_OP_WRITE | REQ_PREFLUSH requests with a payload are automatically turned into a sequence of a REQ_OP_FLUSH request followed by the actual write by the block layer. -When the BLK_FEAT_FUA flags is set, the REQ_FUA bit simplify passed on for the +When the BLK_FEAT_FUA flags is set, the REQ_FUA bit is simply passed on for the REQ_OP_WRITE request, else a REQ_OP_FLUSH request is sent by the block layer after the completion of the write request for bio submissions with the REQ_FUA bit set.
Signature · 1 line
2.43.0
Re: [PATCH 2/6] block: fix spelling and grammar for in writeback_cache_control.rst
Quoted 2 lines · Christoph Hellwig
Suggested-by Damien Le Moal <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
You can remove "for" in the commit title. Other than that, looks good to me.
Quoted 28 lines
--- Documentation/block/writeback_cache_control.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Documentation/block/writeback_cache_control.rst +3
-3@@ -70,8 +70,8 @@ flag in the features field of the queue_limits structure. Implementation details for bio based block drivers -------------------------------------------------- -For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simplify passed on -to the driver if the drivers sets the BLK_FEAT_WRITE_CACHE flag and the drivers +For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simply passed on to +the driver if the driver sets the BLK_FEAT_WRITE_CACHE flag and the driver needs to handle them. *NOTE*: The REQ_FUA bit also gets passed on when the BLK_FEAT_FUA flags is@@ -89,7 +89,7 @@ When the BLK_FEAT_WRITE_CACHE flag is set, REQ_OP_WRITE | REQ_PREFLUSH requests with a payload are automatically turned into a sequence of a REQ_OP_FLUSH request followed by the actual write by the block layer. -When the BLK_FEAT_FUA flags is set, the REQ_FUA bit simplify passed on for the +When the BLK_FEAT_FUA flags is set, the REQ_FUA bit is simply passed on for the REQ_OP_WRITE request, else a REQ_OP_FLUSH request is sent by the block layer after the completion of the write request for bio submissions with the REQ_FUA bit set.
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH 3/6 block: renumber and rename the cache disabled flag
In reply to Christoph HellwigStart with the first bit, and drop the plural-S from the name.
--- block/blk-sysfs.c | 6 +++--- include/linux/blkdev.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
block/blk-sysfs.c +3 -3
@@ -429,7 +429,7 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,static ssize_t queue_wc_show (struct request_queue *q,char *page) { -if (q->limits.features &BLK_FLAGS_WRITE_CACHE_DISABLED ) +if (q->limits.features &BLK_FLAG_WRITE_CACHE_DISABLED )return sprintf (page,"write through\n" );return sprintf (page,"write back\n" ); }
@@ -452,9 +452,9 @@ static ssize_t queue_wc_store(struct request_queue *q, const char *page, lim =queue_limits_start_update (q);if (disable) - lim.flags |=BLK_FLAGS_WRITE_CACHE_DISABLED ; + lim.flags |=BLK_FLAG_WRITE_CACHE_DISABLED ;else - lim.flags &= ~BLK_FLAGS_WRITE_CACHE_DISABLED ; + lim.flags &= ~BLK_FLAG_WRITE_CACHE_DISABLED ; err =queue_limits_commit_update (q, &lim);if (err)return err;
include/linux/blkdev.h +3 -3
@@ -339,8 +339,8 @@ enum {/* internal flags in queue_limits.flags */ enum { -/* do not send FLUSH or FUA command despite advertised write cache */ -BLK_FLAGS_WRITE_CACHE_DISABLED = (1u <<31 ), +/* do not send FLUSH/FUA commands despite advertising a write cache */ +BLK_FLAG_WRITE_CACHE_DISABLED = (1u <<0 ), };struct queue_limits {
@@ -1339,7 +1339,7 @@ static inline bool bdev_stable_writes(struct block_device *bdev)static inline bool blk_queue_write_cache (struct request_queue *q) {return (q->limits.features &BLK_FEAT_WRITE_CACHE ) && - !(q->limits.flags &BLK_FLAGS_WRITE_CACHE_DISABLED ); + !(q->limits.flags &BLK_FLAG_WRITE_CACHE_DISABLED ); }static inline bool bdev_write_cache (struct block_device *bdev)
Signature · 1 line
2.43.0
PATCH 4/6 block: move the misaligned flag into the features field
In reply to Christoph HellwigMove the misaligned flags into the features field to reclaim a little bit of space.
--- block/blk-settings.c | 20 ++++++++++---------- include/linux/blkdev.h | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-)
block/blk-settings.c +10 -10
@@ -258,7 +258,7 @@ static int blk_validate_limits(struct queue_limits *lim)if (lim->alignment_offset) { lim->alignment_offset &= (lim->physical_block_size -1 ); - lim->misaligned =0 ; + lim->features &= ~BLK_FEAT_MISALIGNED ; }if (!(lim->features &BLK_FEAT_WRITE_CACHE ))
@@ -470,6 +470,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,if (!(b->features &BLK_FEAT_POLL )) t->features &= ~BLK_FEAT_POLL ; + t->flags |= (b->flags &BLK_FEAT_MISALIGNED ); + t->max_sectors =min_not_zero (t->max_sectors, b->max_sectors); t->max_user_sectors =min_not_zero (t->max_user_sectors, b->max_user_sectors);
@@ -494,8 +496,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->max_segment_size =min_not_zero (t->max_segment_size, b->max_segment_size); - t->misaligned |= b->misaligned; - alignment =queue_limit_alignment_offset (b, start);/* Bottom device has different alignment. Check that it is
@@ -509,7 +509,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,/* Verify that top and bottom intervals line up */ if (max (top, bottom) %min (top, bottom)) { - t->misaligned =1 ; + t->flags |=BLK_FEAT_MISALIGNED ; ret =-1 ; } }
@@ -531,28 +531,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,/* Physical block size a multiple of the logical block size? */ if (t->physical_block_size & (t->logical_block_size -1 )) { t->physical_block_size = t->logical_block_size; - t->misaligned =1 ; + t->flags |=BLK_FEAT_MISALIGNED ; ret =-1 ; }/* Minimum I/O a multiple of the physical block size? */ if (t->io_min & (t->physical_block_size -1 )) { t->io_min = t->physical_block_size; - t->misaligned =1 ; + t->flags |=BLK_FEAT_MISALIGNED ; ret =-1 ; }/* Optimal I/O a multiple of the physical block size? */ if (t->io_opt & (t->physical_block_size -1 )) { t->io_opt =0 ; - t->misaligned =1 ; + t->flags |=BLK_FEAT_MISALIGNED ; ret =-1 ; }/* chunk_sectors a multiple of the physical block size? */ if ((t->chunk_sectors <<9 ) & (t->physical_block_size -1 )) { t->chunk_sectors =0 ; - t->misaligned =1 ; + t->flags |=BLK_FEAT_MISALIGNED ; ret =-1 ; }
@@ -566,7 +566,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,/* Verify that new alignment_offset is on a logical block boundary */ if (t->alignment_offset & (t->logical_block_size -1 )) { - t->misaligned =1 ; + t->flags |=BLK_FEAT_MISALIGNED ; ret =-1 ; }
@@ -729,7 +729,7 @@ int bdev_alignment_offset(struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); -if (q->limits.misaligned) +if (q->limits.flags &BLK_FEAT_MISALIGNED )return -1 ;if (bdev_is_partition (bdev)) return queue_limit_alignment_offset(&q->limits,
include/linux/blkdev.h +3 -1
@@ -341,6 +341,9 @@ enum {enum {/* do not send FLUSH/FUA commands despite advertising a write cache */ BLK_FLAG_WRITE_CACHE_DISABLED = (1u <<0 ), + +/* I/O topology is misaligned */ +BLK_FEAT_MISALIGNED = (1u <<1 ), };struct queue_limits {
@@ -374,7 +377,6 @@ struct queue_limits {unsigned short max_integrity_segments;unsigned short max_discard_segments; -unsigned char misaligned;unsigned char discard_misaligned;unsigned char raid_partial_stripes_expensive;unsigned int max_open_zones;
Signature · 1 line
2.43.0
PATCH 5/6 block: remove the discard_alignment flag
In reply to Christoph Hellwigqueue_limits.discard_alignment is never read except in the places where it is stacked into another limit.
--- block/blk-settings.c | 10 ---------- drivers/md/dm-cache-target.c | 1 - drivers/md/dm-clone-target.c | 1 - drivers/md/dm-table.c | 1 - include/linux/blkdev.h | 1 - 5 files changed, 14 deletions(-)
block/blk-settings.c +0 -10
@@ -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,
drivers/md/dm-cache-target.c +0 -1
@@ -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)
drivers/md/dm-clone-target.c +0 -1
@@ -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; }
drivers/md/dm-table.c +0 -1
@@ -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))
include/linux/blkdev.h +0 -1
@@ -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;
Signature · 1 line
2.43.0
PATCH 6/6 block: move the raid_partial_stripes_expensive flag into the features field
In reply to Christoph HellwigMove the raid_partial_stripes_expensive flags into the features field to reclaim a little bit of space.
--- block/blk-settings.c | 4 ---- drivers/md/bcache/super.c | 4 ++-- drivers/md/raid5.c | 2 +- include/linux/blkdev.h | 7 +++++-- 4 files changed, 8 insertions(+), 9 deletions(-)
block/blk-settings.c +0 -4
@@ -556,10 +556,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, ret =-1 ; } - t->raid_partial_stripes_expensive = -max (t->raid_partial_stripes_expensive, - b->raid_partial_stripes_expensive); -/* Find lowest common alignment_offset */ t->alignment_offset =lcm_not_zero (t->alignment_offset, alignment) %max (t->physical_block_size, t->io_min);
drivers/md/bcache/super.c +2 -2
@@ -1416,8 +1416,8 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size) }if (bdev_io_opt (dc->bdev)) - dc->partial_stripes_expensive = - q->limits.raid_partial_stripes_expensive; + dc->partial_stripes_expensive = q->limits.features & +BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE ; ret = bcache_device_init(&dc->disk, block_size, bdev_nr_sectors(dc->bdev) - dc->sb.data_offset,
drivers/md/raid5.c +1 -1
@@ -7707,7 +7707,7 @@ static int raid5_set_limits(struct mddev *mddev)blk_set_stacking_limits (&lim); lim.io_min = mddev->chunk_sectors <<9 ; lim.io_opt = lim.io_min * (conf->raid_disks - conf->max_degraded); - lim.raid_partial_stripes_expensive =1 ; + lim.features |=BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE ; lim.discard_granularity = stripe; lim.max_write_zeroes_sectors =0 ;mddev_stack_rdev_limits (mddev, &lim,0 );
include/linux/blkdev.h +5 -2
@@ -328,6 +328,9 @@ enum {/* bounce all highmem pages */ BLK_FEAT_BOUNCE_HIGH = (1u <<14 ), + +/* undocumented magic for bcache */ + BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE = (1u << 15), };/*
@@ -335,7 +338,8 @@ enum {*/ #define BLK_FEAT_INHERIT_MASK \ (BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA | BLK_FEAT_ROTATIONAL | \ - BLK_FEAT_STABLE_WRITES | BLK_FEAT_ZONED | BLK_FEAT_BOUNCE_HIGH) + BLK_FEAT_STABLE_WRITES | BLK_FEAT_ZONED | BLK_FEAT_BOUNCE_HIGH | \ + BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE)/* internal flags in queue_limits.flags */ enum {
@@ -377,7 +381,6 @@ struct queue_limits {unsigned short max_integrity_segments;unsigned short max_discard_segments; -unsigned char raid_partial_stripes_expensive;unsigned int max_open_zones;unsigned int max_active_zones;
Signature · 1 line
2.43.0
Martin K. Petersen
Reviewed-byChristoph,
Quoted 4 lines
this series is a mix of a few fixups for the last round of
queue_limitsfixed that I had prepared for a rev of the queue limits features series, and a bunch of imcremental conversions that I didn't want to bloat that series with.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Johannes Thumshirn
Reviewed-byLooks good,
Quoted 17 lines · Christoph Hellwig
this series is a mix of a few fixups for the last round of
queue_limitsfixed that I had prepared for a rev of the queue limits features series, and a bunch of imcremental conversions that I didn't want to bloat that series with.Diffstat:
Documentation/block/writeback_cache_control.rst | 6 ++-- block/blk-settings.c | 34 +++++++----------------- block/blk-sysfs.c | 6 ++-- drivers/md/bcache/super.c | 4 +- drivers/md/dm-cache-target.c | 1 drivers/md/dm-clone-target.c | 1 drivers/md/dm-table.c | 1 drivers/md/raid5.c | 2 - include/linux/blkdev.h | 25 +++++++---------- 9 files changed, 29 insertions(+), 51 deletions(-)
Quoted 1 line
[...]
Applied, thanks!
[1/6] block: remove the unused blk_bounce enum
commit: f6860b6069b92559f5cdb65f48e2d82051eaebca
[2/6] block: fix spelling and grammar for in writeback_cache_control.rst
commit: 4e54ea72edd68d074be2403f3efc67ff0541e298
[3/6] block: renumber and rename the cache disabled flag
commit: bae1c74316b86c67c95658c3a0cd312cec9aad77
[4/6] block: move the misaligned flag into the features field
commit: 5543217be468268dfedf504f4969771b9a377353
[5/6] block: remove the discard_alignment flag
commit: 4cac3d3a712b5c76d462b29b73b9e58c0b6d9946
[6/6] block: move the raid_partial_stripes_expensive flag into the features field
commit: 7d4dec525f5fd555037486af4d02dd3682655ba1Best regards,
Signature · 1 line
Jens Axboe