summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-06-20 10:26:42 -0400
committerDavid Sterba <dsterba@suse.com>2018-08-06 07:12:31 -0400
commita9ecb653b0ac9ed95671aa494015bbb705bf3eae (patch)
treeaba7ab6ec6579cf8182561281e99ac476430e0c7 /fs/btrfs/tree-log.c
parentca5788aba3e8153da38cf99ca3ce2294f032fb51 (diff)
btrfs: Streamline log_extent_csums a bit
Currently this function takes the root as an argument only to get the log_root from it. Simplify this by directly passing the log root from the caller. Also eliminate the fs_info local variable, since it's used only once, so directly reference it from the transaction handle. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index daf32dc94dc3..7f6aaeb4bd22 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4064,11 +4064,9 @@ static int extent_cmp(void *priv, struct list_head *a, struct list_head *b)
4064 4064
4065static int log_extent_csums(struct btrfs_trans_handle *trans, 4065static int log_extent_csums(struct btrfs_trans_handle *trans,
4066 struct btrfs_inode *inode, 4066 struct btrfs_inode *inode,
4067 struct btrfs_root *root, 4067 struct btrfs_root *log_root,
4068 const struct extent_map *em) 4068 const struct extent_map *em)
4069{ 4069{
4070 struct btrfs_fs_info *fs_info = root->fs_info;
4071 struct btrfs_root *log = root->log_root;
4072 u64 csum_offset; 4070 u64 csum_offset;
4073 u64 csum_len; 4071 u64 csum_len;
4074 LIST_HEAD(ordered_sums); 4072 LIST_HEAD(ordered_sums);
@@ -4089,7 +4087,7 @@ static int log_extent_csums(struct btrfs_trans_handle *trans,
4089 } 4087 }
4090 4088
4091 /* block start is already adjusted for the file extent offset. */ 4089 /* block start is already adjusted for the file extent offset. */
4092 ret = btrfs_lookup_csums_range(fs_info->csum_root, 4090 ret = btrfs_lookup_csums_range(trans->fs_info->csum_root,
4093 em->block_start + csum_offset, 4091 em->block_start + csum_offset,
4094 em->block_start + csum_offset + 4092 em->block_start + csum_offset +
4095 csum_len - 1, &ordered_sums, 0); 4093 csum_len - 1, &ordered_sums, 0);
@@ -4101,7 +4099,7 @@ static int log_extent_csums(struct btrfs_trans_handle *trans,
4101 struct btrfs_ordered_sum, 4099 struct btrfs_ordered_sum,
4102 list); 4100 list);
4103 if (!ret) 4101 if (!ret)
4104 ret = btrfs_csum_file_blocks(trans, log, sums); 4102 ret = btrfs_csum_file_blocks(trans, log_root, sums);
4105 list_del(&sums->list); 4103 list_del(&sums->list);
4106 kfree(sums); 4104 kfree(sums);
4107 } 4105 }
@@ -4125,7 +4123,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
4125 int ret; 4123 int ret;
4126 int extent_inserted = 0; 4124 int extent_inserted = 0;
4127 4125
4128 ret = log_extent_csums(trans, inode, root, em); 4126 ret = log_extent_csums(trans, inode, log, em);
4129 if (ret) 4127 if (ret)
4130 return ret; 4128 return ret;
4131 4129