summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.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/ioctl.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/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index fe8b585ea13b..03bd53845360 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -601,7 +601,7 @@ static noinline int create_subvol(struct inode *dir,
601 601
602 ret = btrfs_add_root_ref(trans, fs_info, 602 ret = btrfs_add_root_ref(trans, fs_info,
603 objectid, root->root_key.objectid, 603 objectid, root->root_key.objectid,
604 btrfs_ino(dir), index, name, namelen); 604 btrfs_ino(BTRFS_I(dir)), index, name, namelen);
605 BUG_ON(ret); 605 BUG_ON(ret);
606 606
607 ret = btrfs_uuid_tree_add(trans, fs_info, root_item->uuid, 607 ret = btrfs_uuid_tree_add(trans, fs_info, root_item->uuid,
@@ -941,7 +941,7 @@ static int find_new_extents(struct btrfs_root *root,
941 struct btrfs_file_extent_item *extent; 941 struct btrfs_file_extent_item *extent;
942 int type; 942 int type;
943 int ret; 943 int ret;
944 u64 ino = btrfs_ino(inode); 944 u64 ino = btrfs_ino(BTRFS_I(inode));
945 945
946 path = btrfs_alloc_path(); 946 path = btrfs_alloc_path();
947 if (!path) 947 if (!path)
@@ -1780,7 +1780,7 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
1780 int ret = 0; 1780 int ret = 0;
1781 u64 flags = 0; 1781 u64 flags = 0;
1782 1782
1783 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) 1783 if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FIRST_FREE_OBJECTID)
1784 return -EINVAL; 1784 return -EINVAL;
1785 1785
1786 down_read(&fs_info->subvol_sem); 1786 down_read(&fs_info->subvol_sem);
@@ -1812,7 +1812,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
1812 if (ret) 1812 if (ret)
1813 goto out; 1813 goto out;
1814 1814
1815 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) { 1815 if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FIRST_FREE_OBJECTID) {
1816 ret = -EINVAL; 1816 ret = -EINVAL;
1817 goto out_drop_write; 1817 goto out_drop_write;
1818 } 1818 }
@@ -2446,7 +2446,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2446 if (err) 2446 if (err)
2447 goto out_dput; 2447 goto out_dput;
2448 2448
2449 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) { 2449 if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FIRST_FREE_OBJECTID) {
2450 err = -EINVAL; 2450 err = -EINVAL;
2451 goto out_dput; 2451 goto out_dput;
2452 } 2452 }
@@ -3417,7 +3417,7 @@ static int clone_copy_inline_extent(struct inode *src,
3417 if (new_key->offset > 0) 3417 if (new_key->offset > 0)
3418 return -EOPNOTSUPP; 3418 return -EOPNOTSUPP;
3419 3419
3420 key.objectid = btrfs_ino(dst); 3420 key.objectid = btrfs_ino(BTRFS_I(dst));
3421 key.type = BTRFS_EXTENT_DATA_KEY; 3421 key.type = BTRFS_EXTENT_DATA_KEY;
3422 key.offset = 0; 3422 key.offset = 0;
3423 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 3423 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
@@ -3432,7 +3432,7 @@ static int clone_copy_inline_extent(struct inode *src,
3432 goto copy_inline_extent; 3432 goto copy_inline_extent;
3433 } 3433 }
3434 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); 3434 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
3435 if (key.objectid == btrfs_ino(dst) && 3435 if (key.objectid == btrfs_ino(BTRFS_I(dst)) &&
3436 key.type == BTRFS_EXTENT_DATA_KEY) { 3436 key.type == BTRFS_EXTENT_DATA_KEY) {
3437 ASSERT(key.offset > 0); 3437 ASSERT(key.offset > 0);
3438 return -EOPNOTSUPP; 3438 return -EOPNOTSUPP;
@@ -3466,7 +3466,7 @@ static int clone_copy_inline_extent(struct inode *src,
3466 } else if (ret == 0) { 3466 } else if (ret == 0) {
3467 btrfs_item_key_to_cpu(path->nodes[0], &key, 3467 btrfs_item_key_to_cpu(path->nodes[0], &key,
3468 path->slots[0]); 3468 path->slots[0]);
3469 if (key.objectid == btrfs_ino(dst) && 3469 if (key.objectid == btrfs_ino(BTRFS_I(dst)) &&
3470 key.type == BTRFS_EXTENT_DATA_KEY) 3470 key.type == BTRFS_EXTENT_DATA_KEY)
3471 return -EOPNOTSUPP; 3471 return -EOPNOTSUPP;
3472 } 3472 }
@@ -3560,7 +3560,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
3560 3560
3561 path->reada = READA_FORWARD; 3561 path->reada = READA_FORWARD;
3562 /* clone data */ 3562 /* clone data */
3563 key.objectid = btrfs_ino(src); 3563 key.objectid = btrfs_ino(BTRFS_I(src));
3564 key.type = BTRFS_EXTENT_DATA_KEY; 3564 key.type = BTRFS_EXTENT_DATA_KEY;
3565 key.offset = off; 3565 key.offset = off;
3566 3566
@@ -3603,7 +3603,7 @@ process_slot:
3603 3603
3604 btrfs_item_key_to_cpu(leaf, &key, slot); 3604 btrfs_item_key_to_cpu(leaf, &key, slot);
3605 if (key.type > BTRFS_EXTENT_DATA_KEY || 3605 if (key.type > BTRFS_EXTENT_DATA_KEY ||
3606 key.objectid != btrfs_ino(src)) 3606 key.objectid != btrfs_ino(BTRFS_I(src)))
3607 break; 3607 break;
3608 3608
3609 if (key.type == BTRFS_EXTENT_DATA_KEY) { 3609 if (key.type == BTRFS_EXTENT_DATA_KEY) {
@@ -3656,7 +3656,7 @@ process_slot:
3656 path->leave_spinning = 0; 3656 path->leave_spinning = 0;
3657 3657
3658 memcpy(&new_key, &key, sizeof(new_key)); 3658 memcpy(&new_key, &key, sizeof(new_key));
3659 new_key.objectid = btrfs_ino(inode); 3659 new_key.objectid = btrfs_ino(BTRFS_I(inode));
3660 if (off <= key.offset) 3660 if (off <= key.offset)
3661 new_key.offset = key.offset + destoff - off; 3661 new_key.offset = key.offset + destoff - off;
3662 else 3662 else
@@ -3746,7 +3746,7 @@ process_slot:
3746 fs_info, 3746 fs_info,
3747 disko, diskl, 0, 3747 disko, diskl, 0,
3748 root->root_key.objectid, 3748 root->root_key.objectid,
3749 btrfs_ino(inode), 3749 btrfs_ino(BTRFS_I(inode)),
3750 new_key.offset - datao); 3750 new_key.offset - datao);
3751 if (ret) { 3751 if (ret) {
3752 btrfs_abort_transaction(trans, 3752 btrfs_abort_transaction(trans,
@@ -5126,7 +5126,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
5126 5126
5127 down_write(&fs_info->subvol_sem); 5127 down_write(&fs_info->subvol_sem);
5128 5128
5129 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) { 5129 if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FIRST_FREE_OBJECTID) {
5130 ret = -EINVAL; 5130 ret = -EINVAL;
5131 goto out; 5131 goto out;
5132 } 5132 }