Commit 445a6944 authored by Chris Mason's avatar Chris Mason

Btrfs: Fix usage of struct extent_map->orig_start

This makes sure the orig_start field in struct extent_map gets set
everywhere the extent_map structs are created or modified.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 39be25cd
...@@ -244,16 +244,17 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -244,16 +244,17 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
split->start = start + len; split->start = start + len;
split->len = em->start + em->len - (start + len); split->len = em->start + em->len - (start + len);
split->orig_start = em->orig_start;
split->bdev = em->bdev; split->bdev = em->bdev;
split->flags = flags; split->flags = flags;
if (compressed) { if (compressed) {
split->block_len = em->block_len; split->block_len = em->block_len;
split->block_start = em->block_start; split->block_start = em->block_start;
split->orig_start = em->orig_start;
} else { } else {
split->block_len = split->len; split->block_len = split->len;
split->block_start = em->block_start + diff; split->block_start = em->block_start + diff;
split->orig_start = split->start;
} }
ret = add_extent_mapping(em_tree, split); ret = add_extent_mapping(em_tree, split);
......
...@@ -610,6 +610,7 @@ static noinline int submit_compressed_extents(struct inode *inode, ...@@ -610,6 +610,7 @@ static noinline int submit_compressed_extents(struct inode *inode,
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map(GFP_NOFS);
em->start = async_extent->start; em->start = async_extent->start;
em->len = async_extent->ram_size; em->len = async_extent->ram_size;
em->orig_start = em->start;
em->block_start = ins.objectid; em->block_start = ins.objectid;
em->block_len = ins.offset; em->block_len = ins.offset;
...@@ -743,6 +744,7 @@ static noinline int cow_file_range(struct inode *inode, ...@@ -743,6 +744,7 @@ static noinline int cow_file_range(struct inode *inode,
} }
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map(GFP_NOFS);
em->start = start; em->start = start;
em->orig_start = em->start;
ram_size = ins.offset; ram_size = ins.offset;
em->len = ins.offset; em->len = ins.offset;
...@@ -1057,6 +1059,7 @@ static int run_delalloc_nocow(struct inode *inode, struct page *locked_page, ...@@ -1057,6 +1059,7 @@ static int run_delalloc_nocow(struct inode *inode, struct page *locked_page,
em_tree = &BTRFS_I(inode)->extent_tree; em_tree = &BTRFS_I(inode)->extent_tree;
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map(GFP_NOFS);
em->start = cur_offset; em->start = cur_offset;
em->orig_start = em->start;
em->len = num_bytes; em->len = num_bytes;
em->block_len = num_bytes; em->block_len = num_bytes;
em->block_start = disk_bytenr; em->block_start = disk_bytenr;
...@@ -3876,6 +3879,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -3876,6 +3879,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
} }
em->bdev = root->fs_info->fs_devices->latest_bdev; em->bdev = root->fs_info->fs_devices->latest_bdev;
em->start = EXTENT_MAP_HOLE; em->start = EXTENT_MAP_HOLE;
em->orig_start = EXTENT_MAP_HOLE;
em->len = (u64)-1; em->len = (u64)-1;
em->block_len = (u64)-1; em->block_len = (u64)-1;
......
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