diff options
author | Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> | 2018-08-06 01:25:24 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-10-15 11:23:25 -0400 |
commit | 4fd786e6c3d67b1348e0ad4f450efe9fc9d7a306 (patch) | |
tree | e6d69dcd0ca8a988c3104cfdec3e1e2e3d0bc6a5 | |
parent | 5a2cb25ab9da5046f10e773c9ecfdb3339f3dd7c (diff) |
btrfs: Remove 'objectid' member from struct btrfs_root
There are two members in struct btrfs_root which indicate root's
objectid: objectid and root_key.objectid.
They are both set to the same value in __setup_root():
static void __setup_root(struct btrfs_root *root,
struct btrfs_fs_info *fs_info,
u64 objectid)
{
...
root->objectid = objectid;
...
root->root_key.objectid = objecitd;
...
}
and not changed to other value after initialization.
grep in btrfs directory shows both are used in many places:
$ grep -rI "root->root_key.objectid" | wc -l
133
$ grep -rI "root->objectid" | wc -l
55
(4.17, inc. some noise)
It is confusing to have two similar variable names and it seems
that there is no rule about which should be used in a certain case.
Since ->root_key itself is needed for tree reloc tree, let's remove
'objecitd' member and unify code to use ->root_key.objectid in all places.
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/backref.c | 5 | ||||
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 8 | ||||
-rw-r--r-- | fs/btrfs/ctree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/delayed-inode.c | 5 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 5 | ||||
-rw-r--r-- | fs/btrfs/export.c | 4 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/qgroup.c | 23 | ||||
-rw-r--r-- | fs/btrfs/ref-verify.c | 8 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 3 | ||||
-rw-r--r-- | fs/btrfs/send.c | 16 | ||||
-rw-r--r-- | fs/btrfs/super.c | 6 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 4 | ||||
-rw-r--r-- | include/trace/events/btrfs.h | 15 |
17 files changed, 58 insertions, 53 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index ae750b1574a2..84006e3dd105 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -1468,7 +1468,7 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr) | |||
1468 | struct seq_list elem = SEQ_LIST_INIT(elem); | 1468 | struct seq_list elem = SEQ_LIST_INIT(elem); |
1469 | int ret = 0; | 1469 | int ret = 0; |
1470 | struct share_check shared = { | 1470 | struct share_check shared = { |
1471 | .root_objectid = root->objectid, | 1471 | .root_objectid = root->root_key.objectid, |
1472 | .inum = inum, | 1472 | .inum = inum, |
1473 | .share_count = 0, | 1473 | .share_count = 0, |
1474 | }; | 1474 | }; |
@@ -2031,7 +2031,8 @@ static int iterate_inode_refs(u64 inum, struct btrfs_root *fs_root, | |||
2031 | /* path must be released before calling iterate()! */ | 2031 | /* path must be released before calling iterate()! */ |
2032 | btrfs_debug(fs_root->fs_info, | 2032 | btrfs_debug(fs_root->fs_info, |
2033 | "following ref at offset %u for inode %llu in tree %llu", | 2033 | "following ref at offset %u for inode %llu in tree %llu", |
2034 | cur, found_key.objectid, fs_root->objectid); | 2034 | cur, found_key.objectid, |
2035 | fs_root->root_key.objectid); | ||
2035 | ret = iterate(parent, name_len, | 2036 | ret = iterate(parent, name_len, |
2036 | (unsigned long)(iref + 1), eb, ctx); | 2037 | (unsigned long)(iref + 1), eb, ctx); |
2037 | if (ret) | 2038 | if (ret) |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 1343ac57b438..97d91e55b70a 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -206,7 +206,7 @@ static inline struct btrfs_inode *BTRFS_I(const struct inode *inode) | |||
206 | static inline unsigned long btrfs_inode_hash(u64 objectid, | 206 | static inline unsigned long btrfs_inode_hash(u64 objectid, |
207 | const struct btrfs_root *root) | 207 | const struct btrfs_root *root) |
208 | { | 208 | { |
209 | u64 h = objectid ^ (root->objectid * GOLDEN_RATIO_PRIME); | 209 | u64 h = objectid ^ (root->root_key.objectid * GOLDEN_RATIO_PRIME); |
210 | 210 | ||
211 | #if BITS_PER_LONG == 32 | 211 | #if BITS_PER_LONG == 32 |
212 | h = (h >> 32) ^ (h & 0xffffffff); | 212 | h = (h >> 32) ^ (h & 0xffffffff); |
@@ -339,15 +339,15 @@ static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, | |||
339 | struct btrfs_root *root = inode->root; | 339 | struct btrfs_root *root = inode->root; |
340 | 340 | ||
341 | /* Output minus objectid, which is more meaningful */ | 341 | /* Output minus objectid, which is more meaningful */ |
342 | if (root->objectid >= BTRFS_LAST_FREE_OBJECTID) | 342 | if (root->root_key.objectid >= BTRFS_LAST_FREE_OBJECTID) |
343 | btrfs_warn_rl(root->fs_info, | 343 | btrfs_warn_rl(root->fs_info, |
344 | "csum failed root %lld ino %lld off %llu csum 0x%08x expected csum 0x%08x mirror %d", | 344 | "csum failed root %lld ino %lld off %llu csum 0x%08x expected csum 0x%08x mirror %d", |
345 | root->objectid, btrfs_ino(inode), | 345 | root->root_key.objectid, btrfs_ino(inode), |
346 | logical_start, csum, csum_expected, mirror_num); | 346 | logical_start, csum, csum_expected, mirror_num); |
347 | else | 347 | else |
348 | btrfs_warn_rl(root->fs_info, | 348 | btrfs_warn_rl(root->fs_info, |
349 | "csum failed root %llu ino %llu off %llu csum 0x%08x expected csum 0x%08x mirror %d", | 349 | "csum failed root %llu ino %llu off %llu csum 0x%08x expected csum 0x%08x mirror %d", |
350 | root->objectid, btrfs_ino(inode), | 350 | root->root_key.objectid, btrfs_ino(inode), |
351 | logical_start, csum, csum_expected, mirror_num); | 351 | logical_start, csum, csum_expected, mirror_num); |
352 | } | 352 | } |
353 | 353 | ||
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index d436fb4c002e..1f71695cb0a8 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -207,7 +207,7 @@ static void add_root_to_dirty_list(struct btrfs_root *root) | |||
207 | spin_lock(&fs_info->trans_lock); | 207 | spin_lock(&fs_info->trans_lock); |
208 | if (!test_and_set_bit(BTRFS_ROOT_DIRTY, &root->state)) { | 208 | if (!test_and_set_bit(BTRFS_ROOT_DIRTY, &root->state)) { |
209 | /* Want the extent tree to be the last on the list */ | 209 | /* Want the extent tree to be the last on the list */ |
210 | if (root->objectid == BTRFS_EXTENT_TREE_OBJECTID) | 210 | if (root->root_key.objectid == BTRFS_EXTENT_TREE_OBJECTID) |
211 | list_move_tail(&root->dirty_list, | 211 | list_move_tail(&root->dirty_list, |
212 | &fs_info->dirty_cowonly_roots); | 212 | &fs_info->dirty_cowonly_roots); |
213 | else | 213 | else |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index df260a9867be..923ac6cb9784 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1202,7 +1202,6 @@ struct btrfs_root { | |||
1202 | int last_log_commit; | 1202 | int last_log_commit; |
1203 | pid_t log_start_pid; | 1203 | pid_t log_start_pid; |
1204 | 1204 | ||
1205 | u64 objectid; | ||
1206 | u64 last_trans; | 1205 | u64 last_trans; |
1207 | 1206 | ||
1208 | u32 type; | 1207 | u32 type; |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 584cb103955e..47ce74cf134a 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
@@ -1462,7 +1462,7 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, | |||
1462 | if (unlikely(ret)) { | 1462 | if (unlikely(ret)) { |
1463 | btrfs_err(trans->fs_info, | 1463 | btrfs_err(trans->fs_info, |
1464 | "err add delayed dir index item(name: %.*s) into the insertion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)", | 1464 | "err add delayed dir index item(name: %.*s) into the insertion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)", |
1465 | name_len, name, delayed_node->root->objectid, | 1465 | name_len, name, delayed_node->root->root_key.objectid, |
1466 | delayed_node->inode_id, ret); | 1466 | delayed_node->inode_id, ret); |
1467 | BUG(); | 1467 | BUG(); |
1468 | } | 1468 | } |
@@ -1533,7 +1533,8 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans, | |||
1533 | if (unlikely(ret)) { | 1533 | if (unlikely(ret)) { |
1534 | btrfs_err(trans->fs_info, | 1534 | btrfs_err(trans->fs_info, |
1535 | "err add delayed dir index item(index: %llu) into the deletion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)", | 1535 | "err add delayed dir index item(index: %llu) into the deletion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)", |
1536 | index, node->root->objectid, node->inode_id, ret); | 1536 | index, node->root->root_key.objectid, |
1537 | node->inode_id, ret); | ||
1537 | BUG(); | 1538 | BUG(); |
1538 | } | 1539 | } |
1539 | mutex_unlock(&node->mutex); | 1540 | mutex_unlock(&node->mutex); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 05dc3c17cb62..3611df2ce5c1 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -125,8 +125,8 @@ struct async_submit_bio { | |||
125 | * Different roots are used for different purposes and may nest inside each | 125 | * Different roots are used for different purposes and may nest inside each |
126 | * other and they require separate keysets. As lockdep keys should be | 126 | * other and they require separate keysets. As lockdep keys should be |
127 | * static, assign keysets according to the purpose of the root as indicated | 127 | * static, assign keysets according to the purpose of the root as indicated |
128 | * by btrfs_root->objectid. This ensures that all special purpose roots | 128 | * by btrfs_root->root_key.objectid. This ensures that all special purpose |
129 | * have separate keysets. | 129 | * roots have separate keysets. |
130 | * | 130 | * |
131 | * Lock-nesting across peer nodes is always done with the immediate parent | 131 | * Lock-nesting across peer nodes is always done with the immediate parent |
132 | * node locked thus preventing deadlock. As lockdep doesn't know this, use | 132 | * node locked thus preventing deadlock. As lockdep doesn't know this, use |
@@ -1148,7 +1148,6 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, | |||
1148 | root->state = 0; | 1148 | root->state = 0; |
1149 | root->orphan_cleanup_state = 0; | 1149 | root->orphan_cleanup_state = 0; |
1150 | 1150 | ||
1151 | root->objectid = objectid; | ||
1152 | root->last_trans = 0; | 1151 | root->last_trans = 0; |
1153 | root->highest_objectid = 0; | 1152 | root->highest_objectid = 0; |
1154 | root->nr_delalloc_inodes = 0; | 1153 | root->nr_delalloc_inodes = 0; |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 1f3755b3a37a..ddf28ecf17f9 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -33,7 +33,7 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len, | |||
33 | type = FILEID_BTRFS_WITHOUT_PARENT; | 33 | type = FILEID_BTRFS_WITHOUT_PARENT; |
34 | 34 | ||
35 | fid->objectid = btrfs_ino(BTRFS_I(inode)); | 35 | fid->objectid = btrfs_ino(BTRFS_I(inode)); |
36 | fid->root_objectid = BTRFS_I(inode)->root->objectid; | 36 | fid->root_objectid = BTRFS_I(inode)->root->root_key.objectid; |
37 | fid->gen = inode->i_generation; | 37 | fid->gen = inode->i_generation; |
38 | 38 | ||
39 | if (parent) { | 39 | if (parent) { |
@@ -41,7 +41,7 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len, | |||
41 | 41 | ||
42 | fid->parent_objectid = BTRFS_I(parent)->location.objectid; | 42 | fid->parent_objectid = BTRFS_I(parent)->location.objectid; |
43 | fid->parent_gen = parent->i_generation; | 43 | fid->parent_gen = parent->i_generation; |
44 | parent_root_id = BTRFS_I(parent)->root->objectid; | 44 | parent_root_id = BTRFS_I(parent)->root->root_key.objectid; |
45 | 45 | ||
46 | if (parent_root_id != fid->root_objectid) { | 46 | if (parent_root_id != fid->root_objectid) { |
47 | fid->parent_root_objectid = parent_root_id; | 47 | fid->parent_root_objectid = parent_root_id; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8e4a8581e151..241d54e30294 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -8873,7 +8873,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
8873 | int level; | 8873 | int level; |
8874 | bool root_dropped = false; | 8874 | bool root_dropped = false; |
8875 | 8875 | ||
8876 | btrfs_debug(fs_info, "Drop subvolume %llu", root->objectid); | 8876 | btrfs_debug(fs_info, "Drop subvolume %llu", root->root_key.objectid); |
8877 | 8877 | ||
8878 | path = btrfs_alloc_path(); | 8878 | path = btrfs_alloc_path(); |
8879 | if (!path) { | 8879 | if (!path) { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a147e10b12ae..2a8d4d36335e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -6582,7 +6582,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
6582 | int drop_inode = 0; | 6582 | int drop_inode = 0; |
6583 | 6583 | ||
6584 | /* do not allow sys_link's with other subvols of the same device */ | 6584 | /* do not allow sys_link's with other subvols of the same device */ |
6585 | if (root->objectid != BTRFS_I(inode)->root->objectid) | 6585 | if (root->root_key.objectid != BTRFS_I(inode)->root->root_key.objectid) |
6586 | return -EXDEV; | 6586 | return -EXDEV; |
6587 | 6587 | ||
6588 | if (inode->i_nlink >= BTRFS_LINK_MAX) | 6588 | if (inode->i_nlink >= BTRFS_LINK_MAX) |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 1cf4decaee0d..ef8da14391d2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -4392,7 +4392,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) | |||
4392 | ret = PTR_ERR(new_root); | 4392 | ret = PTR_ERR(new_root); |
4393 | goto out; | 4393 | goto out; |
4394 | } | 4394 | } |
4395 | if (!is_fstree(new_root->objectid)) { | 4395 | if (!is_fstree(new_root->root_key.objectid)) { |
4396 | ret = -ENOENT; | 4396 | ret = -ENOENT; |
4397 | goto out; | 4397 | goto out; |
4398 | } | 4398 | } |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index d4917c0cddf5..fef30bc1e7b7 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -3004,7 +3004,7 @@ int btrfs_qgroup_reserve_data(struct inode *inode, | |||
3004 | int ret; | 3004 | int ret; |
3005 | 3005 | ||
3006 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) || | 3006 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) || |
3007 | !is_fstree(root->objectid) || len == 0) | 3007 | !is_fstree(root->root_key.objectid) || len == 0) |
3008 | return 0; | 3008 | return 0; |
3009 | 3009 | ||
3010 | /* @reserved parameter is mandatory for qgroup */ | 3010 | /* @reserved parameter is mandatory for qgroup */ |
@@ -3090,7 +3090,7 @@ static int qgroup_free_reserved_data(struct inode *inode, | |||
3090 | goto out; | 3090 | goto out; |
3091 | freed += changeset.bytes_changed; | 3091 | freed += changeset.bytes_changed; |
3092 | } | 3092 | } |
3093 | btrfs_qgroup_free_refroot(root->fs_info, root->objectid, freed, | 3093 | btrfs_qgroup_free_refroot(root->fs_info, root->root_key.objectid, freed, |
3094 | BTRFS_QGROUP_RSV_DATA); | 3094 | BTRFS_QGROUP_RSV_DATA); |
3095 | ret = freed; | 3095 | ret = freed; |
3096 | out: | 3096 | out: |
@@ -3122,7 +3122,7 @@ static int __btrfs_qgroup_release_data(struct inode *inode, | |||
3122 | changeset.bytes_changed, trace_op); | 3122 | changeset.bytes_changed, trace_op); |
3123 | if (free) | 3123 | if (free) |
3124 | btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, | 3124 | btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, |
3125 | BTRFS_I(inode)->root->objectid, | 3125 | BTRFS_I(inode)->root->root_key.objectid, |
3126 | changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA); | 3126 | changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA); |
3127 | ret = changeset.bytes_changed; | 3127 | ret = changeset.bytes_changed; |
3128 | out: | 3128 | out: |
@@ -3215,7 +3215,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, | |||
3215 | int ret; | 3215 | int ret; |
3216 | 3216 | ||
3217 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || | 3217 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || |
3218 | !is_fstree(root->objectid) || num_bytes == 0) | 3218 | !is_fstree(root->root_key.objectid) || num_bytes == 0) |
3219 | return 0; | 3219 | return 0; |
3220 | 3220 | ||
3221 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); | 3221 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); |
@@ -3240,13 +3240,13 @@ void btrfs_qgroup_free_meta_all_pertrans(struct btrfs_root *root) | |||
3240 | struct btrfs_fs_info *fs_info = root->fs_info; | 3240 | struct btrfs_fs_info *fs_info = root->fs_info; |
3241 | 3241 | ||
3242 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || | 3242 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || |
3243 | !is_fstree(root->objectid)) | 3243 | !is_fstree(root->root_key.objectid)) |
3244 | return; | 3244 | return; |
3245 | 3245 | ||
3246 | /* TODO: Update trace point to handle such free */ | 3246 | /* TODO: Update trace point to handle such free */ |
3247 | trace_qgroup_meta_free_all_pertrans(root); | 3247 | trace_qgroup_meta_free_all_pertrans(root); |
3248 | /* Special value -1 means to free all reserved space */ | 3248 | /* Special value -1 means to free all reserved space */ |
3249 | btrfs_qgroup_free_refroot(fs_info, root->objectid, (u64)-1, | 3249 | btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid, (u64)-1, |
3250 | BTRFS_QGROUP_RSV_META_PERTRANS); | 3250 | BTRFS_QGROUP_RSV_META_PERTRANS); |
3251 | } | 3251 | } |
3252 | 3252 | ||
@@ -3256,7 +3256,7 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes, | |||
3256 | struct btrfs_fs_info *fs_info = root->fs_info; | 3256 | struct btrfs_fs_info *fs_info = root->fs_info; |
3257 | 3257 | ||
3258 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || | 3258 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || |
3259 | !is_fstree(root->objectid)) | 3259 | !is_fstree(root->root_key.objectid)) |
3260 | return; | 3260 | return; |
3261 | 3261 | ||
3262 | /* | 3262 | /* |
@@ -3267,7 +3267,8 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes, | |||
3267 | num_bytes = sub_root_meta_rsv(root, num_bytes, type); | 3267 | num_bytes = sub_root_meta_rsv(root, num_bytes, type); |
3268 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); | 3268 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); |
3269 | trace_qgroup_meta_reserve(root, type, -(s64)num_bytes); | 3269 | trace_qgroup_meta_reserve(root, type, -(s64)num_bytes); |
3270 | btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes, type); | 3270 | btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid, |
3271 | num_bytes, type); | ||
3271 | } | 3272 | } |
3272 | 3273 | ||
3273 | static void qgroup_convert_meta(struct btrfs_fs_info *fs_info, u64 ref_root, | 3274 | static void qgroup_convert_meta(struct btrfs_fs_info *fs_info, u64 ref_root, |
@@ -3321,13 +3322,13 @@ void btrfs_qgroup_convert_reserved_meta(struct btrfs_root *root, int num_bytes) | |||
3321 | struct btrfs_fs_info *fs_info = root->fs_info; | 3322 | struct btrfs_fs_info *fs_info = root->fs_info; |
3322 | 3323 | ||
3323 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || | 3324 | if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || |
3324 | !is_fstree(root->objectid)) | 3325 | !is_fstree(root->root_key.objectid)) |
3325 | return; | 3326 | return; |
3326 | /* Same as btrfs_qgroup_free_meta_prealloc() */ | 3327 | /* Same as btrfs_qgroup_free_meta_prealloc() */ |
3327 | num_bytes = sub_root_meta_rsv(root, num_bytes, | 3328 | num_bytes = sub_root_meta_rsv(root, num_bytes, |
3328 | BTRFS_QGROUP_RSV_META_PREALLOC); | 3329 | BTRFS_QGROUP_RSV_META_PREALLOC); |
3329 | trace_qgroup_meta_convert(root, num_bytes); | 3330 | trace_qgroup_meta_convert(root, num_bytes); |
3330 | qgroup_convert_meta(fs_info, root->objectid, num_bytes); | 3331 | qgroup_convert_meta(fs_info, root->root_key.objectid, num_bytes); |
3331 | } | 3332 | } |
3332 | 3333 | ||
3333 | /* | 3334 | /* |
@@ -3354,7 +3355,7 @@ void btrfs_qgroup_check_reserved_leak(struct inode *inode) | |||
3354 | inode->i_ino, unode->val, unode->aux); | 3355 | inode->i_ino, unode->val, unode->aux); |
3355 | } | 3356 | } |
3356 | btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, | 3357 | btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, |
3357 | BTRFS_I(inode)->root->objectid, | 3358 | BTRFS_I(inode)->root->root_key.objectid, |
3358 | changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA); | 3359 | changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA); |
3359 | 3360 | ||
3360 | } | 3361 | } |
diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index e5b9e596bb92..d69fbfb30aa9 100644 --- a/fs/btrfs/ref-verify.c +++ b/fs/btrfs/ref-verify.c | |||
@@ -732,7 +732,7 @@ int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr, u64 num_bytes, | |||
732 | 732 | ||
733 | INIT_LIST_HEAD(&ra->list); | 733 | INIT_LIST_HEAD(&ra->list); |
734 | ra->action = action; | 734 | ra->action = action; |
735 | ra->root = root->objectid; | 735 | ra->root = root->root_key.objectid; |
736 | 736 | ||
737 | /* | 737 | /* |
738 | * This is an allocation, preallocate the block_entry in case we haven't | 738 | * This is an allocation, preallocate the block_entry in case we haven't |
@@ -787,8 +787,8 @@ int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr, u64 num_bytes, | |||
787 | * one we want to lookup below when we modify the | 787 | * one we want to lookup below when we modify the |
788 | * re->num_refs. | 788 | * re->num_refs. |
789 | */ | 789 | */ |
790 | ref_root = root->objectid; | 790 | ref_root = root->root_key.objectid; |
791 | re->root_objectid = root->objectid; | 791 | re->root_objectid = root->root_key.objectid; |
792 | re->num_refs = 0; | 792 | re->num_refs = 0; |
793 | } | 793 | } |
794 | 794 | ||
@@ -862,7 +862,7 @@ int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr, u64 num_bytes, | |||
862 | * didn't thik of some other corner case. | 862 | * didn't thik of some other corner case. |
863 | */ | 863 | */ |
864 | btrfs_err(fs_info, "failed to find root %llu for %llu", | 864 | btrfs_err(fs_info, "failed to find root %llu for %llu", |
865 | root->objectid, be->bytenr); | 865 | root->root_key.objectid, be->bytenr); |
866 | dump_block_entry(fs_info, be); | 866 | dump_block_entry(fs_info, be); |
867 | dump_ref_action(fs_info, ra); | 867 | dump_ref_action(fs_info, ra); |
868 | kfree(ra); | 868 | kfree(ra); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 995a28a724ce..c384b8133407 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -884,7 +884,8 @@ again: | |||
884 | cur->bytenr) { | 884 | cur->bytenr) { |
885 | btrfs_err(root->fs_info, | 885 | btrfs_err(root->fs_info, |
886 | "couldn't find block (%llu) (level %d) in tree (%llu) with key (%llu %u %llu)", | 886 | "couldn't find block (%llu) (level %d) in tree (%llu) with key (%llu %u %llu)", |
887 | cur->bytenr, level - 1, root->objectid, | 887 | cur->bytenr, level - 1, |
888 | root->root_key.objectid, | ||
888 | node_key->objectid, node_key->type, | 889 | node_key->objectid, node_key->type, |
889 | node_key->offset); | 890 | node_key->offset); |
890 | err = -ENOENT; | 891 | err = -ENOENT; |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index ba8950bfd9c7..bd5756504709 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -1186,9 +1186,9 @@ static int __clone_root_cmp_bsearch(const void *key, const void *elt) | |||
1186 | u64 root = (u64)(uintptr_t)key; | 1186 | u64 root = (u64)(uintptr_t)key; |
1187 | struct clone_root *cr = (struct clone_root *)elt; | 1187 | struct clone_root *cr = (struct clone_root *)elt; |
1188 | 1188 | ||
1189 | if (root < cr->root->objectid) | 1189 | if (root < cr->root->root_key.objectid) |
1190 | return -1; | 1190 | return -1; |
1191 | if (root > cr->root->objectid) | 1191 | if (root > cr->root->root_key.objectid) |
1192 | return 1; | 1192 | return 1; |
1193 | return 0; | 1193 | return 0; |
1194 | } | 1194 | } |
@@ -1198,9 +1198,9 @@ static int __clone_root_cmp_sort(const void *e1, const void *e2) | |||
1198 | struct clone_root *cr1 = (struct clone_root *)e1; | 1198 | struct clone_root *cr1 = (struct clone_root *)e1; |
1199 | struct clone_root *cr2 = (struct clone_root *)e2; | 1199 | struct clone_root *cr2 = (struct clone_root *)e2; |
1200 | 1200 | ||
1201 | if (cr1->root->objectid < cr2->root->objectid) | 1201 | if (cr1->root->root_key.objectid < cr2->root->root_key.objectid) |
1202 | return -1; | 1202 | return -1; |
1203 | if (cr1->root->objectid > cr2->root->objectid) | 1203 | if (cr1->root->root_key.objectid > cr2->root->root_key.objectid) |
1204 | return 1; | 1204 | return 1; |
1205 | return 0; | 1205 | return 0; |
1206 | } | 1206 | } |
@@ -2346,7 +2346,7 @@ static int send_subvol_begin(struct send_ctx *sctx) | |||
2346 | return -ENOMEM; | 2346 | return -ENOMEM; |
2347 | } | 2347 | } |
2348 | 2348 | ||
2349 | key.objectid = send_root->objectid; | 2349 | key.objectid = send_root->root_key.objectid; |
2350 | key.type = BTRFS_ROOT_BACKREF_KEY; | 2350 | key.type = BTRFS_ROOT_BACKREF_KEY; |
2351 | key.offset = 0; | 2351 | key.offset = 0; |
2352 | 2352 | ||
@@ -2362,7 +2362,7 @@ static int send_subvol_begin(struct send_ctx *sctx) | |||
2362 | leaf = path->nodes[0]; | 2362 | leaf = path->nodes[0]; |
2363 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); | 2363 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); |
2364 | if (key.type != BTRFS_ROOT_BACKREF_KEY || | 2364 | if (key.type != BTRFS_ROOT_BACKREF_KEY || |
2365 | key.objectid != send_root->objectid) { | 2365 | key.objectid != send_root->root_key.objectid) { |
2366 | ret = -ENOENT; | 2366 | ret = -ENOENT; |
2367 | goto out; | 2367 | goto out; |
2368 | } | 2368 | } |
@@ -4907,8 +4907,8 @@ static int send_clone(struct send_ctx *sctx, | |||
4907 | 4907 | ||
4908 | btrfs_debug(sctx->send_root->fs_info, | 4908 | btrfs_debug(sctx->send_root->fs_info, |
4909 | "send_clone offset=%llu, len=%d, clone_root=%llu, clone_inode=%llu, clone_offset=%llu", | 4909 | "send_clone offset=%llu, len=%d, clone_root=%llu, clone_inode=%llu, clone_offset=%llu", |
4910 | offset, len, clone_root->root->objectid, clone_root->ino, | 4910 | offset, len, clone_root->root->root_key.objectid, |
4911 | clone_root->offset); | 4911 | clone_root->ino, clone_root->offset); |
4912 | 4912 | ||
4913 | p = fs_path_alloc(); | 4913 | p = fs_path_alloc(); |
4914 | if (!p) | 4914 | if (!p) |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 6601c9aa5e35..b362b45dd757 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -2177,8 +2177,10 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
2177 | buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]); | 2177 | buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]); |
2178 | buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]); | 2178 | buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]); |
2179 | /* Mask in the root object ID too, to disambiguate subvols */ | 2179 | /* Mask in the root object ID too, to disambiguate subvols */ |
2180 | buf->f_fsid.val[0] ^= BTRFS_I(d_inode(dentry))->root->objectid >> 32; | 2180 | buf->f_fsid.val[0] ^= |
2181 | buf->f_fsid.val[1] ^= BTRFS_I(d_inode(dentry))->root->objectid; | 2181 | BTRFS_I(d_inode(dentry))->root->root_key.objectid >> 32; |
2182 | buf->f_fsid.val[1] ^= | ||
2183 | BTRFS_I(d_inode(dentry))->root->root_key.objectid; | ||
2182 | 2184 | ||
2183 | return 0; | 2185 | return 0; |
2184 | } | 2186 | } |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index bd784d8f5215..e7856e15adbf 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -118,7 +118,7 @@ static noinline void switch_commit_roots(struct btrfs_transaction *trans) | |||
118 | list_del_init(&root->dirty_list); | 118 | list_del_init(&root->dirty_list); |
119 | free_extent_buffer(root->commit_root); | 119 | free_extent_buffer(root->commit_root); |
120 | root->commit_root = btrfs_root_node(root); | 120 | root->commit_root = btrfs_root_node(root); |
121 | if (is_fstree(root->objectid)) | 121 | if (is_fstree(root->root_key.objectid)) |
122 | btrfs_unpin_free_ino(root); | 122 | btrfs_unpin_free_ino(root); |
123 | clear_btree_io_tree(&root->dirty_log_pages); | 123 | clear_btree_io_tree(&root->dirty_log_pages); |
124 | } | 124 | } |
@@ -2329,7 +2329,7 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root) | |||
2329 | list_del_init(&root->root_list); | 2329 | list_del_init(&root->root_list); |
2330 | spin_unlock(&fs_info->trans_lock); | 2330 | spin_unlock(&fs_info->trans_lock); |
2331 | 2331 | ||
2332 | btrfs_debug(fs_info, "cleaner removing %llu", root->objectid); | 2332 | btrfs_debug(fs_info, "cleaner removing %llu", root->root_key.objectid); |
2333 | 2333 | ||
2334 | btrfs_kill_all_delayed_nodes(root); | 2334 | btrfs_kill_all_delayed_nodes(root); |
2335 | 2335 | ||
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index b401c4e36394..abe3ff774f58 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
@@ -316,7 +316,7 @@ DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, | |||
316 | ), | 316 | ), |
317 | 317 | ||
318 | TP_fast_assign_btrfs(bi->root->fs_info, | 318 | TP_fast_assign_btrfs(bi->root->fs_info, |
319 | __entry->root_obj = bi->root->objectid; | 319 | __entry->root_obj = bi->root->root_key.objectid; |
320 | __entry->ino = btrfs_ino(bi); | 320 | __entry->ino = btrfs_ino(bi); |
321 | __entry->isize = bi->vfs_inode.i_size; | 321 | __entry->isize = bi->vfs_inode.i_size; |
322 | __entry->disk_isize = bi->disk_i_size; | 322 | __entry->disk_isize = bi->disk_i_size; |
@@ -367,7 +367,7 @@ DECLARE_EVENT_CLASS( | |||
367 | 367 | ||
368 | TP_fast_assign_btrfs( | 368 | TP_fast_assign_btrfs( |
369 | bi->root->fs_info, | 369 | bi->root->fs_info, |
370 | __entry->root_obj = bi->root->objectid; | 370 | __entry->root_obj = bi->root->root_key.objectid; |
371 | __entry->ino = btrfs_ino(bi); | 371 | __entry->ino = btrfs_ino(bi); |
372 | __entry->isize = bi->vfs_inode.i_size; | 372 | __entry->isize = bi->vfs_inode.i_size; |
373 | __entry->disk_isize = bi->disk_i_size; | 373 | __entry->disk_isize = bi->disk_i_size; |
@@ -1477,7 +1477,8 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, | |||
1477 | ), | 1477 | ), |
1478 | 1478 | ||
1479 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), | 1479 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
1480 | __entry->rootid = BTRFS_I(inode)->root->objectid; | 1480 | __entry->rootid = |
1481 | BTRFS_I(inode)->root->root_key.objectid; | ||
1481 | __entry->ino = btrfs_ino(BTRFS_I(inode)); | 1482 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
1482 | __entry->start = start; | 1483 | __entry->start = start; |
1483 | __entry->len = len; | 1484 | __entry->len = len; |
@@ -1675,7 +1676,7 @@ TRACE_EVENT(qgroup_meta_reserve, | |||
1675 | ), | 1676 | ), |
1676 | 1677 | ||
1677 | TP_fast_assign_btrfs(root->fs_info, | 1678 | TP_fast_assign_btrfs(root->fs_info, |
1678 | __entry->refroot = root->objectid; | 1679 | __entry->refroot = root->root_key.objectid; |
1679 | __entry->diff = diff; | 1680 | __entry->diff = diff; |
1680 | ), | 1681 | ), |
1681 | 1682 | ||
@@ -1697,7 +1698,7 @@ TRACE_EVENT(qgroup_meta_convert, | |||
1697 | ), | 1698 | ), |
1698 | 1699 | ||
1699 | TP_fast_assign_btrfs(root->fs_info, | 1700 | TP_fast_assign_btrfs(root->fs_info, |
1700 | __entry->refroot = root->objectid; | 1701 | __entry->refroot = root->root_key.objectid; |
1701 | __entry->diff = diff; | 1702 | __entry->diff = diff; |
1702 | ), | 1703 | ), |
1703 | 1704 | ||
@@ -1721,7 +1722,7 @@ TRACE_EVENT(qgroup_meta_free_all_pertrans, | |||
1721 | ), | 1722 | ), |
1722 | 1723 | ||
1723 | TP_fast_assign_btrfs(root->fs_info, | 1724 | TP_fast_assign_btrfs(root->fs_info, |
1724 | __entry->refroot = root->objectid; | 1725 | __entry->refroot = root->root_key.objectid; |
1725 | spin_lock(&root->qgroup_meta_rsv_lock); | 1726 | spin_lock(&root->qgroup_meta_rsv_lock); |
1726 | __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; | 1727 | __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; |
1727 | spin_unlock(&root->qgroup_meta_rsv_lock); | 1728 | spin_unlock(&root->qgroup_meta_rsv_lock); |
@@ -1802,7 +1803,7 @@ TRACE_EVENT(btrfs_inode_mod_outstanding_extents, | |||
1802 | ), | 1803 | ), |
1803 | 1804 | ||
1804 | TP_fast_assign_btrfs(root->fs_info, | 1805 | TP_fast_assign_btrfs(root->fs_info, |
1805 | __entry->root_objectid = root->objectid; | 1806 | __entry->root_objectid = root->root_key.objectid; |
1806 | __entry->ino = ino; | 1807 | __entry->ino = ino; |
1807 | __entry->mod = mod; | 1808 | __entry->mod = mod; |
1808 | ), | 1809 | ), |