Skip to content

Commit 4d76270

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: raid56: simplify code flow in rmw_rbio
Remove the write goto label by moving the data page allocation and data read into the branch. Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent abb49e8 commit 4d76270

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

fs/btrfs/raid56.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,24 +2300,22 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
23002300
* Either full stripe write, or we have every data sector already
23012301
* cached, can go to write path immediately.
23022302
*/
2303-
if (rbio_is_full(rbio) || !need_read_stripe_sectors(rbio))
2304-
goto write;
2305-
2306-
/*
2307-
* Now we're doing sub-stripe write, also need all data stripes to do
2308-
* the full RMW.
2309-
*/
2310-
ret = alloc_rbio_data_pages(rbio);
2311-
if (ret < 0)
2312-
return ret;
2303+
if (!rbio_is_full(rbio) && need_read_stripe_sectors(rbio)) {
2304+
/*
2305+
* Now we're doing sub-stripe write, also need all data stripes
2306+
* to do the full RMW.
2307+
*/
2308+
ret = alloc_rbio_data_pages(rbio);
2309+
if (ret < 0)
2310+
return ret;
23132311

2314-
index_rbio_pages(rbio);
2312+
index_rbio_pages(rbio);
23152313

2316-
ret = rmw_read_wait_recover(rbio);
2317-
if (ret < 0)
2318-
return ret;
2314+
ret = rmw_read_wait_recover(rbio);
2315+
if (ret < 0)
2316+
return ret;
2317+
}
23192318

2320-
write:
23212319
/*
23222320
* At this stage we're not allowed to add any new bios to the
23232321
* bio list any more, anyone else that wants to change this stripe

0 commit comments

Comments
 (0)