summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorNikolay Borisov <n.borisov.lkml@gmail.com>2017-01-10 13:35:31 -0500
committerDavid Sterba <dsterba@suse.com>2017-02-14 09:50:51 -0500
commit4a0cc7ca6c40b607b8aaa0bf6e97ffd74d64c2d8 (patch)
tree9ed2b2b2960e4b5dc8bed1f3a35ae9de95dcb12f /fs/btrfs/tree-log.c
parent823bb20ab47071dc8a98acf272a470ccdcfcf6d1 (diff)
btrfs: Make btrfs_ino take a struct btrfs_inode
Currently btrfs_ino takes a struct inode and this causes a lot of internal btrfs functions which consume this ino to take a VFS inode, rather than btrfs' own struct btrfs_inode. In order to fix this "leak" of VFS structs into the internals of btrfs first it's necessary to eliminate all uses of struct inode for the purpose of inode. This patch does that by using BTRFS_I to convert an inode to btrfs_inode. With this problem eliminated subsequent patches will start eliminating the passing of struct inode altogether, eventually resulting in a lot cleaner code. Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> [ fix btrfs_get_extent tracepoint prototype ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index eeffff84f280..a056971cd2c4 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -631,7 +631,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
631 * file. This must be done before the btrfs_drop_extents run 631 * file. This must be done before the btrfs_drop_extents run
632 * so we don't try to drop this extent. 632 * so we don't try to drop this extent.
633 */ 633 */
634 ret = btrfs_lookup_file_extent(trans, root, path, btrfs_ino(inode), 634 ret = btrfs_lookup_file_extent(trans, root, path, btrfs_ino(BTRFS_I(inode)),
635 start, 0); 635 start, 0);
636 636
637 if (ret == 0 && 637 if (ret == 0 &&
@@ -1148,7 +1148,7 @@ next:
1148 btrfs_release_path(path); 1148 btrfs_release_path(path);
1149 1149
1150 /* look for a conflicting sequence number */ 1150 /* look for a conflicting sequence number */
1151 di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), 1151 di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
1152 ref_index, name, namelen, 0); 1152 ref_index, name, namelen, 0);
1153 if (di && !IS_ERR(di)) { 1153 if (di && !IS_ERR(di)) {
1154 ret = drop_one_dir_item(trans, root, path, dir, di); 1154 ret = drop_one_dir_item(trans, root, path, dir, di);
@@ -1158,7 +1158,7 @@ next:
1158 btrfs_release_path(path); 1158 btrfs_release_path(path);
1159 1159
1160 /* look for a conflicing name */ 1160 /* look for a conflicing name */
1161 di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), 1161 di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
1162 name, namelen, 0); 1162 name, namelen, 0);
1163 if (di && !IS_ERR(di)) { 1163 if (di && !IS_ERR(di)) {
1164 ret = drop_one_dir_item(trans, root, path, dir, di); 1164 ret = drop_one_dir_item(trans, root, path, dir, di);
@@ -1295,7 +1295,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
1295 goto out; 1295 goto out;
1296 1296
1297 /* if we already have a perfect match, we're done */ 1297 /* if we already have a perfect match, we're done */
1298 if (!inode_in_dir(root, path, btrfs_ino(dir), btrfs_ino(inode), 1298 if (!inode_in_dir(root, path, btrfs_ino(BTRFS_I(dir)), btrfs_ino(BTRFS_I(inode)),
1299 ref_index, name, namelen)) { 1299 ref_index, name, namelen)) {
1300 /* 1300 /*
1301 * look for a conflicting back reference in the 1301 * look for a conflicting back reference in the
@@ -1367,7 +1367,7 @@ static int count_inode_extrefs(struct btrfs_root *root,
1367 unsigned int nlink = 0; 1367 unsigned int nlink = 0;
1368 u32 item_size; 1368 u32 item_size;
1369 u32 cur_offset = 0; 1369 u32 cur_offset = 0;
1370 u64 inode_objectid = btrfs_ino(inode); 1370 u64 inode_objectid = btrfs_ino(BTRFS_I(inode));
1371 u64 offset = 0; 1371 u64 offset = 0;
1372 unsigned long ptr; 1372 unsigned long ptr;
1373 struct btrfs_inode_extref *extref; 1373 struct btrfs_inode_extref *extref;
@@ -1412,7 +1412,7 @@ static int count_inode_refs(struct btrfs_root *root,
1412 unsigned long ptr; 1412 unsigned long ptr;
1413 unsigned long ptr_end; 1413 unsigned long ptr_end;
1414 int name_len; 1414 int name_len;
1415 u64 ino = btrfs_ino(inode); 1415 u64 ino = btrfs_ino(BTRFS_I(inode));
1416 1416
1417 key.objectid = ino; 1417 key.objectid = ino;
1418 key.type = BTRFS_INODE_REF_KEY; 1418 key.type = BTRFS_INODE_REF_KEY;
@@ -1477,7 +1477,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
1477 struct btrfs_path *path; 1477 struct btrfs_path *path;
1478 int ret; 1478 int ret;
1479 u64 nlink = 0; 1479 u64 nlink = 0;
1480 u64 ino = btrfs_ino(inode); 1480 u64 ino = btrfs_ino(BTRFS_I(inode));
1481 1481
1482 path = btrfs_alloc_path(); 1482 path = btrfs_alloc_path();
1483 if (!path) 1483 if (!path)
@@ -3092,7 +3092,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
3092 int ret; 3092 int ret;
3093 int err = 0; 3093 int err = 0;
3094 int bytes_del = 0; 3094 int bytes_del = 0;
3095 u64 dir_ino = btrfs_ino(dir); 3095 u64 dir_ino = btrfs_ino(BTRFS_I(dir));
3096 3096
3097 if (BTRFS_I(dir)->logged_trans < trans->transid) 3097 if (BTRFS_I(dir)->logged_trans < trans->transid)
3098 return 0; 3098 return 0;
@@ -3208,7 +3208,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
3208 log = root->log_root; 3208 log = root->log_root;
3209 mutex_lock(&BTRFS_I(inode)->log_mutex); 3209 mutex_lock(&BTRFS_I(inode)->log_mutex);
3210 3210
3211 ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(inode), 3211 ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(BTRFS_I(inode)),
3212 dirid, &index); 3212 dirid, &index);
3213 mutex_unlock(&BTRFS_I(inode)->log_mutex); 3213 mutex_unlock(&BTRFS_I(inode)->log_mutex);
3214 if (ret == -ENOSPC) { 3214 if (ret == -ENOSPC) {
@@ -3275,7 +3275,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
3275 int nritems; 3275 int nritems;
3276 u64 first_offset = min_offset; 3276 u64 first_offset = min_offset;
3277 u64 last_offset = (u64)-1; 3277 u64 last_offset = (u64)-1;
3278 u64 ino = btrfs_ino(inode); 3278 u64 ino = btrfs_ino(BTRFS_I(inode));
3279 3279
3280 log = root->log_root; 3280 log = root->log_root;
3281 3281
@@ -3792,7 +3792,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
3792 src_path->slots[0]--; 3792 src_path->slots[0]--;
3793 src = src_path->nodes[0]; 3793 src = src_path->nodes[0];
3794 btrfs_item_key_to_cpu(src, &key, src_path->slots[0]); 3794 btrfs_item_key_to_cpu(src, &key, src_path->slots[0]);
3795 if (key.objectid != btrfs_ino(inode) || 3795 if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
3796 key.type != BTRFS_EXTENT_DATA_KEY) 3796 key.type != BTRFS_EXTENT_DATA_KEY)
3797 goto fill_holes; 3797 goto fill_holes;
3798 extent = btrfs_item_ptr(src, src_path->slots[0], 3798 extent = btrfs_item_ptr(src, src_path->slots[0],
@@ -3857,7 +3857,7 @@ fill_holes:
3857 btrfs_item_key_to_cpu(src, &key, i); 3857 btrfs_item_key_to_cpu(src, &key, i);
3858 if (!btrfs_comp_cpu_keys(&key, &last_key)) 3858 if (!btrfs_comp_cpu_keys(&key, &last_key))
3859 done = true; 3859 done = true;
3860 if (key.objectid != btrfs_ino(inode) || 3860 if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
3861 key.type != BTRFS_EXTENT_DATA_KEY) { 3861 key.type != BTRFS_EXTENT_DATA_KEY) {
3862 i++; 3862 i++;
3863 continue; 3863 continue;
@@ -3880,7 +3880,7 @@ fill_holes:
3880 } 3880 }
3881 offset = *last_extent; 3881 offset = *last_extent;
3882 len = key.offset - *last_extent; 3882 len = key.offset - *last_extent;
3883 ret = btrfs_insert_file_extent(trans, log, btrfs_ino(inode), 3883 ret = btrfs_insert_file_extent(trans, log, btrfs_ino(BTRFS_I(inode)),
3884 offset, 0, 0, len, 0, len, 0, 3884 offset, 0, 0, len, 0, len, 0,
3885 0, 0); 3885 0, 0);
3886 if (ret) 3886 if (ret)
@@ -4091,7 +4091,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
4091 return ret; 4091 return ret;
4092 4092
4093 if (!extent_inserted) { 4093 if (!extent_inserted) {
4094 key.objectid = btrfs_ino(inode); 4094 key.objectid = btrfs_ino(BTRFS_I(inode));
4095 key.type = BTRFS_EXTENT_DATA_KEY; 4095 key.type = BTRFS_EXTENT_DATA_KEY;
4096 key.offset = em->start; 4096 key.offset = em->start;
4097 4097
@@ -4247,7 +4247,7 @@ static int logged_inode_size(struct btrfs_root *log, struct inode *inode,
4247 struct btrfs_key key; 4247 struct btrfs_key key;
4248 int ret; 4248 int ret;
4249 4249
4250 key.objectid = btrfs_ino(inode); 4250 key.objectid = btrfs_ino(BTRFS_I(inode));
4251 key.type = BTRFS_INODE_ITEM_KEY; 4251 key.type = BTRFS_INODE_ITEM_KEY;
4252 key.offset = 0; 4252 key.offset = 0;
4253 4253
@@ -4285,7 +4285,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
4285{ 4285{
4286 int ret; 4286 int ret;
4287 struct btrfs_key key; 4287 struct btrfs_key key;
4288 const u64 ino = btrfs_ino(inode); 4288 const u64 ino = btrfs_ino(BTRFS_I(inode));
4289 int ins_nr = 0; 4289 int ins_nr = 0;
4290 int start_slot = 0; 4290 int start_slot = 0;
4291 4291
@@ -4384,7 +4384,7 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
4384 u64 hole_size; 4384 u64 hole_size;
4385 struct extent_buffer *leaf; 4385 struct extent_buffer *leaf;
4386 struct btrfs_root *log = root->log_root; 4386 struct btrfs_root *log = root->log_root;
4387 const u64 ino = btrfs_ino(inode); 4387 const u64 ino = btrfs_ino(BTRFS_I(inode));
4388 const u64 i_size = i_size_read(inode); 4388 const u64 i_size = i_size_read(inode);
4389 4389
4390 if (!btrfs_fs_incompat(fs_info, NO_HOLES)) 4390 if (!btrfs_fs_incompat(fs_info, NO_HOLES))
@@ -4617,7 +4617,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
4617 int ins_start_slot = 0; 4617 int ins_start_slot = 0;
4618 int ins_nr; 4618 int ins_nr;
4619 bool fast_search = false; 4619 bool fast_search = false;
4620 u64 ino = btrfs_ino(inode); 4620 u64 ino = btrfs_ino(BTRFS_I(inode));
4621 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 4621 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
4622 u64 logged_isize = 0; 4622 u64 logged_isize = 0;
4623 bool need_log_inode_item = true; 4623 bool need_log_inode_item = true;
@@ -4775,7 +4775,7 @@ again:
4775 err = ret; 4775 err = ret;
4776 goto out_unlock; 4776 goto out_unlock;
4777 } else if (ret > 0 && ctx && 4777 } else if (ret > 0 && ctx &&
4778 other_ino != btrfs_ino(ctx->inode)) { 4778 other_ino != btrfs_ino(BTRFS_I(ctx->inode))) {
4779 struct btrfs_key inode_key; 4779 struct btrfs_key inode_key;
4780 struct inode *other_inode; 4780 struct inode *other_inode;
4781 4781
@@ -5178,7 +5178,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
5178 btrfs_free_path(path); 5178 btrfs_free_path(path);
5179 return -ENOMEM; 5179 return -ENOMEM;
5180 } 5180 }
5181 dir_elem->ino = btrfs_ino(start_inode); 5181 dir_elem->ino = btrfs_ino(BTRFS_I(start_inode));
5182 list_add_tail(&dir_elem->list, &dir_list); 5182 list_add_tail(&dir_elem->list, &dir_list);
5183 5183
5184 while (!list_empty(&dir_list)) { 5184 while (!list_empty(&dir_list)) {
@@ -5297,7 +5297,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
5297 struct btrfs_path *path; 5297 struct btrfs_path *path;
5298 struct btrfs_key key; 5298 struct btrfs_key key;
5299 struct btrfs_root *root = BTRFS_I(inode)->root; 5299 struct btrfs_root *root = BTRFS_I(inode)->root;
5300 const u64 ino = btrfs_ino(inode); 5300 const u64 ino = btrfs_ino(BTRFS_I(inode));
5301 5301
5302 path = btrfs_alloc_path(); 5302 path = btrfs_alloc_path();
5303 if (!path) 5303 if (!path)