[Btrfs-devel] Code cleanups

Aneesh Kumar K.V aneesh.kumar at gmail.com
Wed Jul 11 07:41:57 PDT 2007


a) btrfs_path_alloc calls btrfs_init_path.
b) shuffle the code so that btrfs_buffer_leaf is only called once


diff -r 6ffd9ebb3211 extent-tree.c
--- a/extent-tree.c	Wed Jul 11 10:18:17 2007 -0400
+++ b/extent-tree.c	Wed Jul 11 20:07:23 2007 +0530
@@ -1079,7 +1079,6 @@ check_failed:
 	else if (!full_scan)
 		search_start = max(block_group->last_alloc, search_start);
 
-	btrfs_init_path(path);
 	ins->objectid = search_start;
 	ins->offset = 0;
 	start_found = 0;
diff -r 6ffd9ebb3211 inode.c
--- a/inode.c	Wed Jul 11 10:18:17 2007 -0400
+++ b/inode.c	Wed Jul 11 20:08:55 2007 +0530
@@ -1366,9 +1366,9 @@ static int btrfs_get_block_lock(struct i
 		path->slots[0]--;
 	}
 
-	item = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]), path->slots[0],
+	leaf = btrfs_buffer_leaf(path->nodes[0]);
+	item = btrfs_item_ptr(leaf, path->slots[0],
 			      struct btrfs_file_extent_item);
-	leaf = btrfs_buffer_leaf(path->nodes[0]);
 	blocknr = btrfs_file_extent_disk_blocknr(item);
 	blocknr += btrfs_file_extent_offset(item);
 



More information about the Btrfs-devel mailing list