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>

NeilBrown a7a07e69 2b74e12e

+6 -6
+6 -6
drivers/md/md.c
··· 371 371 bio_put(bio); 372 372 } 373 373 374 + static void md_submit_flush_data(struct work_struct *ws); 375 + 374 376 static void submit_flushes(mddev_t *mddev) 375 377 { 376 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 382 rcu_read_lock(); 379 383 list_for_each_entry_rcu(rdev, &mddev->disks, same_set) 380 384 if (rdev->raid_disk >= 0 && ··· 401 397 rdev_dec_pending(rdev, mddev); 402 398 } 403 399 rcu_read_unlock(); 400 + if (atomic_dec_and_test(&mddev->flush_pending)) 401 + queue_work(md_wq, &mddev->flush_work); 404 402 } 405 403 406 404 static void md_submit_flush_data(struct work_struct *ws) ··· 432 426 mddev->flush_bio = bio; 433 427 spin_unlock_irq(&mddev->write_lock); 434 428 435 - atomic_set(&mddev->flush_pending, 1); 436 - INIT_WORK(&mddev->flush_work, md_submit_flush_data); 437 - 438 429 submit_flushes(mddev); 439 - 440 - if (atomic_dec_and_test(&mddev->flush_pending)) 441 - queue_work(md_wq, &mddev->flush_work); 442 430 } 443 431 EXPORT_SYMBOL(md_flush_request); 444 432