diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-04-18 10:29:50 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:02 -0400 |
commit | 7b13b7b119c932a5eca486db4113f4c1fe3b97a8 (patch) | |
tree | cf4432c69f660f0c22c1b6415c0d907ba6d44c8a /fs/btrfs/extent_io.c | |
parent | 7ae9c09d8f001eb19ee2ba219dc5c3d4f6d60614 (diff) |
Btrfs: Don't drop extent_map cache during releasepage on the btree inode
The btree inode should only have a single extent_map in the cache,
it doesn't make sense to ever drop it.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a984a7bc1197..81f8b4fd069b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2464,6 +2464,31 @@ err: | |||
2464 | EXPORT_SYMBOL(extent_prepare_write); | 2464 | EXPORT_SYMBOL(extent_prepare_write); |
2465 | 2465 | ||
2466 | /* | 2466 | /* |
2467 | * a helper for releasepage, this tests for areas of the page that | ||
2468 | * are locked or under IO and drops the related state bits if it is safe | ||
2469 | * to drop the page. | ||
2470 | */ | ||
2471 | int try_release_extent_state(struct extent_map_tree *map, | ||
2472 | struct extent_io_tree *tree, struct page *page, | ||
2473 | gfp_t mask) | ||
2474 | { | ||
2475 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | ||
2476 | u64 end = start + PAGE_CACHE_SIZE - 1; | ||
2477 | int ret = 1; | ||
2478 | |||
2479 | if (test_range_bit(tree, start, end, EXTENT_IOBITS, 0)) | ||
2480 | ret = 0; | ||
2481 | else { | ||
2482 | if ((mask & GFP_NOFS) == GFP_NOFS) | ||
2483 | mask = GFP_NOFS; | ||
2484 | clear_extent_bit(tree, start, end, EXTENT_UPTODATE, | ||
2485 | 1, 1, mask); | ||
2486 | } | ||
2487 | return ret; | ||
2488 | } | ||
2489 | EXPORT_SYMBOL(try_release_extent_state); | ||
2490 | |||
2491 | /* | ||
2467 | * a helper for releasepage. As long as there are no locked extents | 2492 | * a helper for releasepage. As long as there are no locked extents |
2468 | * in the range corresponding to the page, both state records and extent | 2493 | * in the range corresponding to the page, both state records and extent |
2469 | * map records are removed | 2494 | * map records are removed |
@@ -2475,8 +2500,7 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
2475 | struct extent_map *em; | 2500 | struct extent_map *em; |
2476 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 2501 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
2477 | u64 end = start + PAGE_CACHE_SIZE - 1; | 2502 | u64 end = start + PAGE_CACHE_SIZE - 1; |
2478 | u64 orig_start = start; | 2503 | |
2479 | int ret = 1; | ||
2480 | if ((mask & __GFP_WAIT) && | 2504 | if ((mask & __GFP_WAIT) && |
2481 | page->mapping->host->i_size > 16 * 1024 * 1024) { | 2505 | page->mapping->host->i_size > 16 * 1024 * 1024) { |
2482 | u64 len; | 2506 | u64 len; |
@@ -2507,15 +2531,7 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
2507 | free_extent_map(em); | 2531 | free_extent_map(em); |
2508 | } | 2532 | } |
2509 | } | 2533 | } |
2510 | if (test_range_bit(tree, orig_start, end, EXTENT_IOBITS, 0)) | 2534 | return try_release_extent_state(map, tree, page, mask); |
2511 | ret = 0; | ||
2512 | else { | ||
2513 | if ((mask & GFP_NOFS) == GFP_NOFS) | ||
2514 | mask = GFP_NOFS; | ||
2515 | clear_extent_bit(tree, orig_start, end, EXTENT_UPTODATE, | ||
2516 | 1, 1, mask); | ||
2517 | } | ||
2518 | return ret; | ||
2519 | } | 2535 | } |
2520 | EXPORT_SYMBOL(try_release_extent_mapping); | 2536 | EXPORT_SYMBOL(try_release_extent_mapping); |
2521 | 2537 | ||