* [PATCH] bcache/md: Use raid stripe size
@ 2013-12-19 1:12 Kent Overstreet
2014-01-07 2:04 ` Mike Snitzer
0 siblings, 1 reply; 3+ messages in thread
From: Kent Overstreet @ 2013-12-19 1:12 UTC (permalink / raw)
To: linux-kernel, linux-bcache, neilb, axboe; +Cc: 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 to queue_limits.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
---
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(+)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 63ebef78df..e363efcf2b 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)
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)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index bef353c51c..4b5035f286 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -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
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 02cb6f0ea7..0375654adb 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -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 {
--
1.8.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bcache/md: Use raid stripe size
2013-12-19 1:12 [PATCH] bcache/md: Use raid stripe size Kent Overstreet
@ 2014-01-07 2:04 ` Mike Snitzer
2014-01-07 21:59 ` Kent Overstreet
0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2014-01-07 2:04 UTC (permalink / raw)
To: Kent Overstreet
Cc: linux-kernel@vger.kernel.org, linux-bcache, Neil Brown,
Jens Axboe
On Wed, Dec 18, 2013 at 8:12 PM, Kent Overstreet <kmo@daterainc.com> wrote:
> 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>
> ---
> 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,
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 02cb6f0ea7..0375654adb 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bcache/md: Use raid stripe size
2014-01-07 2:04 ` Mike Snitzer
@ 2014-01-07 21:59 ` Kent Overstreet
0 siblings, 0 replies; 3+ messages in thread
From: Kent Overstreet @ 2014-01-07 21:59 UTC (permalink / raw)
To: Mike Snitzer
Cc: linux-kernel@vger.kernel.org, linux-bcache, Neil Brown,
Jens Axboe
On Mon, Jan 06, 2014 at 09:04:25PM -0500, Mike Snitzer wrote:
> On Wed, Dec 18, 2013 at 8:12 PM, Kent Overstreet <kmo@daterainc.com> wrote:
> > 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>
> > ---
> > 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,
>
> > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> > index 02cb6f0ea7..0375654adb 100644
> > --- a/include/linux/blkdev.h
> > +++ b/include/linux/blkdev.h
> > @@ -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.
Thanks, going to send Jens a new pull after he does some merging so I'll include
that in the updated version.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-07 22:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-19 1:12 [PATCH] bcache/md: Use raid stripe size Kent Overstreet
2014-01-07 2:04 ` Mike Snitzer
2014-01-07 21:59 ` Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).