Skip to content

Commit

Permalink
md: remove handling of flush_pending in md_submit_flush_data
Browse files Browse the repository at this point in the history
None of the functions called between setting flush_pending to 1, and
atomic_dec_and_test can change flush_pending, or will anything
running in any other thread (as ->flush_bio is not NULL).  So the
atomic_dec_and_test will always succeed.
So remove the atomic_sec and the atomic_dec_and_test.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Dec 9, 2010
1 parent be20e6c commit 2b74e12
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ static void md_submit_flush_data(struct work_struct *ws)
mddev_t *mddev = container_of(ws, mddev_t, flush_work);
struct bio *bio = mddev->flush_bio;

atomic_set(&mddev->flush_pending, 1);

if (bio->bi_size == 0)
/* an empty barrier - all done */
bio_endio(bio, 0);
Expand All @@ -414,10 +412,9 @@ static void md_submit_flush_data(struct work_struct *ws)
if (mddev->pers->make_request(mddev, bio))
generic_make_request(bio);
}
if (atomic_dec_and_test(&mddev->flush_pending)) {
mddev->flush_bio = NULL;
wake_up(&mddev->sb_wait);
}

mddev->flush_bio = NULL;
wake_up(&mddev->sb_wait);
}

void md_flush_request(mddev_t *mddev, struct bio *bio)
Expand Down

0 comments on commit 2b74e12

Please sign in to comment.