aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/tree-log.c127
1 files changed, 73 insertions, 54 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 72444811d275..83186c7e45d4 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2952,33 +2952,9 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
2952 struct btrfs_inode_item *item, 2952 struct btrfs_inode_item *item,
2953 struct inode *inode, int log_inode_only) 2953 struct inode *inode, int log_inode_only)
2954{ 2954{
2955 btrfs_set_inode_uid(leaf, item, i_uid_read(inode)); 2955 struct btrfs_map_token token;
2956 btrfs_set_inode_gid(leaf, item, i_gid_read(inode)); 2956
2957 btrfs_set_inode_mode(leaf, item, inode->i_mode); 2957 btrfs_init_map_token(&token);
2958 btrfs_set_inode_nlink(leaf, item, inode->i_nlink);
2959
2960 btrfs_set_timespec_sec(leaf, btrfs_inode_atime(item),
2961 inode->i_atime.tv_sec);
2962 btrfs_set_timespec_nsec(leaf, btrfs_inode_atime(item),
2963 inode->i_atime.tv_nsec);
2964
2965 btrfs_set_timespec_sec(leaf, btrfs_inode_mtime(item),
2966 inode->i_mtime.tv_sec);
2967 btrfs_set_timespec_nsec(leaf, btrfs_inode_mtime(item),
2968 inode->i_mtime.tv_nsec);
2969
2970 btrfs_set_timespec_sec(leaf, btrfs_inode_ctime(item),
2971 inode->i_ctime.tv_sec);
2972 btrfs_set_timespec_nsec(leaf, btrfs_inode_ctime(item),
2973 inode->i_ctime.tv_nsec);
2974
2975 btrfs_set_inode_nbytes(leaf, item, inode_get_bytes(inode));
2976
2977 btrfs_set_inode_sequence(leaf, item, inode->i_version);
2978 btrfs_set_inode_transid(leaf, item, trans->transid);
2979 btrfs_set_inode_rdev(leaf, item, inode->i_rdev);
2980 btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags);
2981 btrfs_set_inode_block_group(leaf, item, 0);
2982 2958
2983 if (log_inode_only) { 2959 if (log_inode_only) {
2984 /* set the generation to zero so the recover code 2960 /* set the generation to zero so the recover code
@@ -2986,14 +2962,43 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
2986 * just to say 'this inode exists' and a logging 2962 * just to say 'this inode exists' and a logging
2987 * to say 'update this inode with these values' 2963 * to say 'update this inode with these values'
2988 */ 2964 */
2989 btrfs_set_inode_generation(leaf, item, 0); 2965 btrfs_set_token_inode_generation(leaf, item, 0, &token);
2990 btrfs_set_inode_size(leaf, item, 0); 2966 btrfs_set_token_inode_size(leaf, item, 0, &token);
2991 } else { 2967 } else {
2992 btrfs_set_inode_generation(leaf, item, 2968 btrfs_set_token_inode_generation(leaf, item,
2993 BTRFS_I(inode)->generation); 2969 BTRFS_I(inode)->generation,
2994 btrfs_set_inode_size(leaf, item, inode->i_size); 2970 &token);
2995 } 2971 btrfs_set_token_inode_size(leaf, item, inode->i_size, &token);
2996 2972 }
2973
2974 btrfs_set_token_inode_uid(leaf, item, i_uid_read(inode), &token);
2975 btrfs_set_token_inode_gid(leaf, item, i_gid_read(inode), &token);
2976 btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token);
2977 btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token);
2978
2979 btrfs_set_token_timespec_sec(leaf, btrfs_inode_atime(item),
2980 inode->i_atime.tv_sec, &token);
2981 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_atime(item),
2982 inode->i_atime.tv_nsec, &token);
2983
2984 btrfs_set_token_timespec_sec(leaf, btrfs_inode_mtime(item),
2985 inode->i_mtime.tv_sec, &token);
2986 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_mtime(item),
2987 inode->i_mtime.tv_nsec, &token);
2988
2989 btrfs_set_token_timespec_sec(leaf, btrfs_inode_ctime(item),
2990 inode->i_ctime.tv_sec, &token);
2991 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_ctime(item),
2992 inode->i_ctime.tv_nsec, &token);
2993
2994 btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode),
2995 &token);
2996
2997 btrfs_set_token_inode_sequence(leaf, item, inode->i_version, &token);
2998 btrfs_set_token_inode_transid(leaf, item, trans->transid, &token);
2999 btrfs_set_token_inode_rdev(leaf, item, inode->i_rdev, &token);
3000 btrfs_set_token_inode_flags(leaf, item, BTRFS_I(inode)->flags, &token);
3001 btrfs_set_token_inode_block_group(leaf, item, 0, &token);
2997} 3002}
2998 3003
2999static int log_inode_item(struct btrfs_trans_handle *trans, 3004static int log_inode_item(struct btrfs_trans_handle *trans,
@@ -3267,6 +3272,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
3267 struct btrfs_file_extent_item *fi; 3272 struct btrfs_file_extent_item *fi;
3268 struct extent_buffer *leaf; 3273 struct extent_buffer *leaf;
3269 struct list_head ordered_sums; 3274 struct list_head ordered_sums;
3275 struct btrfs_map_token token;
3270 struct btrfs_key key; 3276 struct btrfs_key key;
3271 u64 csum_offset = em->mod_start - em->start; 3277 u64 csum_offset = em->mod_start - em->start;
3272 u64 csum_len = em->mod_len; 3278 u64 csum_len = em->mod_len;
@@ -3276,6 +3282,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
3276 bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; 3282 bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
3277 3283
3278 INIT_LIST_HEAD(&ordered_sums); 3284 INIT_LIST_HEAD(&ordered_sums);
3285 btrfs_init_map_token(&token);
3279 key.objectid = btrfs_ino(inode); 3286 key.objectid = btrfs_ino(inode);
3280 key.type = BTRFS_EXTENT_DATA_KEY; 3287 key.type = BTRFS_EXTENT_DATA_KEY;
3281 key.offset = em->start; 3288 key.offset = em->start;
@@ -3289,37 +3296,49 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
3289 leaf = path->nodes[0]; 3296 leaf = path->nodes[0];
3290 fi = btrfs_item_ptr(leaf, path->slots[0], 3297 fi = btrfs_item_ptr(leaf, path->slots[0],
3291 struct btrfs_file_extent_item); 3298 struct btrfs_file_extent_item);
3292 btrfs_set_file_extent_generation(leaf, fi, em->generation); 3299 btrfs_set_token_file_extent_generation(leaf, fi, em->generation,
3300 &token);
3293 if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { 3301 if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
3294 skip_csum = true; 3302 skip_csum = true;
3295 btrfs_set_file_extent_type(leaf, fi, 3303 btrfs_set_token_file_extent_type(leaf, fi,
3296 BTRFS_FILE_EXTENT_PREALLOC); 3304 BTRFS_FILE_EXTENT_PREALLOC,
3305 &token);
3297 } else { 3306 } else {
3298 btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG); 3307 btrfs_set_token_file_extent_type(leaf, fi,
3308 BTRFS_FILE_EXTENT_REG,
3309 &token);
3299 if (em->block_start == 0) 3310 if (em->block_start == 0)
3300 skip_csum = true; 3311 skip_csum = true;
3301 } 3312 }
3302 3313
3303 block_len = max(em->block_len, em->orig_block_len); 3314 block_len = max(em->block_len, em->orig_block_len);
3304 if (em->compress_type != BTRFS_COMPRESS_NONE) { 3315 if (em->compress_type != BTRFS_COMPRESS_NONE) {
3305 btrfs_set_file_extent_disk_bytenr(leaf, fi, em->block_start); 3316 btrfs_set_token_file_extent_disk_bytenr(leaf, fi,
3306 btrfs_set_file_extent_disk_num_bytes(leaf, fi, block_len); 3317 em->block_start,
3318 &token);
3319 btrfs_set_token_file_extent_disk_num_bytes(leaf, fi, block_len,
3320 &token);
3307 } else if (em->block_start < EXTENT_MAP_LAST_BYTE) { 3321 } else if (em->block_start < EXTENT_MAP_LAST_BYTE) {
3308 btrfs_set_file_extent_disk_bytenr(leaf, fi, 3322 btrfs_set_token_file_extent_disk_bytenr(leaf, fi,
3309 em->block_start - 3323 em->block_start -
3310 extent_offset); 3324 extent_offset, &token);
3311 btrfs_set_file_extent_disk_num_bytes(leaf, fi, block_len); 3325 btrfs_set_token_file_extent_disk_num_bytes(leaf, fi, block_len,
3326 &token);
3312 } else { 3327 } else {
3313 btrfs_set_file_extent_disk_bytenr(leaf, fi, 0); 3328 btrfs_set_token_file_extent_disk_bytenr(leaf, fi, 0, &token);
3314 btrfs_set_file_extent_disk_num_bytes(leaf, fi, 0); 3329 btrfs_set_token_file_extent_disk_num_bytes(leaf, fi, 0,
3315 } 3330 &token);
3316 3331 }
3317 btrfs_set_file_extent_offset(leaf, fi, em->start - em->orig_start); 3332
3318 btrfs_set_file_extent_num_bytes(leaf, fi, em->len); 3333 btrfs_set_token_file_extent_offset(leaf, fi,
3319 btrfs_set_file_extent_ram_bytes(leaf, fi, em->len); 3334 em->start - em->orig_start,
3320 btrfs_set_file_extent_compression(leaf, fi, em->compress_type); 3335 &token);
3321 btrfs_set_file_extent_encryption(leaf, fi, 0); 3336 btrfs_set_token_file_extent_num_bytes(leaf, fi, em->len, &token);
3322 btrfs_set_file_extent_other_encoding(leaf, fi, 0); 3337 btrfs_set_token_file_extent_ram_bytes(leaf, fi, em->len, &token);
3338 btrfs_set_token_file_extent_compression(leaf, fi, em->compress_type,
3339 &token);
3340 btrfs_set_token_file_extent_encryption(leaf, fi, 0, &token);
3341 btrfs_set_token_file_extent_other_encoding(leaf, fi, 0, &token);
3323 btrfs_mark_buffer_dirty(leaf); 3342 btrfs_mark_buffer_dirty(leaf);
3324 3343
3325 /* 3344 /*