diff options
author | Aneesh <aneesh.kumar@linux.vnet.ibm.com> | 2007-06-13 16:18:26 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-06-13 16:18:26 -0400 |
commit | f1ace244c8c1e16eaa5c8b3b5339849651e31ede (patch) | |
tree | f1a84930a17a6803072f390bab28eb43f6e95f5b /fs/btrfs/inode.c | |
parent | b79ab950f57c3260ee609ba41779019d21b8eb88 (diff) |
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/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d3d5a4cdb6af..e639cc9e089f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -79,7 +79,6 @@ void btrfs_read_locked_inode(struct inode *inode) | |||
79 | 79 | ||
80 | path = btrfs_alloc_path(); | 80 | path = btrfs_alloc_path(); |
81 | BUG_ON(!path); | 81 | BUG_ON(!path); |
82 | btrfs_init_path(path); | ||
83 | mutex_lock(&root->fs_info->fs_mutex); | 82 | mutex_lock(&root->fs_info->fs_mutex); |
84 | 83 | ||
85 | memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); | 84 | memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); |
@@ -177,7 +176,6 @@ static int btrfs_update_inode(struct btrfs_trans_handle *trans, | |||
177 | 176 | ||
178 | path = btrfs_alloc_path(); | 177 | path = btrfs_alloc_path(); |
179 | BUG_ON(!path); | 178 | BUG_ON(!path); |
180 | btrfs_init_path(path); | ||
181 | ret = btrfs_lookup_inode(trans, root, path, | 179 | ret = btrfs_lookup_inode(trans, root, path, |
182 | &BTRFS_I(inode)->location, 1); | 180 | &BTRFS_I(inode)->location, 1); |
183 | if (ret) { | 181 | if (ret) { |
@@ -214,7 +212,6 @@ static int btrfs_unlink_trans(struct btrfs_trans_handle *trans, | |||
214 | 212 | ||
215 | path = btrfs_alloc_path(); | 213 | path = btrfs_alloc_path(); |
216 | BUG_ON(!path); | 214 | BUG_ON(!path); |
217 | btrfs_init_path(path); | ||
218 | di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino, | 215 | di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino, |
219 | name, name_len, -1); | 216 | name, name_len, -1); |
220 | if (IS_ERR(di)) { | 217 | if (IS_ERR(di)) { |
@@ -289,7 +286,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
289 | 286 | ||
290 | path = btrfs_alloc_path(); | 287 | path = btrfs_alloc_path(); |
291 | BUG_ON(!path); | 288 | BUG_ON(!path); |
292 | btrfs_init_path(path); | ||
293 | mutex_lock(&root->fs_info->fs_mutex); | 289 | mutex_lock(&root->fs_info->fs_mutex); |
294 | trans = btrfs_start_transaction(root, 1); | 290 | trans = btrfs_start_transaction(root, 1); |
295 | btrfs_set_trans_block_group(trans, dir); | 291 | btrfs_set_trans_block_group(trans, dir); |
@@ -360,7 +356,6 @@ static int btrfs_free_inode(struct btrfs_trans_handle *trans, | |||
360 | 356 | ||
361 | path = btrfs_alloc_path(); | 357 | path = btrfs_alloc_path(); |
362 | BUG_ON(!path); | 358 | BUG_ON(!path); |
363 | btrfs_init_path(path); | ||
364 | ret = btrfs_lookup_inode(trans, root, path, | 359 | ret = btrfs_lookup_inode(trans, root, path, |
365 | &BTRFS_I(inode)->location, -1); | 360 | &BTRFS_I(inode)->location, -1); |
366 | BUG_ON(ret); | 361 | BUG_ON(ret); |
@@ -687,7 +682,6 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, | |||
687 | 682 | ||
688 | path = btrfs_alloc_path(); | 683 | path = btrfs_alloc_path(); |
689 | BUG_ON(!path); | 684 | BUG_ON(!path); |
690 | btrfs_init_path(path); | ||
691 | di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name, | 685 | di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name, |
692 | namelen, 0); | 686 | namelen, 0); |
693 | if (!di || IS_ERR(di)) { | 687 | if (!di || IS_ERR(di)) { |
@@ -874,7 +868,6 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
874 | btrfs_set_key_type(&key, key_type); | 868 | btrfs_set_key_type(&key, key_type); |
875 | key.offset = filp->f_pos; | 869 | key.offset = filp->f_pos; |
876 | path = btrfs_alloc_path(); | 870 | path = btrfs_alloc_path(); |
877 | btrfs_init_path(path); | ||
878 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 871 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
879 | if (ret < 0) | 872 | if (ret < 0) |
880 | goto err; | 873 | goto err; |
@@ -1263,7 +1256,6 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock, | |||
1263 | 1256 | ||
1264 | path = btrfs_alloc_path(); | 1257 | path = btrfs_alloc_path(); |
1265 | BUG_ON(!path); | 1258 | BUG_ON(!path); |
1266 | btrfs_init_path(path); | ||
1267 | if (create & BTRFS_GET_BLOCK_CREATE) { | 1259 | if (create & BTRFS_GET_BLOCK_CREATE) { |
1268 | WARN_ON(1); | 1260 | WARN_ON(1); |
1269 | /* this almost but not quite works */ | 1261 | /* this almost but not quite works */ |
@@ -1280,7 +1272,7 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock, | |||
1280 | } | 1272 | } |
1281 | 1273 | ||
1282 | ret = btrfs_lookup_file_extent(NULL, root, path, | 1274 | ret = btrfs_lookup_file_extent(NULL, root, path, |
1283 | inode->i_ino, | 1275 | objectid, |
1284 | iblock << inode->i_blkbits, 0); | 1276 | iblock << inode->i_blkbits, 0); |
1285 | if (ret < 0) { | 1277 | if (ret < 0) { |
1286 | err = ret; | 1278 | err = ret; |