btrfs-progs: use write_data_to_disk() to handle RAID56 in write_and_map_eb()

Function write_data_to_disk() can handle RAID56 writes without any
problem.

So just call write_data_to_disk() inside write_and_map_eb() instead of
manually doing the RAID56 write.

Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2022-08-02 15:52:43 +08:00 committed by David Sterba
parent 2060120201
commit 75fea7496c

View File

@ -452,39 +452,10 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
int write_and_map_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
{
int ret;
u64 length;
u64 *raid_map = NULL;
struct btrfs_multi_bio *multi = NULL;
length = eb->len;
ret = btrfs_map_block(fs_info, WRITE, eb->start, &length,
&multi, 0, &raid_map);
if (ret < 0) {
errno = -ret;
error("failed to map bytenr %llu length %u: %m",
eb->start, eb->len);
goto out;
}
/* RAID56 write back need RMW */
if (raid_map) {
ret = write_raid56_with_parity(fs_info, eb, multi,
length, raid_map);
if (ret < 0) {
errno = -ret;
error(
"failed to write raid56 stripe for bytenr %llu length %llu: %m",
eb->start, length);
} else {
ret = 0;
}
goto out;
}
/*
* For non-RAID56, we just writeback data to all mirrors using
* write_data_to_disk().
*/
/* write_data_to_disk() will handle all mirrors and RAID56. */
ret = write_data_to_disk(fs_info, eb->data, eb->start, eb->len);
if (ret < 0) {
errno = -ret;