aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-05-17 09:50:54 -0400
committerJosef Bacik <josef@redhat.com>2011-05-23 13:03:17 -0400
commitd90c732122a1f6d0efe388a8a204f67f144b2eb3 (patch)
tree4961605906cf3c8f50ae24fd1d4109eeb5e19e1a /fs/btrfs/inode.c
parent207dde8289d9b005b665cb9d8d2bb9464256101d (diff)
Btrfs: leave spinning on lookup and map the leaf
On lookup we only want to read the inode item, so leave the path spinning. Also we're just wholesale reading the leaf off, so map the leaf so we don't do a bunch of kmap/kunmaps. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6228a304b547..dc8fb2b3a145 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2493,6 +2493,7 @@ static void btrfs_read_locked_inode(struct inode *inode)
2493 2493
2494 path = btrfs_alloc_path(); 2494 path = btrfs_alloc_path();
2495 BUG_ON(!path); 2495 BUG_ON(!path);
2496 path->leave_spinning = 1;
2496 memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); 2497 memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));
2497 2498
2498 ret = btrfs_lookup_inode(NULL, root, path, &location, 0); 2499 ret = btrfs_lookup_inode(NULL, root, path, &location, 0);
@@ -2502,6 +2503,12 @@ static void btrfs_read_locked_inode(struct inode *inode)
2502 leaf = path->nodes[0]; 2503 leaf = path->nodes[0];
2503 inode_item = btrfs_item_ptr(leaf, path->slots[0], 2504 inode_item = btrfs_item_ptr(leaf, path->slots[0],
2504 struct btrfs_inode_item); 2505 struct btrfs_inode_item);
2506 if (!leaf->map_token)
2507 map_private_extent_buffer(leaf, (unsigned long)inode_item,
2508 sizeof(struct btrfs_inode_item),
2509 &leaf->map_token, &leaf->kaddr,
2510 &leaf->map_start, &leaf->map_len,
2511 KM_USER1);
2505 2512
2506 inode->i_mode = btrfs_inode_mode(leaf, inode_item); 2513 inode->i_mode = btrfs_inode_mode(leaf, inode_item);
2507 inode->i_nlink = btrfs_inode_nlink(leaf, inode_item); 2514 inode->i_nlink = btrfs_inode_nlink(leaf, inode_item);
@@ -2539,6 +2546,11 @@ static void btrfs_read_locked_inode(struct inode *inode)
2539 if (!maybe_acls) 2546 if (!maybe_acls)
2540 cache_no_acl(inode); 2547 cache_no_acl(inode);
2541 2548
2549 if (leaf->map_token) {
2550 unmap_extent_buffer(leaf, leaf->map_token, KM_USER1);
2551 leaf->map_token = NULL;
2552 }
2553
2542 btrfs_free_path(path); 2554 btrfs_free_path(path);
2543 inode_item = NULL; 2555 inode_item = NULL;
2544 2556