diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-10 11:53:33 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-10 11:53:33 -0500 |
commit | 445a69449994a37615cd47e47bcab2e42a070adf (patch) | |
tree | eb41f8246fe64bd32c1bb9ee544b1b27866ec79b /fs | |
parent | 39be25cd89450940b0e5f8a6aad71d1ec99b17bf (diff) |
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: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 85841c538805..4119f9a95320 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -244,16 +244,17 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
244 | 244 | ||
245 | split->start = start + len; | 245 | split->start = start + len; |
246 | split->len = em->start + em->len - (start + len); | 246 | split->len = em->start + em->len - (start + len); |
247 | split->orig_start = em->orig_start; | ||
248 | split->bdev = em->bdev; | 247 | split->bdev = em->bdev; |
249 | split->flags = flags; | 248 | split->flags = flags; |
250 | 249 | ||
251 | if (compressed) { | 250 | if (compressed) { |
252 | split->block_len = em->block_len; | 251 | split->block_len = em->block_len; |
253 | split->block_start = em->block_start; | 252 | split->block_start = em->block_start; |
253 | split->orig_start = em->orig_start; | ||
254 | } else { | 254 | } else { |
255 | split->block_len = split->len; | 255 | split->block_len = split->len; |
256 | split->block_start = em->block_start + diff; | 256 | split->block_start = em->block_start + diff; |
257 | split->orig_start = split->start; | ||
257 | } | 258 | } |
258 | 259 | ||
259 | ret = add_extent_mapping(em_tree, split); | 260 | ret = add_extent_mapping(em_tree, split); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 59660293d291..5ca9c0672374 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -610,6 +610,7 @@ static noinline int submit_compressed_extents(struct inode *inode, | |||
610 | em = alloc_extent_map(GFP_NOFS); | 610 | em = alloc_extent_map(GFP_NOFS); |
611 | em->start = async_extent->start; | 611 | em->start = async_extent->start; |
612 | em->len = async_extent->ram_size; | 612 | em->len = async_extent->ram_size; |
613 | em->orig_start = em->start; | ||
613 | 614 | ||
614 | em->block_start = ins.objectid; | 615 | em->block_start = ins.objectid; |
615 | em->block_len = ins.offset; | 616 | em->block_len = ins.offset; |
@@ -743,6 +744,7 @@ static noinline int cow_file_range(struct inode *inode, | |||
743 | } | 744 | } |
744 | em = alloc_extent_map(GFP_NOFS); | 745 | em = alloc_extent_map(GFP_NOFS); |
745 | em->start = start; | 746 | em->start = start; |
747 | em->orig_start = em->start; | ||
746 | 748 | ||
747 | ram_size = ins.offset; | 749 | ram_size = ins.offset; |
748 | em->len = ins.offset; | 750 | em->len = ins.offset; |
@@ -1057,6 +1059,7 @@ out_check: | |||
1057 | em_tree = &BTRFS_I(inode)->extent_tree; | 1059 | em_tree = &BTRFS_I(inode)->extent_tree; |
1058 | em = alloc_extent_map(GFP_NOFS); | 1060 | em = alloc_extent_map(GFP_NOFS); |
1059 | em->start = cur_offset; | 1061 | em->start = cur_offset; |
1062 | em->orig_start = em->start; | ||
1060 | em->len = num_bytes; | 1063 | em->len = num_bytes; |
1061 | em->block_len = num_bytes; | 1064 | em->block_len = num_bytes; |
1062 | em->block_start = disk_bytenr; | 1065 | em->block_start = disk_bytenr; |
@@ -3876,6 +3879,7 @@ again: | |||
3876 | } | 3879 | } |
3877 | em->bdev = root->fs_info->fs_devices->latest_bdev; | 3880 | em->bdev = root->fs_info->fs_devices->latest_bdev; |
3878 | em->start = EXTENT_MAP_HOLE; | 3881 | em->start = EXTENT_MAP_HOLE; |
3882 | em->orig_start = EXTENT_MAP_HOLE; | ||
3879 | em->len = (u64)-1; | 3883 | em->len = (u64)-1; |
3880 | em->block_len = (u64)-1; | 3884 | em->block_len = (u64)-1; |
3881 | 3885 | ||