Skip to content

Commit 2b10826

Browse files
committed
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 <[email protected]>
1 parent c9dc4c6 commit 2b10826

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fs/btrfs/free-space-cache.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
8585
}
8686

8787
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));
8990

9091
return inode;
9192
}
@@ -310,7 +311,6 @@ static void io_ctl_free(struct btrfs_io_ctl *io_ctl)
310311
static void io_ctl_unmap_page(struct btrfs_io_ctl *io_ctl)
311312
{
312313
if (io_ctl->cur) {
313-
kunmap(io_ctl->page);
314314
io_ctl->cur = NULL;
315315
io_ctl->orig = NULL;
316316
}
@@ -320,7 +320,7 @@ static void io_ctl_map_page(struct btrfs_io_ctl *io_ctl, int clear)
320320
{
321321
ASSERT(io_ctl->index < io_ctl->num_pages);
322322
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);
324324
io_ctl->orig = io_ctl->cur;
325325
io_ctl->size = PAGE_CACHE_SIZE;
326326
if (clear)
@@ -446,10 +446,9 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index)
446446
PAGE_CACHE_SIZE - offset);
447447
btrfs_csum_final(crc, (char *)&crc);
448448
io_ctl_unmap_page(io_ctl);
449-
tmp = kmap(io_ctl->pages[0]);
449+
tmp = page_address(io_ctl->pages[0]);
450450
tmp += index;
451451
*tmp = crc;
452-
kunmap(io_ctl->pages[0]);
453452
}
454453

455454
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)
466465
if (index == 0)
467466
offset = sizeof(u32) * io_ctl->num_pages;
468467

469-
tmp = kmap(io_ctl->pages[0]);
468+
tmp = page_address(io_ctl->pages[0]);
470469
tmp += index;
471470
val = *tmp;
472-
kunmap(io_ctl->pages[0]);
473471

474472
io_ctl_map_page(io_ctl, 0);
475473
crc = btrfs_csum_data(io_ctl->orig + offset, crc,

0 commit comments

Comments
 (0)