diff options
author | Chris Mason <clm@fb.com> | 2015-04-06 10:48:20 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-10 17:07:18 -0400 |
commit | 2b108268006e06d57ec9810f4ccf5d99d7e5b598 (patch) | |
tree | 349dd004791477ef08e430d32fcb91be3ed6ebff | |
parent | c9dc4c6578502c2085705347375b82089aad18d0 (diff) |
Btrfs: don't use highmem for free space cache pages
In order to create the free space cache concurrently with FS modifications,
we need to take a few block group locks.
The cache code also does kmap, which would schedule with the locks held.
Instead of going through kmap_atomic, lets just use lowmem for the cache
pages.
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | fs/btrfs/free-space-cache.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 6886ae063483..83532a245947 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -85,7 +85,8 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root, | |||
85 | } | 85 | } |
86 | 86 | ||
87 | mapping_set_gfp_mask(inode->i_mapping, | 87 | mapping_set_gfp_mask(inode->i_mapping, |
88 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | 88 | mapping_gfp_mask(inode->i_mapping) & |
89 | ~(GFP_NOFS & ~__GFP_HIGHMEM)); | ||
89 | 90 | ||
90 | return inode; | 91 | return inode; |
91 | } | 92 | } |
@@ -310,7 +311,6 @@ static void io_ctl_free(struct btrfs_io_ctl *io_ctl) | |||
310 | static void io_ctl_unmap_page(struct btrfs_io_ctl *io_ctl) | 311 | static void io_ctl_unmap_page(struct btrfs_io_ctl *io_ctl) |
311 | { | 312 | { |
312 | if (io_ctl->cur) { | 313 | if (io_ctl->cur) { |
313 | kunmap(io_ctl->page); | ||
314 | io_ctl->cur = NULL; | 314 | io_ctl->cur = NULL; |
315 | io_ctl->orig = NULL; | 315 | io_ctl->orig = NULL; |
316 | } | 316 | } |
@@ -320,7 +320,7 @@ static void io_ctl_map_page(struct btrfs_io_ctl *io_ctl, int clear) | |||
320 | { | 320 | { |
321 | ASSERT(io_ctl->index < io_ctl->num_pages); | 321 | ASSERT(io_ctl->index < io_ctl->num_pages); |
322 | io_ctl->page = io_ctl->pages[io_ctl->index++]; | 322 | io_ctl->page = io_ctl->pages[io_ctl->index++]; |
323 | io_ctl->cur = kmap(io_ctl->page); | 323 | io_ctl->cur = page_address(io_ctl->page); |
324 | io_ctl->orig = io_ctl->cur; | 324 | io_ctl->orig = io_ctl->cur; |
325 | io_ctl->size = PAGE_CACHE_SIZE; | 325 | io_ctl->size = PAGE_CACHE_SIZE; |
326 | if (clear) | 326 | if (clear) |
@@ -446,10 +446,9 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index) | |||
446 | PAGE_CACHE_SIZE - offset); | 446 | PAGE_CACHE_SIZE - offset); |
447 | btrfs_csum_final(crc, (char *)&crc); | 447 | btrfs_csum_final(crc, (char *)&crc); |
448 | io_ctl_unmap_page(io_ctl); | 448 | io_ctl_unmap_page(io_ctl); |
449 | tmp = kmap(io_ctl->pages[0]); | 449 | tmp = page_address(io_ctl->pages[0]); |
450 | tmp += index; | 450 | tmp += index; |
451 | *tmp = crc; | 451 | *tmp = crc; |
452 | kunmap(io_ctl->pages[0]); | ||
453 | } | 452 | } |
454 | 453 | ||
455 | static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index) | 454 | static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index) |
@@ -466,10 +465,9 @@ static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index) | |||
466 | if (index == 0) | 465 | if (index == 0) |
467 | offset = sizeof(u32) * io_ctl->num_pages; | 466 | offset = sizeof(u32) * io_ctl->num_pages; |
468 | 467 | ||
469 | tmp = kmap(io_ctl->pages[0]); | 468 | tmp = page_address(io_ctl->pages[0]); |
470 | tmp += index; | 469 | tmp += index; |
471 | val = *tmp; | 470 | val = *tmp; |
472 | kunmap(io_ctl->pages[0]); | ||
473 | 471 | ||
474 | io_ctl_map_page(io_ctl, 0); | 472 | io_ctl_map_page(io_ctl, 0); |
475 | crc = btrfs_csum_data(io_ctl->orig + offset, crc, | 473 | crc = btrfs_csum_data(io_ctl->orig + offset, crc, |