aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-09-02 15:04:12 -0400
committerChris Mason <chris.mason@oracle.com>2009-09-11 13:31:06 -0400
commit2c64c53d8d30d43d0670482503a3914dfd3d6d46 (patch)
treecfe7bfa8f5dc4078f8c995f305229622e25572b1 /fs/btrfs/inode.c
parent1edbb734b4e010974c41d2859d22a43d04f5f1cf (diff)
Btrfs: cache values for locking extents
Many of the btrfs extent state tree users follow the same pattern. They lock an extent range in the tree, do some operation and then unlock. This translates to at least 2 rbtree searches, and maybe more if they are doing operations on the extent state tree. A locked extent in the tree isn't going to be merged or changed, and so we can safely return the extent state structure as a cached handle. This changes set_extent_bit to give back a cached handle, and also changes both set_extent_bit and clear_extent_bit to use the cached handle if it is available. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f1df11718618..e494545c4202 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -854,7 +854,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
854 int limit = 10 * 1024 * 1042; 854 int limit = 10 * 1024 * 1042;
855 855
856 clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED | 856 clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED |
857 EXTENT_DELALLOC, 1, 0, GFP_NOFS); 857 EXTENT_DELALLOC, 1, 0, NULL, GFP_NOFS);
858 while (start < end) { 858 while (start < end) {
859 async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); 859 async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS);
860 async_cow->inode = inode; 860 async_cow->inode = inode;
@@ -4420,7 +4420,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
4420 */ 4420 */
4421 clear_extent_bit(tree, page_start, page_end, 4421 clear_extent_bit(tree, page_start, page_end,
4422 EXTENT_DIRTY | EXTENT_DELALLOC | 4422 EXTENT_DIRTY | EXTENT_DELALLOC |
4423 EXTENT_LOCKED, 1, 0, GFP_NOFS); 4423 EXTENT_LOCKED, 1, 0, NULL, GFP_NOFS);
4424 btrfs_finish_ordered_io(page->mapping->host, 4424 btrfs_finish_ordered_io(page->mapping->host,
4425 page_start, page_end); 4425 page_start, page_end);
4426 btrfs_put_ordered_extent(ordered); 4426 btrfs_put_ordered_extent(ordered);
@@ -4429,7 +4429,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
4429 clear_extent_bit(tree, page_start, page_end, 4429 clear_extent_bit(tree, page_start, page_end,
4430 EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | 4430 EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
4431 EXTENT_ORDERED, 4431 EXTENT_ORDERED,
4432 1, 1, GFP_NOFS); 4432 1, 1, NULL, GFP_NOFS);
4433 __btrfs_releasepage(page, GFP_NOFS); 4433 __btrfs_releasepage(page, GFP_NOFS);
4434 4434
4435 ClearPageChecked(page); 4435 ClearPageChecked(page);