diff options
author | Shaohua Li <shli@kernel.org> | 2014-05-21 05:57:44 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-05-29 02:59:47 -0400 |
commit | d592a9969141e67a3874c808999a4db4bf82ed83 (patch) | |
tree | 3cd94df571c6c289394b12efe20ed3874b132a37 /drivers/md/raid5.h | |
parent | f2e06c58841b3e89eaacfa88ce14389d311c54a8 (diff) |
raid5: add an option to avoid copy data from bio to stripe cache
The stripe cache has two goals:
1. cache data, so next time if data can be found in stripe cache, disk access
can be avoided.
2. stable data. data is copied from bio to stripe cache and calculated parity.
data written to disk is from stripe cache, so if upper layer changes bio data,
data written to disk isn't impacted.
In my environment, I can guarantee 2 will not happen. And BDI_CAP_STABLE_WRITES
can guarantee 2 too. For 1, it's not common too. block plug mechanism will
dispatch a bunch of sequentail small requests together. And since I'm using
SSD, I'm using small chunk size. It's rare case stripe cache is really useful.
So I'd like to avoid the copy from bio to stripe cache and it's very helpful
for performance. In my 1M randwrite tests, avoid the copy can increase the
performance more than 30%.
Of course, this shouldn't be enabled by default. It's reported enabling
BDI_CAP_STABLE_WRITES can harm some workloads before, so I added an option to
control it.
Neilb:
changed BUG_ON to WARN_ON
Removed some assignments from raid5_build_block which are now not needed.
Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.h')
-rw-r--r-- | drivers/md/raid5.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 01ad8ae8f578..bc72cd4be5f8 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -232,7 +232,7 @@ struct stripe_head { | |||
232 | */ | 232 | */ |
233 | struct bio req, rreq; | 233 | struct bio req, rreq; |
234 | struct bio_vec vec, rvec; | 234 | struct bio_vec vec, rvec; |
235 | struct page *page; | 235 | struct page *page, *orig_page; |
236 | struct bio *toread, *read, *towrite, *written; | 236 | struct bio *toread, *read, *towrite, *written; |
237 | sector_t sector; /* sector of this page */ | 237 | sector_t sector; /* sector of this page */ |
238 | unsigned long flags; | 238 | unsigned long flags; |
@@ -299,6 +299,7 @@ enum r5dev_flags { | |||
299 | * data in, and now is a good time to write it out. | 299 | * data in, and now is a good time to write it out. |
300 | */ | 300 | */ |
301 | R5_Discard, /* Discard the stripe */ | 301 | R5_Discard, /* Discard the stripe */ |
302 | R5_SkipCopy, /* Don't copy data from bio to stripe cache */ | ||
302 | }; | 303 | }; |
303 | 304 | ||
304 | /* | 305 | /* |
@@ -436,6 +437,7 @@ struct r5conf { | |||
436 | atomic_t pending_full_writes; /* full write backlog */ | 437 | atomic_t pending_full_writes; /* full write backlog */ |
437 | int bypass_count; /* bypassed prereads */ | 438 | int bypass_count; /* bypassed prereads */ |
438 | int bypass_threshold; /* preread nice */ | 439 | int bypass_threshold; /* preread nice */ |
440 | int skip_copy; /* Don't copy data from bio to stripe cache */ | ||
439 | struct list_head *last_hold; /* detect hold_list promotions */ | 441 | struct list_head *last_hold; /* detect hold_list promotions */ |
440 | 442 | ||
441 | atomic_t reshape_stripes; /* stripes with pending writes for reshape */ | 443 | atomic_t reshape_stripes; /* stripes with pending writes for reshape */ |