Commit 0d0ca30f authored by Chris Mason's avatar Chris Mason

Btrfs: update the delayed inode code to use the btrfs_ino helper.

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent dcc6d073
...@@ -88,6 +88,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node( ...@@ -88,6 +88,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
struct btrfs_delayed_node *node; struct btrfs_delayed_node *node;
struct btrfs_inode *btrfs_inode = BTRFS_I(inode); struct btrfs_inode *btrfs_inode = BTRFS_I(inode);
struct btrfs_root *root = btrfs_inode->root; struct btrfs_root *root = btrfs_inode->root;
u64 ino = btrfs_ino(inode);
int ret; int ret;
again: again:
...@@ -98,7 +99,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node( ...@@ -98,7 +99,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
} }
spin_lock(&root->inode_lock); spin_lock(&root->inode_lock);
node = radix_tree_lookup(&root->delayed_nodes_tree, inode->i_ino); node = radix_tree_lookup(&root->delayed_nodes_tree, ino);
if (node) { if (node) {
if (btrfs_inode->delayed_node) { if (btrfs_inode->delayed_node) {
spin_unlock(&root->inode_lock); spin_unlock(&root->inode_lock);
...@@ -115,7 +116,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node( ...@@ -115,7 +116,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
node = kmem_cache_alloc(delayed_node_cache, GFP_NOFS); node = kmem_cache_alloc(delayed_node_cache, GFP_NOFS);
if (!node) if (!node)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
btrfs_init_delayed_node(node, root, inode->i_ino); btrfs_init_delayed_node(node, root, ino);
atomic_inc(&node->refs); /* cached in the btrfs inode */ atomic_inc(&node->refs); /* cached in the btrfs inode */
atomic_inc(&node->refs); /* can be accessed */ atomic_inc(&node->refs); /* can be accessed */
...@@ -127,7 +128,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node( ...@@ -127,7 +128,7 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
} }
spin_lock(&root->inode_lock); spin_lock(&root->inode_lock);
ret = radix_tree_insert(&root->delayed_nodes_tree, inode->i_ino, node); ret = radix_tree_insert(&root->delayed_nodes_tree, ino, node);
if (ret == -EEXIST) { if (ret == -EEXIST) {
kmem_cache_free(delayed_node_cache, node); kmem_cache_free(delayed_node_cache, node);
spin_unlock(&root->inode_lock); spin_unlock(&root->inode_lock);
...@@ -1274,7 +1275,7 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, ...@@ -1274,7 +1275,7 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
*/ */
BUG_ON(ret); BUG_ON(ret);
delayed_item->key.objectid = dir->i_ino; delayed_item->key.objectid = btrfs_ino(dir);
btrfs_set_key_type(&delayed_item->key, BTRFS_DIR_INDEX_KEY); btrfs_set_key_type(&delayed_item->key, BTRFS_DIR_INDEX_KEY);
delayed_item->key.offset = index; delayed_item->key.offset = index;
...@@ -1337,7 +1338,7 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans, ...@@ -1337,7 +1338,7 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
if (IS_ERR(node)) if (IS_ERR(node))
return PTR_ERR(node); return PTR_ERR(node);
item_key.objectid = dir->i_ino; item_key.objectid = btrfs_ino(dir);
btrfs_set_key_type(&item_key, BTRFS_DIR_INDEX_KEY); btrfs_set_key_type(&item_key, BTRFS_DIR_INDEX_KEY);
item_key.offset = index; item_key.offset = index;
......
...@@ -138,7 +138,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -138,7 +138,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
struct btrfs_disk_key disk_key; struct btrfs_disk_key disk_key;
u32 data_size; u32 data_size;
key.objectid = dir->i_ino; key.objectid = btrfs_ino(dir);
btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
key.offset = btrfs_name_hash(name, name_len); key.offset = btrfs_name_hash(name, name_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment