aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-10-05 03:31:08 -0400
committerNeilBrown <neilb@suse.com>2015-10-31 22:48:27 -0400
commitd8858f4321b744ff02e286165b643e8dc0ef1cf5 (patch)
treea9e4ae8b7c4ecc1d3059d1d452e9b7fdef65e499
parent04732f741dce5e21b3ca90677a237635f1e98184 (diff)
raid5-cache: factor out a helper to run all stripes for an I/O unit
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
-rw-r--r--drivers/md/raid5-cache.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index c7d5a1ee4b75..a81db0a8466a 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -194,6 +194,17 @@ static void __r5l_set_io_unit_state(struct r5l_io_unit *io,
194 io->state = state; 194 io->state = state;
195} 195}
196 196
197static void r5l_io_run_stripes(struct r5l_io_unit *io)
198{
199 struct stripe_head *sh, *next;
200
201 list_for_each_entry_safe(sh, next, &io->stripe_list, log_list) {
202 list_del_init(&sh->log_list);
203 set_bit(STRIPE_HANDLE, &sh->state);
204 raid5_release_stripe(sh);
205 }
206}
207
197/* XXX: totally ignores I/O errors */ 208/* XXX: totally ignores I/O errors */
198static void r5l_log_endio(struct bio *bio) 209static void r5l_log_endio(struct bio *bio)
199{ 210{
@@ -584,18 +595,10 @@ static void r5l_log_flush_endio(struct bio *bio)
584 flush_bio); 595 flush_bio);
585 unsigned long flags; 596 unsigned long flags;
586 struct r5l_io_unit *io; 597 struct r5l_io_unit *io;
587 struct stripe_head *sh;
588 598
589 spin_lock_irqsave(&log->io_list_lock, flags); 599 spin_lock_irqsave(&log->io_list_lock, flags);
590 list_for_each_entry(io, &log->flushing_ios, log_sibling) { 600 list_for_each_entry(io, &log->flushing_ios, log_sibling)
591 while (!list_empty(&io->stripe_list)) { 601 r5l_io_run_stripes(io);
592 sh = list_first_entry(&io->stripe_list,
593 struct stripe_head, log_list);
594 list_del_init(&sh->log_list);
595 set_bit(STRIPE_HANDLE, &sh->state);
596 raid5_release_stripe(sh);
597 }
598 }
599 list_splice_tail_init(&log->flushing_ios, &log->finished_ios); 602 list_splice_tail_init(&log->flushing_ios, &log->finished_ios);
600 spin_unlock_irqrestore(&log->io_list_lock, flags); 603 spin_unlock_irqrestore(&log->io_list_lock, flags);
601} 604}