Commit 4d762701 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

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: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent abb49e87
...@@ -2300,12 +2300,10 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio) ...@@ -2300,12 +2300,10 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
* Either full stripe write, or we have every data sector already * Either full stripe write, or we have every data sector already
* cached, can go to write path immediately. * cached, can go to write path immediately.
*/ */
if (rbio_is_full(rbio) || !need_read_stripe_sectors(rbio)) if (!rbio_is_full(rbio) && need_read_stripe_sectors(rbio)) {
goto write;
/* /*
* Now we're doing sub-stripe write, also need all data stripes to do * Now we're doing sub-stripe write, also need all data stripes
* the full RMW. * to do the full RMW.
*/ */
ret = alloc_rbio_data_pages(rbio); ret = alloc_rbio_data_pages(rbio);
if (ret < 0) if (ret < 0)
...@@ -2316,8 +2314,8 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio) ...@@ -2316,8 +2314,8 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
ret = rmw_read_wait_recover(rbio); ret = rmw_read_wait_recover(rbio);
if (ret < 0) if (ret < 0)
return ret; return ret;
}
write:
/* /*
* At this stage we're not allowed to add any new bios to the * At this stage we're not allowed to add any new bios to the
* bio list any more, anyone else that wants to change this stripe * bio list any more, anyone else that wants to change this stripe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment