diff options
author | NeilBrown <neilb@suse.de> | 2010-12-09 00:04:25 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-12-09 00:04:25 -0500 |
commit | a7a07e69653acf8540daa1da053cd84bf86e8e66 (patch) | |
tree | edeb5ec7fc686c8699193338d3c3964aeb6279a8 /drivers/md | |
parent | 2b74e12e567feb4163e32815bce0be57489e73b9 (diff) |
md: move code in to submit_flushes.
submit_flushes is called from exactly one place.
Move the code that is before and after that call into
submit_flushes.
This has not functional change, but will make the next patch
smaller and easier to follow.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 83b6cb3e7025..31f8e151d893 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -371,10 +371,14 @@ static void md_end_flush(struct bio *bio, int err) | |||
371 | bio_put(bio); | 371 | bio_put(bio); |
372 | } | 372 | } |
373 | 373 | ||
374 | static void md_submit_flush_data(struct work_struct *ws); | ||
375 | |||
374 | static void submit_flushes(mddev_t *mddev) | 376 | static void submit_flushes(mddev_t *mddev) |
375 | { | 377 | { |
376 | mdk_rdev_t *rdev; | 378 | mdk_rdev_t *rdev; |
377 | 379 | ||
380 | INIT_WORK(&mddev->flush_work, md_submit_flush_data); | ||
381 | atomic_set(&mddev->flush_pending, 1); | ||
378 | rcu_read_lock(); | 382 | rcu_read_lock(); |
379 | list_for_each_entry_rcu(rdev, &mddev->disks, same_set) | 383 | list_for_each_entry_rcu(rdev, &mddev->disks, same_set) |
380 | if (rdev->raid_disk >= 0 && | 384 | if (rdev->raid_disk >= 0 && |
@@ -397,6 +401,8 @@ static void submit_flushes(mddev_t *mddev) | |||
397 | rdev_dec_pending(rdev, mddev); | 401 | rdev_dec_pending(rdev, mddev); |
398 | } | 402 | } |
399 | rcu_read_unlock(); | 403 | rcu_read_unlock(); |
404 | if (atomic_dec_and_test(&mddev->flush_pending)) | ||
405 | queue_work(md_wq, &mddev->flush_work); | ||
400 | } | 406 | } |
401 | 407 | ||
402 | static void md_submit_flush_data(struct work_struct *ws) | 408 | static void md_submit_flush_data(struct work_struct *ws) |
@@ -426,13 +432,7 @@ void md_flush_request(mddev_t *mddev, struct bio *bio) | |||
426 | mddev->flush_bio = bio; | 432 | mddev->flush_bio = bio; |
427 | spin_unlock_irq(&mddev->write_lock); | 433 | spin_unlock_irq(&mddev->write_lock); |
428 | 434 | ||
429 | atomic_set(&mddev->flush_pending, 1); | ||
430 | INIT_WORK(&mddev->flush_work, md_submit_flush_data); | ||
431 | |||
432 | submit_flushes(mddev); | 435 | submit_flushes(mddev); |
433 | |||
434 | if (atomic_dec_and_test(&mddev->flush_pending)) | ||
435 | queue_work(md_wq, &mddev->flush_work); | ||
436 | } | 436 | } |
437 | EXPORT_SYMBOL(md_flush_request); | 437 | EXPORT_SYMBOL(md_flush_request); |
438 | 438 | ||