summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-11-01 07:33:59 +0000
committerJosef Bacik <jbacik@fusionio.com>2012-12-12 17:15:21 -0500
commit315a9850da2b89c83971b26fe54a60f22bdd91ad (patch)
tree725e3b6476abe2202457b6b39443dac47ec442c4 /fs/btrfs/tree-log.c
parentca46963718ef7368c84267c9f5e7394c3890442a (diff)
Btrfs: fix wrong file extent length
There are two types of the file extent - inline extent and regular extent, When we log file extents, we didn't take inline extent into account, fix it. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4ec41ecb4d6..bcf0e48b193 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3143,7 +3143,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
struct btrfs_path *dst_path, struct log_args *args)
{
struct btrfs_root *log = root->log_root;
- struct btrfs_file_extent_item *fi;
struct btrfs_key key;
u64 start = em->mod_start;
u64 search_start = start;
@@ -3199,10 +3198,7 @@ again:
}
} while (key.offset > start);
- fi = btrfs_item_ptr(path->nodes[0], path->slots[0],
- struct btrfs_file_extent_item);
- num_bytes = btrfs_file_extent_num_bytes(path->nodes[0],
- fi);
+ num_bytes = btrfs_file_extent_length(path);
if (key.offset + num_bytes <= start) {
btrfs_release_path(path);
return -ENOENT;
@@ -3211,8 +3207,7 @@ again:
args->src = path->nodes[0];
next_slot:
btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
- fi = btrfs_item_ptr(args->src, path->slots[0],
- struct btrfs_file_extent_item);
+ num_bytes = btrfs_file_extent_length(path);
if (args->nr &&
args->start_slot + args->nr == path->slots[0]) {
args->nr++;
@@ -3230,7 +3225,6 @@ next_slot:
}
nritems = btrfs_header_nritems(path->nodes[0]);
path->slots[0]++;
- num_bytes = btrfs_file_extent_num_bytes(args->src, fi);
if (len < num_bytes) {
/* I _think_ this is ok, envision we write to a
* preallocated space that is adjacent to a previously