mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-27 08:32:20 +00:00
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:
parent
2060120201
commit
75fea7496c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user