diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-07-12 01:39:53 -0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-01-08 16:05:09 -0500 |
commit | c78afc6261b09f74abff8c0719b80692a4959768 (patch) | |
tree | 4b3d5e421fad23e3bd0866a0b18c845acf297506 | |
parent | 5f5837d2d650db25b9153b91535e67a96b265f58 (diff) |
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.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
-rw-r--r-- | block/blk-settings.c | 4 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 6 | ||||
-rw-r--r-- | drivers/md/raid5.c | 1 | ||||
-rw-r--r-- | include/linux/blkdev.h | 1 |
4 files changed, 12 insertions, 0 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 05e826793e4e..5d21239bc859 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -592,6 +592,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
592 | ret = -1; | 592 | ret = -1; |
593 | } | 593 | } |
594 | 594 | ||
595 | t->raid_partial_stripes_expensive = | ||
596 | max(t->raid_partial_stripes_expensive, | ||
597 | b->raid_partial_stripes_expensive); | ||
598 | |||
595 | /* Find lowest common alignment_offset */ | 599 | /* Find lowest common alignment_offset */ |
596 | t->alignment_offset = lcm(t->alignment_offset, alignment) | 600 | t->alignment_offset = lcm(t->alignment_offset, alignment) |
597 | & (max(t->physical_block_size, t->io_min) - 1); | 601 | & (max(t->physical_block_size, t->io_min) - 1); |
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 63ebef78df4a..e363efcf2b76 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c | |||
@@ -1134,6 +1134,12 @@ static int cached_dev_init(struct cached_dev *dc, unsigned block_size) | |||
1134 | hlist_add_head(&io->hash, dc->io_hash + RECENT_IO); | 1134 | hlist_add_head(&io->hash, dc->io_hash + RECENT_IO); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | dc->disk.stripe_size = q->limits.io_opt >> 9; | ||
1138 | |||
1139 | if (dc->disk.stripe_size) | ||
1140 | dc->partial_stripes_expensive = | ||
1141 | q->limits.raid_partial_stripes_expensive; | ||
1142 | |||
1137 | ret = bcache_device_init(&dc->disk, block_size, | 1143 | ret = bcache_device_init(&dc->disk, block_size, |
1138 | dc->bdev->bd_part->nr_sects - dc->sb.data_offset); | 1144 | dc->bdev->bd_part->nr_sects - dc->sb.data_offset); |
1139 | if (ret) | 1145 | if (ret) |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index eea63372e4d3..1cfb22c025b6 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -6101,6 +6101,7 @@ static int run(struct mddev *mddev) | |||
6101 | blk_queue_io_min(mddev->queue, chunk_size); | 6101 | blk_queue_io_min(mddev->queue, chunk_size); |
6102 | blk_queue_io_opt(mddev->queue, chunk_size * | 6102 | blk_queue_io_opt(mddev->queue, chunk_size * |
6103 | (conf->raid_disks - conf->max_degraded)); | 6103 | (conf->raid_disks - conf->max_degraded)); |
6104 | mddev->queue->limits.raid_partial_stripes_expensive = 1; | ||
6104 | /* | 6105 | /* |
6105 | * We can only discard a whole stripe. It doesn't make sense to | 6106 | * We can only discard a whole stripe. It doesn't make sense to |
6106 | * discard data disk but write parity disk | 6107 | * discard data disk but write parity disk |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 02cb6f0ea71d..0375654adb28 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -291,6 +291,7 @@ struct queue_limits { | |||
291 | unsigned char discard_misaligned; | 291 | unsigned char discard_misaligned; |
292 | unsigned char cluster; | 292 | unsigned char cluster; |
293 | unsigned char discard_zeroes_data; | 293 | unsigned char discard_zeroes_data; |
294 | unsigned char raid_partial_stripes_expensive; | ||
294 | }; | 295 | }; |
295 | 296 | ||
296 | struct request_queue { | 297 | struct request_queue { |