提交 4d762701 编写于 作者: C Christoph Hellwig 提交者: 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: NQu Wenruo <wqu@suse.com>
Reviewed-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 abb49e87
......@@ -2300,24 +2300,22 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
* Either full stripe write, or we have every data sector already
* cached, can go to write path immediately.
*/
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
* the full RMW.
*/
ret = alloc_rbio_data_pages(rbio);
if (ret < 0)
return ret;
if (!rbio_is_full(rbio) && need_read_stripe_sectors(rbio)) {
/*
* Now we're doing sub-stripe write, also need all data stripes
* to do the full RMW.
*/
ret = alloc_rbio_data_pages(rbio);
if (ret < 0)
return ret;
index_rbio_pages(rbio);
index_rbio_pages(rbio);
ret = rmw_read_wait_recover(rbio);
if (ret < 0)
return ret;
ret = rmw_read_wait_recover(rbio);
if (ret < 0)
return ret;
}
write:
/*
* 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册