diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-10-08 12:30:20 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-10-08 15:11:50 -0400 |
commit | a3429ab70b04363c6190964e82f04f44f3e34cf0 (patch) | |
tree | f9aa5104699fdb82a3dfa327948241aa3e0022d5 /fs/btrfs | |
parent | a791e35e12ff672e8a0e140abeeaf900c3b2ea77 (diff) |
Btrfs: delay clearing EXTENT_DELALLOC for compressed extents
When compression is on, the cow_file_range code is farmed off to
worker threads. This allows us to do significant CPU work in parallel
on SMP machines.
But it is a delicate balance around when we clear flags and how. In
the past we cleared the delalloc flag immediately, which was safe
because the pages stayed locked.
But this is causing problems with the newest ENOSPC code, and with the
recent extent state cleanups we can now clear the delalloc bit at the
same time the uncompressed code does.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a7058fca3aab..401dfb2a94e8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -427,6 +427,7 @@ again: | |||
427 | &BTRFS_I(inode)->io_tree, | 427 | &BTRFS_I(inode)->io_tree, |
428 | start, end, NULL, | 428 | start, end, NULL, |
429 | EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY | | 429 | EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY | |
430 | EXTENT_CLEAR_DELALLOC | | ||
430 | EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK); | 431 | EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK); |
431 | ret = 0; | 432 | ret = 0; |
432 | goto free_pages_out; | 433 | goto free_pages_out; |
@@ -644,6 +645,7 @@ static noinline int submit_compressed_extents(struct inode *inode, | |||
644 | async_extent->ram_size - 1, | 645 | async_extent->ram_size - 1, |
645 | NULL, EXTENT_CLEAR_UNLOCK_PAGE | | 646 | NULL, EXTENT_CLEAR_UNLOCK_PAGE | |
646 | EXTENT_CLEAR_UNLOCK | | 647 | EXTENT_CLEAR_UNLOCK | |
648 | EXTENT_CLEAR_DELALLOC | | ||
647 | EXTENT_CLEAR_DIRTY | EXTENT_SET_WRITEBACK); | 649 | EXTENT_CLEAR_DIRTY | EXTENT_SET_WRITEBACK); |
648 | 650 | ||
649 | ret = btrfs_submit_compressed_write(inode, | 651 | ret = btrfs_submit_compressed_write(inode, |
@@ -877,8 +879,8 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
877 | u64 cur_end; | 879 | u64 cur_end; |
878 | int limit = 10 * 1024 * 1042; | 880 | int limit = 10 * 1024 * 1042; |
879 | 881 | ||
880 | clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED | | 882 | clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED, |
881 | EXTENT_DELALLOC, 1, 0, NULL, GFP_NOFS); | 883 | 1, 0, NULL, GFP_NOFS); |
882 | while (start < end) { | 884 | while (start < end) { |
883 | async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); | 885 | async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); |
884 | async_cow->inode = inode; | 886 | async_cow->inode = inode; |