aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-11-01 03:33:59 -0400
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 4ec41ecb4d65..bcf0e48b1932 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,
3143 struct btrfs_path *dst_path, struct log_args *args) 3143 struct btrfs_path *dst_path, struct log_args *args)
3144{ 3144{
3145 struct btrfs_root *log = root->log_root; 3145 struct btrfs_root *log = root->log_root;
3146 struct btrfs_file_extent_item *fi;
3147 struct btrfs_key key; 3146 struct btrfs_key key;
3148 u64 start = em->mod_start; 3147 u64 start = em->mod_start;
3149 u64 search_start = start; 3148 u64 search_start = start;
@@ -3199,10 +3198,7 @@ again:
3199 } 3198 }
3200 } while (key.offset > start); 3199 } while (key.offset > start);
3201 3200
3202 fi = btrfs_item_ptr(path->nodes[0], path->slots[0], 3201 num_bytes = btrfs_file_extent_length(path);
3203 struct btrfs_file_extent_item);
3204 num_bytes = btrfs_file_extent_num_bytes(path->nodes[0],
3205 fi);
3206 if (key.offset + num_bytes <= start) { 3202 if (key.offset + num_bytes <= start) {
3207 btrfs_release_path(path); 3203 btrfs_release_path(path);
3208 return -ENOENT; 3204 return -ENOENT;
@@ -3211,8 +3207,7 @@ again:
3211 args->src = path->nodes[0]; 3207 args->src = path->nodes[0];
3212next_slot: 3208next_slot:
3213 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); 3209 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
3214 fi = btrfs_item_ptr(args->src, path->slots[0], 3210 num_bytes = btrfs_file_extent_length(path);
3215 struct btrfs_file_extent_item);
3216 if (args->nr && 3211 if (args->nr &&
3217 args->start_slot + args->nr == path->slots[0]) { 3212 args->start_slot + args->nr == path->slots[0]) {
3218 args->nr++; 3213 args->nr++;
@@ -3230,7 +3225,6 @@ next_slot:
3230 } 3225 }
3231 nritems = btrfs_header_nritems(path->nodes[0]); 3226 nritems = btrfs_header_nritems(path->nodes[0]);
3232 path->slots[0]++; 3227 path->slots[0]++;
3233 num_bytes = btrfs_file_extent_num_bytes(args->src, fi);
3234 if (len < num_bytes) { 3228 if (len < num_bytes) {
3235 /* I _think_ this is ok, envision we write to a 3229 /* I _think_ this is ok, envision we write to a
3236 * preallocated space that is adjacent to a previously 3230 * preallocated space that is adjacent to a previously