bcache/md: Use raid stripe size
Subsystems (3)
PATCH 1/1 bcache/md: Use raid stripe size
Now that we've got code for raid5/6 stripe awareness, bcache just needs to know about the stripes and when writing partial stripes is expensive
- we probably don't want to enable this optimization for raid1 or 10, even though they have stripes. So add a flag to queue_limits.
---
This is in my pile of bcache stuff queued up for 3.14 - if no one objects it'll be in my bcache pull request:
drivers/md/bcache/super.c | 6 ++++++ drivers/md/raid5.c | 1 + include/linux/blkdev.h | 1 + 3 files changed, 8 insertions(+)
drivers/md/bcache/super.c +6 -0
@@ -1134,6 +1134,12 @@ static int cached_dev_init(struct cached_dev *dc, unsigned block_size)hlist_add_head (&io->hash, dc->io_hash +RECENT_IO ); } + dc->disk.stripe_size = q->limits.io_opt >>9 ; + +if (dc->disk.stripe_size) + dc->partial_stripes_expensive = + q->limits.raid_partial_stripes_expensive; + ret =bcache_device_init (&dc->disk, block_size, dc->bdev->bd_part->nr_sects - dc->sb.data_offset);if (ret)
drivers/md/raid5.c +1 -0
@@ -6104,6 +6104,7 @@ static int run(struct mddev *mddev)blk_queue_io_min (mddev->queue, chunk_size);blk_queue_io_opt (mddev->queue, chunk_size * (conf->raid_disks - conf->max_degraded)); + mddev->queue->limits.raid_partial_stripes_expensive =1 ;/* * We can only discard a whole stripe. It doesn't make sense to * discard data disk but write parity disk
include/linux/blkdev.h +1 -0
@@ -291,6 +291,7 @@ struct queue_limits {unsigned char discard_misaligned;unsigned char cluster;unsigned char discard_zeroes_data; +unsigned char raid_partial_stripes_expensive; };struct request_queue {
Signature · 1 line
1.8.5.1
Quoted 6 lines · Kent Overstreet
Now that we've got code for raid5/6 stripe awareness, bcache just needs to know about the stripes and when writing partial stripes is expensive
- we probably don't want to enable this optimization for raid1 or 10, even though they have stripes. So add a flag toqueue_limits.Signed-off-by Kent Overstreet <[email protected]>
Quoted 8 lines
---
This is in my pile of bcache stuff queued up for 3.14 - if no one objects it'll be in my bcache pull request:drivers/md/bcache/super.c | 6 ++++++ drivers/md/raid5.c | 1 + include/linux/blkdev.h | 1 + 3 files changed, 8 insertions(+)
Hi Kent,
include/linux/blkdev.h struct queue_limits { · line 297
Quoted 12 lines
include/linux/blkdev.h +1
-0@@ -291,6 +291,7 @@ struct queue_limits {unsigned char discard_misaligned;unsigned char cluster;unsigned char discard_zeroes_data; +unsigned char raid_partial_stripes_expensive; };struct request_queue {
If you add a new member to queue_limits you need to update blk_stack_limits() so that it propagates as you stack devices.
You probably also want to update blk_set_default_limits.
Mike
Quoted 29 lines · Mike Snitzer
Quoted 6 lines · Kent Overstreet
Now that we've got code for raid5/6 stripe awareness, bcache just needs to know about the stripes and when writing partial stripes is expensive
- we probably don't want to enable this optimization for raid1 or 10, even though they have stripes. So add a flag toqueue_limits.Signed-off-by Kent Overstreet <[email protected]>Quoted 8 lines
---
This is in my pile of bcache stuff queued up for 3.14 - if no one objects it'll be in my bcache pull request:drivers/md/bcache/super.c | 6 ++++++ drivers/md/raid5.c | 1 + include/linux/blkdev.h | 1 + 3 files changed, 8 insertions(+)Hi Kent,
Quoted 11 lines
include/linux/blkdev.h +1
-0@@ -291,6 +291,7 @@ struct queue_limits {unsigned char discard_misaligned;unsigned char cluster;unsigned char discard_zeroes_data; +unsigned char raid_partial_stripes_expensive; };
Quoted 4 lines
include/linux/blkdev.h struct queue_limits { · line 297
Quoted 1 line
include/linux/blkdev.h +0
-0struct request_queue {If you add a new member to
queue_limitsyou need to updateblk_stack_limits()so that it propagates as you stack devices.
Thanks, going to send Jens a new pull after he does some merging so I'll include that in the updated version.