summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAneesh <aneesh.kumar@linux.vnet.ibm.com>2007-06-13 16:18:26 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-06-13 16:18:26 -0400
commitf1ace244c8c1e16eaa5c8b3b5339849651e31ede (patch)
treef1a84930a17a6803072f390bab28eb43f6e95f5b /fs
parentb79ab950f57c3260ee609ba41779019d21b8eb88 (diff)
downloadlinux-3.10-f1ace244c8c1e16eaa5c8b3b5339849651e31ede.tar.gz
linux-3.10-f1ace244c8c1e16eaa5c8b3b5339849651e31ede.tar.bz2
linux-3.10-f1ace244c8c1e16eaa5c8b3b5339849651e31ede.zip
btrfs: Code cleanup
Attaching below is some of the code cleanups that i came across while reading the code. a) alloc_path already calls init_path. b) Mention that btrfs_inode is the in memory copy.Ext4 have ext4_inode_info as the in memory copy ext4_inode as the disk copy Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/btrfs_inode.h1
-rw-r--r--fs/btrfs/ctree.c1
-rw-r--r--fs/btrfs/dir-item.c1
-rw-r--r--fs/btrfs/extent-tree.c4
-rw-r--r--fs/btrfs/file-item.c2
-rw-r--r--fs/btrfs/inode-item.c1
-rw-r--r--fs/btrfs/inode.c10
-rw-r--r--fs/btrfs/root-tree.c3
8 files changed, 2 insertions, 21 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 783f06b6325..6bce46be49f 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -19,6 +19,7 @@
#ifndef __BTRFS_I__
#define __BTRFS_I__
+/* in memory btrfs inode */
struct btrfs_inode {
struct btrfs_root *root;
struct btrfs_block_group_cache *block_group;
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 4736155af41..498dea0854c 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1647,7 +1647,6 @@ int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size);
if (!ret) {
ptr = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]),
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 0d179a44ebf..ff10cf5a842 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -74,7 +74,6 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
ret = btrfs_name_hash(name, name_len, &key.offset);
BUG_ON(ret);
path = btrfs_alloc_path();
- btrfs_init_path(path);
data_size = sizeof(*dir_item) + name_len;
dir_item = insert_with_overflow(trans, root, path, &key, data_size,
name, name_len);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 975a0eb9241..5f4eaba8b85 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -402,7 +402,6 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
&ins, 0);
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
key.objectid = blocknr;
key.flags = 0;
btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY);
@@ -437,7 +436,6 @@ static int lookup_extent_ref(struct btrfs_trans_handle *trans,
struct btrfs_extent_item *item;
path = btrfs_alloc_path();
- btrfs_init_path(path);
key.objectid = blocknr;
key.offset = num_blocks;
key.flags = 0;
@@ -807,7 +805,6 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
find_free_extent(trans, root, 0, 0, (u64)-1, 0, &ins, 0);
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_search_slot(trans, extent_root, &key, path, -1, 1);
if (ret) {
@@ -1463,7 +1460,6 @@ int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
level = btrfs_header_level(btrfs_buffer_header(snap));
orig_level = level;
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 37dd3801a10..3c140cc1dd0 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -38,7 +38,6 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
file_key.objectid = objectid;
file_key.offset = pos;
file_key.flags = 0;
@@ -274,7 +273,6 @@ int btrfs_csum_verify_file_block(struct btrfs_root *root,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
file_key.objectid = objectid;
file_key.offset = offset;
file_key.flags = 0;
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index 449e9dbdf95..e8b5a9f7c0c 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -35,7 +35,6 @@ int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_insert_item(trans, root, &key, inode_item,
sizeof(*inode_item));
btrfs_release_path(root, path);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d3d5a4cdb6a..e639cc9e089 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -79,7 +79,6 @@ void btrfs_read_locked_inode(struct inode *inode)
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
mutex_lock(&root->fs_info->fs_mutex);
memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));
@@ -177,7 +176,6 @@ static int btrfs_update_inode(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_lookup_inode(trans, root, path,
&BTRFS_I(inode)->location, 1);
if (ret) {
@@ -214,7 +212,6 @@ static int btrfs_unlink_trans(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino,
name, name_len, -1);
if (IS_ERR(di)) {
@@ -289,7 +286,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
mutex_lock(&root->fs_info->fs_mutex);
trans = btrfs_start_transaction(root, 1);
btrfs_set_trans_block_group(trans, dir);
@@ -360,7 +356,6 @@ static int btrfs_free_inode(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_lookup_inode(trans, root, path,
&BTRFS_I(inode)->location, -1);
BUG_ON(ret);
@@ -687,7 +682,6 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name,
namelen, 0);
if (!di || IS_ERR(di)) {
@@ -874,7 +868,6 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
btrfs_set_key_type(&key, key_type);
key.offset = filp->f_pos;
path = btrfs_alloc_path();
- btrfs_init_path(path);
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
goto err;
@@ -1263,7 +1256,6 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
if (create & BTRFS_GET_BLOCK_CREATE) {
WARN_ON(1);
/* this almost but not quite works */
@@ -1280,7 +1272,7 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock,
}
ret = btrfs_lookup_file_extent(NULL, root, path,
- inode->i_ino,
+ objectid,
iblock << inode->i_blkbits, 0);
if (ret < 0) {
err = ret;
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 7a2d63c1ee8..8e1b9046d5e 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -36,7 +36,6 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
if (ret < 0)
goto out;
@@ -70,7 +69,6 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_search_slot(trans, root, key, path, 0, 1);
if (ret < 0)
goto out;
@@ -106,7 +104,6 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
path = btrfs_alloc_path();
BUG_ON(!path);
- btrfs_init_path(path);
ret = btrfs_search_slot(trans, root, key, path, -1, 1);
if (ret < 0)
goto out;