btrfs-progs: remove extent_buffer::fd and extent_buffer::dev_bytes
Those two members are a shortcut for non-RAID56 profiles. But we should not use such shortcut, and move all our logical address read/write to the unified read_data_from_disk()/write_data_to_disk(). With previous refactors, now we're safe to remove them. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3ff9d35257
commit
a99bece1cd
|
@ -55,7 +55,7 @@ static int debug_corrupt_block(struct extent_buffer *eb,
|
|||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
error("cannot read eb bytenr %llu: %m",
|
||||
(unsigned long long)eb->dev_bytenr);
|
||||
(unsigned long long)eb->start);
|
||||
return ret;
|
||||
}
|
||||
printf("corrupting %llu copy %d\n", eb->start,
|
||||
|
@ -65,10 +65,9 @@ static int debug_corrupt_block(struct extent_buffer *eb,
|
|||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
error("cannot write eb bytenr %llu: %m",
|
||||
(unsigned long long)eb->dev_bytenr);
|
||||
(unsigned long long)eb->start);
|
||||
return ret;
|
||||
}
|
||||
fsync(eb->fd);
|
||||
}
|
||||
|
||||
num_copies = btrfs_num_copies(root->fs_info, eb->start,
|
||||
|
|
|
@ -590,10 +590,9 @@ static void generic_err(const struct extent_buffer *buf, int slot,
|
|||
{
|
||||
va_list args;
|
||||
|
||||
fprintf(stderr, "corrupt %s: root=%lld block=%llu physical=%llu slot=%d, ",
|
||||
fprintf(stderr, "corrupt %s: root=%lld block=%llu slot=%d, ",
|
||||
btrfs_header_level(buf) == 0 ? "leaf": "node",
|
||||
btrfs_header_owner(buf), btrfs_header_bytenr(buf),
|
||||
buf->dev_bytenr, slot);
|
||||
btrfs_header_owner(buf), btrfs_header_bytenr(buf), slot);
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
|
|
|
@ -616,8 +616,6 @@ static struct extent_buffer *__alloc_extent_buffer(struct btrfs_fs_info *info,
|
|||
eb->len = blocksize;
|
||||
eb->refs = 1;
|
||||
eb->flags = 0;
|
||||
eb->fd = -1;
|
||||
eb->dev_bytenr = (u64)-1;
|
||||
eb->cache_node.start = bytenr;
|
||||
eb->cache_node.size = blocksize;
|
||||
eb->fs_info = info;
|
||||
|
|
|
@ -88,13 +88,11 @@ struct extent_state {
|
|||
struct extent_buffer {
|
||||
struct cache_extent cache_node;
|
||||
u64 start;
|
||||
u64 dev_bytenr;
|
||||
struct list_head lru;
|
||||
struct list_head recow;
|
||||
u32 len;
|
||||
int refs;
|
||||
u32 flags;
|
||||
int fd;
|
||||
struct btrfs_fs_info *fs_info;
|
||||
char data[] __attribute__((aligned(8)));
|
||||
};
|
||||
|
|
|
@ -2626,8 +2626,6 @@ static int split_eb_for_raid56(struct btrfs_fs_info *info,
|
|||
eb->len = stripe_len;
|
||||
eb->refs = 1;
|
||||
eb->flags = 0;
|
||||
eb->fd = -1;
|
||||
eb->dev_bytenr = (u64)-1;
|
||||
eb->fs_info = info;
|
||||
|
||||
this_eb_start = raid_map[i];
|
||||
|
@ -2682,9 +2680,6 @@ int write_raid56_with_parity(struct btrfs_fs_info *info,
|
|||
for (i = 0; i < multi->num_stripes; i++) {
|
||||
struct extent_buffer *new_eb;
|
||||
if (raid_map[i] < BTRFS_RAID5_P_STRIPE) {
|
||||
ebs[i]->dev_bytenr = multi->stripes[i].physical;
|
||||
ebs[i]->fd = multi->stripes[i].dev->fd;
|
||||
multi->stripes[i].dev->total_ios++;
|
||||
if (ebs[i]->start != raid_map[i]) {
|
||||
ret = -EINVAL;
|
||||
goto out_free_split;
|
||||
|
@ -2696,8 +2691,6 @@ int write_raid56_with_parity(struct btrfs_fs_info *info,
|
|||
ret = -ENOMEM;
|
||||
goto out_free_split;
|
||||
}
|
||||
new_eb->dev_bytenr = multi->stripes[i].physical;
|
||||
new_eb->fd = multi->stripes[i].dev->fd;
|
||||
multi->stripes[i].dev->total_ios++;
|
||||
new_eb->len = stripe_len;
|
||||
new_eb->fs_info = info;
|
||||
|
@ -2726,8 +2719,9 @@ int write_raid56_with_parity(struct btrfs_fs_info *info,
|
|||
}
|
||||
|
||||
for (i = 0; i < multi->num_stripes; i++) {
|
||||
ret = btrfs_pwrite(ebs[i]->fd, ebs[i]->data, ebs[i]->len,
|
||||
ebs[i]->dev_bytenr, info->zoned);
|
||||
multi->stripes[i].dev->total_ios++;
|
||||
ret = btrfs_pwrite(multi->stripes[i].dev->fd, ebs[i]->data, ebs[i]->len,
|
||||
multi->stripes[i].physical, info->zoned);
|
||||
if (ret < 0)
|
||||
goto out_free_split;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue