提交 c70810b3 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] md: reformat code in raid1_end_write_request to avoid goto

A recent change made this goto unnecessary, so reformat the code to make it
clearer what is happening.
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 72d94861
...@@ -374,26 +374,26 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int ...@@ -374,26 +374,26 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int
* already. * already.
*/ */
if (atomic_dec_and_test(&r1_bio->remaining)) { if (atomic_dec_and_test(&r1_bio->remaining)) {
if (test_bit(R1BIO_BarrierRetry, &r1_bio->state)) { if (test_bit(R1BIO_BarrierRetry, &r1_bio->state))
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
goto out; else {
} /* it really is the end of this request */
/* it really is the end of this request */ if (test_bit(R1BIO_BehindIO, &r1_bio->state)) {
if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { /* free extra copy of the data pages */
/* free extra copy of the data pages */ int i = bio->bi_vcnt;
int i = bio->bi_vcnt; while (i--)
while (i--) safe_put_page(bio->bi_io_vec[i].bv_page);
safe_put_page(bio->bi_io_vec[i].bv_page); }
/* clear the bitmap if all writes complete successfully */
bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector,
r1_bio->sectors,
!test_bit(R1BIO_Degraded, &r1_bio->state),
behind);
md_write_end(r1_bio->mddev);
raid_end_bio_io(r1_bio);
} }
/* clear the bitmap if all writes complete successfully */
bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector,
r1_bio->sectors,
!test_bit(R1BIO_Degraded, &r1_bio->state),
behind);
md_write_end(r1_bio->mddev);
raid_end_bio_io(r1_bio);
} }
out:
if (to_put) if (to_put)
bio_put(to_put); bio_put(to_put);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册