Commit 2ac55d41 authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

Btrfs: cache the extent state everywhere we possibly can V2

This patch just goes through and fixes everybody that does

lock_extent()
blah
unlock_extent()

to use

lock_extent_bits()
blah
unlock_extent_cached()

and pass around a extent_state so we only have to do the searches once per
function.  This gives me about a 3 mb/s boots on my random write test.  I have
not converted some things, like the relocation and ioctl's, since they aren't
heavily used and the relocation stuff is in the middle of being re-written.  I
also changed the clear_extent_bit() to only unset the cached state if we are
clearing EXTENT_LOCKED and related stuff, so we can do things like this

lock_extent_bits()
clear delalloc bits
unlock_extent_cached()

without losing our cached state.  I tested this thoroughly and turned on
LEAK_DEBUG to make sure we weren't leaking extent states, everything worked out
fine.
Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 5a1a3df1
...@@ -2311,7 +2311,8 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -2311,7 +2311,8 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
u32 min_type); u32 min_type);
int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput); int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput);
int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end); int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
struct extent_state **cached_state);
int btrfs_writepages(struct address_space *mapping, int btrfs_writepages(struct address_space *mapping,
struct writeback_control *wbc); struct writeback_control *wbc);
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
......
...@@ -263,13 +263,15 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, ...@@ -263,13 +263,15 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
static int verify_parent_transid(struct extent_io_tree *io_tree, static int verify_parent_transid(struct extent_io_tree *io_tree,
struct extent_buffer *eb, u64 parent_transid) struct extent_buffer *eb, u64 parent_transid)
{ {
struct extent_state *cached_state = NULL;
int ret; int ret;
if (!parent_transid || btrfs_header_generation(eb) == parent_transid) if (!parent_transid || btrfs_header_generation(eb) == parent_transid)
return 0; return 0;
lock_extent(io_tree, eb->start, eb->start + eb->len - 1, GFP_NOFS); lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1,
if (extent_buffer_uptodate(io_tree, eb) && 0, &cached_state, GFP_NOFS);
if (extent_buffer_uptodate(io_tree, eb, cached_state) &&
btrfs_header_generation(eb) == parent_transid) { btrfs_header_generation(eb) == parent_transid) {
ret = 0; ret = 0;
goto out; goto out;
...@@ -282,10 +284,10 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, ...@@ -282,10 +284,10 @@ static int verify_parent_transid(struct extent_io_tree *io_tree,
(unsigned long long)btrfs_header_generation(eb)); (unsigned long long)btrfs_header_generation(eb));
} }
ret = 1; ret = 1;
clear_extent_buffer_uptodate(io_tree, eb); clear_extent_buffer_uptodate(io_tree, eb, &cached_state);
out: out:
unlock_extent(io_tree, eb->start, eb->start + eb->len - 1, unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1,
GFP_NOFS); &cached_state, GFP_NOFS);
return ret; return ret;
} }
...@@ -2497,7 +2499,8 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid) ...@@ -2497,7 +2499,8 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
int ret; int ret;
struct inode *btree_inode = buf->first_page->mapping->host; struct inode *btree_inode = buf->first_page->mapping->host;
ret = extent_buffer_uptodate(&BTRFS_I(btree_inode)->io_tree, buf); ret = extent_buffer_uptodate(&BTRFS_I(btree_inode)->io_tree, buf,
NULL);
if (!ret) if (!ret)
return ret; return ret;
......
...@@ -6561,6 +6561,7 @@ static noinline int invalidate_extent_cache(struct btrfs_root *root, ...@@ -6561,6 +6561,7 @@ static noinline int invalidate_extent_cache(struct btrfs_root *root,
struct btrfs_key key; struct btrfs_key key;
struct inode *inode = NULL; struct inode *inode = NULL;
struct btrfs_file_extent_item *fi; struct btrfs_file_extent_item *fi;
struct extent_state *cached_state = NULL;
u64 num_bytes; u64 num_bytes;
u64 skip_objectid = 0; u64 skip_objectid = 0;
u32 nritems; u32 nritems;
...@@ -6589,12 +6590,14 @@ static noinline int invalidate_extent_cache(struct btrfs_root *root, ...@@ -6589,12 +6590,14 @@ static noinline int invalidate_extent_cache(struct btrfs_root *root,
} }
num_bytes = btrfs_file_extent_num_bytes(leaf, fi); num_bytes = btrfs_file_extent_num_bytes(leaf, fi);
lock_extent(&BTRFS_I(inode)->io_tree, key.offset, lock_extent_bits(&BTRFS_I(inode)->io_tree, key.offset,
key.offset + num_bytes - 1, GFP_NOFS); key.offset + num_bytes - 1, 0, &cached_state,
GFP_NOFS);
btrfs_drop_extent_cache(inode, key.offset, btrfs_drop_extent_cache(inode, key.offset,
key.offset + num_bytes - 1, 1); key.offset + num_bytes - 1, 1);
unlock_extent(&BTRFS_I(inode)->io_tree, key.offset, unlock_extent_cached(&BTRFS_I(inode)->io_tree, key.offset,
key.offset + num_bytes - 1, GFP_NOFS); key.offset + num_bytes - 1, &cached_state,
GFP_NOFS);
cond_resched(); cond_resched();
} }
iput(inode); iput(inode);
......
...@@ -513,7 +513,10 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -513,7 +513,10 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
u64 last_end; u64 last_end;
int err; int err;
int set = 0; int set = 0;
int clear = 0;
if (bits & (EXTENT_IOBITS | EXTENT_BOUNDARY))
clear = 1;
again: again:
if (!prealloc && (mask & __GFP_WAIT)) { if (!prealloc && (mask & __GFP_WAIT)) {
prealloc = alloc_extent_state(mask); prealloc = alloc_extent_state(mask);
...@@ -524,13 +527,19 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -524,13 +527,19 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
spin_lock(&tree->lock); spin_lock(&tree->lock);
if (cached_state) { if (cached_state) {
cached = *cached_state; cached = *cached_state;
if (clear) {
*cached_state = NULL; *cached_state = NULL;
cached_state = NULL; cached_state = NULL;
}
if (cached && cached->tree && cached->start == start) { if (cached && cached->tree && cached->start == start) {
if (clear)
atomic_dec(&cached->refs); atomic_dec(&cached->refs);
state = cached; state = cached;
goto hit_next; goto hit_next;
} }
if (clear)
free_extent_state(cached); free_extent_state(cached);
} }
/* /*
...@@ -946,11 +955,11 @@ int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -946,11 +955,11 @@ int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
} }
int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask) struct extent_state **cached_state, gfp_t mask)
{ {
return set_extent_bit(tree, start, end, return set_extent_bit(tree, start, end,
EXTENT_DELALLOC | EXTENT_DIRTY | EXTENT_UPTODATE, EXTENT_DELALLOC | EXTENT_DIRTY | EXTENT_UPTODATE,
0, NULL, NULL, mask); 0, NULL, cached_state, mask);
} }
int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
...@@ -984,10 +993,11 @@ int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -984,10 +993,11 @@ int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
} }
static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
u64 end, gfp_t mask) u64 end, struct extent_state **cached_state,
gfp_t mask)
{ {
return clear_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, 0, return clear_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, 0,
NULL, mask); cached_state, mask);
} }
int wait_on_extent_writeback(struct extent_io_tree *tree, u64 start, u64 end) int wait_on_extent_writeback(struct extent_io_tree *tree, u64 start, u64 end)
...@@ -1727,7 +1737,7 @@ static void end_bio_extent_writepage(struct bio *bio, int err) ...@@ -1727,7 +1737,7 @@ static void end_bio_extent_writepage(struct bio *bio, int err)
} }
if (!uptodate) { if (!uptodate) {
clear_extent_uptodate(tree, start, end, GFP_NOFS); clear_extent_uptodate(tree, start, end, NULL, GFP_NOFS);
ClearPageUptodate(page); ClearPageUptodate(page);
SetPageError(page); SetPageError(page);
} }
...@@ -2710,6 +2720,7 @@ int extent_readpages(struct extent_io_tree *tree, ...@@ -2710,6 +2720,7 @@ int extent_readpages(struct extent_io_tree *tree,
int extent_invalidatepage(struct extent_io_tree *tree, int extent_invalidatepage(struct extent_io_tree *tree,
struct page *page, unsigned long offset) struct page *page, unsigned long offset)
{ {
struct extent_state *cached_state = NULL;
u64 start = ((u64)page->index << PAGE_CACHE_SHIFT); u64 start = ((u64)page->index << PAGE_CACHE_SHIFT);
u64 end = start + PAGE_CACHE_SIZE - 1; u64 end = start + PAGE_CACHE_SIZE - 1;
size_t blocksize = page->mapping->host->i_sb->s_blocksize; size_t blocksize = page->mapping->host->i_sb->s_blocksize;
...@@ -2718,12 +2729,12 @@ int extent_invalidatepage(struct extent_io_tree *tree, ...@@ -2718,12 +2729,12 @@ int extent_invalidatepage(struct extent_io_tree *tree,
if (start > end) if (start > end)
return 0; return 0;
lock_extent(tree, start, end, GFP_NOFS); lock_extent_bits(tree, start, end, 0, &cached_state, GFP_NOFS);
wait_on_page_writeback(page); wait_on_page_writeback(page);
clear_extent_bit(tree, start, end, clear_extent_bit(tree, start, end,
EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING, EXTENT_DO_ACCOUNTING,
1, 1, NULL, GFP_NOFS); 1, 1, &cached_state, GFP_NOFS);
return 0; return 0;
} }
...@@ -2926,16 +2937,17 @@ sector_t extent_bmap(struct address_space *mapping, sector_t iblock, ...@@ -2926,16 +2937,17 @@ sector_t extent_bmap(struct address_space *mapping, sector_t iblock,
get_extent_t *get_extent) get_extent_t *get_extent)
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct extent_state *cached_state = NULL;
u64 start = iblock << inode->i_blkbits; u64 start = iblock << inode->i_blkbits;
sector_t sector = 0; sector_t sector = 0;
size_t blksize = (1 << inode->i_blkbits); size_t blksize = (1 << inode->i_blkbits);
struct extent_map *em; struct extent_map *em;
lock_extent(&BTRFS_I(inode)->io_tree, start, start + blksize - 1, lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + blksize - 1,
GFP_NOFS); 0, &cached_state, GFP_NOFS);
em = get_extent(inode, NULL, 0, start, blksize, 0); em = get_extent(inode, NULL, 0, start, blksize, 0);
unlock_extent(&BTRFS_I(inode)->io_tree, start, start + blksize - 1, unlock_extent_cached(&BTRFS_I(inode)->io_tree, start,
GFP_NOFS); start + blksize - 1, &cached_state, GFP_NOFS);
if (!em || IS_ERR(em)) if (!em || IS_ERR(em))
return 0; return 0;
...@@ -2957,6 +2969,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -2957,6 +2969,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
u32 flags = 0; u32 flags = 0;
u64 disko = 0; u64 disko = 0;
struct extent_map *em = NULL; struct extent_map *em = NULL;
struct extent_state *cached_state = NULL;
int end = 0; int end = 0;
u64 em_start = 0, em_len = 0; u64 em_start = 0, em_len = 0;
unsigned long emflags; unsigned long emflags;
...@@ -2965,8 +2978,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -2965,8 +2978,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
if (len == 0) if (len == 0)
return -EINVAL; return -EINVAL;
lock_extent(&BTRFS_I(inode)->io_tree, start, start + len, lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0,
GFP_NOFS); &cached_state, GFP_NOFS);
em = get_extent(inode, NULL, 0, off, max - off, 0); em = get_extent(inode, NULL, 0, off, max - off, 0);
if (!em) if (!em)
goto out; goto out;
...@@ -3029,8 +3042,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -3029,8 +3042,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
out_free: out_free:
free_extent_map(em); free_extent_map(em);
out: out:
unlock_extent(&BTRFS_I(inode)->io_tree, start, start + len, unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len,
GFP_NOFS); &cached_state, GFP_NOFS);
return ret; return ret;
} }
...@@ -3270,7 +3283,8 @@ int set_extent_buffer_dirty(struct extent_io_tree *tree, ...@@ -3270,7 +3283,8 @@ int set_extent_buffer_dirty(struct extent_io_tree *tree,
} }
int clear_extent_buffer_uptodate(struct extent_io_tree *tree, int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
struct extent_buffer *eb) struct extent_buffer *eb,
struct extent_state **cached_state)
{ {
unsigned long i; unsigned long i;
struct page *page; struct page *page;
...@@ -3280,7 +3294,7 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree, ...@@ -3280,7 +3294,7 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1, clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1,
GFP_NOFS); cached_state, GFP_NOFS);
for (i = 0; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
page = extent_buffer_page(eb, i); page = extent_buffer_page(eb, i);
if (page) if (page)
...@@ -3340,7 +3354,8 @@ int extent_range_uptodate(struct extent_io_tree *tree, ...@@ -3340,7 +3354,8 @@ int extent_range_uptodate(struct extent_io_tree *tree,
} }
int extent_buffer_uptodate(struct extent_io_tree *tree, int extent_buffer_uptodate(struct extent_io_tree *tree,
struct extent_buffer *eb) struct extent_buffer *eb,
struct extent_state *cached_state)
{ {
int ret = 0; int ret = 0;
unsigned long num_pages; unsigned long num_pages;
...@@ -3352,7 +3367,7 @@ int extent_buffer_uptodate(struct extent_io_tree *tree, ...@@ -3352,7 +3367,7 @@ int extent_buffer_uptodate(struct extent_io_tree *tree,
return 1; return 1;
ret = test_range_bit(tree, eb->start, eb->start + eb->len - 1, ret = test_range_bit(tree, eb->start, eb->start + eb->len - 1,
EXTENT_UPTODATE, 1, NULL); EXTENT_UPTODATE, 1, cached_state);
if (ret) if (ret)
return ret; return ret;
......
...@@ -163,6 +163,8 @@ int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask); ...@@ -163,6 +163,8 @@ int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask);
int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, struct extent_state **cached, gfp_t mask); int bits, struct extent_state **cached, gfp_t mask);
int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask); int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask);
int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached, gfp_t mask);
int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask); gfp_t mask);
int extent_read_full_page(struct extent_io_tree *tree, struct page *page, int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
...@@ -196,7 +198,7 @@ int clear_extent_ordered(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -196,7 +198,7 @@ int clear_extent_ordered(struct extent_io_tree *tree, u64 start, u64 end,
int clear_extent_ordered_metadata(struct extent_io_tree *tree, u64 start, int clear_extent_ordered_metadata(struct extent_io_tree *tree, u64 start,
u64 end, gfp_t mask); u64 end, gfp_t mask);
int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_ordered(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_ordered(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask); gfp_t mask);
int find_first_extent_bit(struct extent_io_tree *tree, u64 start, int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
...@@ -281,9 +283,11 @@ int test_extent_buffer_dirty(struct extent_io_tree *tree, ...@@ -281,9 +283,11 @@ int test_extent_buffer_dirty(struct extent_io_tree *tree,
int set_extent_buffer_uptodate(struct extent_io_tree *tree, int set_extent_buffer_uptodate(struct extent_io_tree *tree,
struct extent_buffer *eb); struct extent_buffer *eb);
int clear_extent_buffer_uptodate(struct extent_io_tree *tree, int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
struct extent_buffer *eb); struct extent_buffer *eb,
struct extent_state **cached_state);
int extent_buffer_uptodate(struct extent_io_tree *tree, int extent_buffer_uptodate(struct extent_io_tree *tree,
struct extent_buffer *eb); struct extent_buffer *eb,
struct extent_state *cached_state);
int map_extent_buffer(struct extent_buffer *eb, unsigned long offset, int map_extent_buffer(struct extent_buffer *eb, unsigned long offset,
unsigned long min_len, char **token, char **map, unsigned long min_len, char **token, char **map,
unsigned long *map_start, unsigned long *map_start,
......
...@@ -123,7 +123,8 @@ static noinline int dirty_and_release_pages(struct btrfs_trans_handle *trans, ...@@ -123,7 +123,8 @@ static noinline int dirty_and_release_pages(struct btrfs_trans_handle *trans,
root->sectorsize - 1) & ~((u64)root->sectorsize - 1); root->sectorsize - 1) & ~((u64)root->sectorsize - 1);
end_of_last_block = start_pos + num_bytes - 1; end_of_last_block = start_pos + num_bytes - 1;
err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block); err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block,
NULL);
if (err) if (err)
return err; return err;
...@@ -753,6 +754,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, ...@@ -753,6 +754,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
loff_t pos, unsigned long first_index, loff_t pos, unsigned long first_index,
unsigned long last_index, size_t write_bytes) unsigned long last_index, size_t write_bytes)
{ {
struct extent_state *cached_state = NULL;
int i; int i;
unsigned long index = pos >> PAGE_CACHE_SHIFT; unsigned long index = pos >> PAGE_CACHE_SHIFT;
struct inode *inode = fdentry(file)->d_inode; struct inode *inode = fdentry(file)->d_inode;
...@@ -781,16 +783,18 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, ...@@ -781,16 +783,18 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
} }
if (start_pos < inode->i_size) { if (start_pos < inode->i_size) {
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
lock_extent(&BTRFS_I(inode)->io_tree, lock_extent_bits(&BTRFS_I(inode)->io_tree,
start_pos, last_pos - 1, GFP_NOFS); start_pos, last_pos - 1, 0, &cached_state,
GFP_NOFS);
ordered = btrfs_lookup_first_ordered_extent(inode, ordered = btrfs_lookup_first_ordered_extent(inode,
last_pos - 1); last_pos - 1);
if (ordered && if (ordered &&
ordered->file_offset + ordered->len > start_pos && ordered->file_offset + ordered->len > start_pos &&
ordered->file_offset < last_pos) { ordered->file_offset < last_pos) {
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
unlock_extent(&BTRFS_I(inode)->io_tree, unlock_extent_cached(&BTRFS_I(inode)->io_tree,
start_pos, last_pos - 1, GFP_NOFS); start_pos, last_pos - 1,
&cached_state, GFP_NOFS);
for (i = 0; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
unlock_page(pages[i]); unlock_page(pages[i]);
page_cache_release(pages[i]); page_cache_release(pages[i]);
...@@ -802,12 +806,13 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, ...@@ -802,12 +806,13 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
if (ordered) if (ordered)
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
clear_extent_bits(&BTRFS_I(inode)->io_tree, start_pos, clear_extent_bit(&BTRFS_I(inode)->io_tree, start_pos,
last_pos - 1, EXTENT_DIRTY | EXTENT_DELALLOC | last_pos - 1, EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING, EXTENT_DO_ACCOUNTING, 0, 0, &cached_state,
GFP_NOFS);
unlock_extent_cached(&BTRFS_I(inode)->io_tree,
start_pos, last_pos - 1, &cached_state,
GFP_NOFS); GFP_NOFS);
unlock_extent(&BTRFS_I(inode)->io_tree,
start_pos, last_pos - 1, GFP_NOFS);
} }
for (i = 0; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
clear_page_dirty_for_io(pages[i]); clear_page_dirty_for_io(pages[i]);
......
...@@ -1512,12 +1512,13 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, ...@@ -1512,12 +1512,13 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
return 0; return 0;
} }
int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end) int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
struct extent_state **cached_state)
{ {
if ((end & (PAGE_CACHE_SIZE - 1)) == 0) if ((end & (PAGE_CACHE_SIZE - 1)) == 0)
WARN_ON(1); WARN_ON(1);
return set_extent_delalloc(&BTRFS_I(inode)->io_tree, start, end, return set_extent_delalloc(&BTRFS_I(inode)->io_tree, start, end,
GFP_NOFS); cached_state, GFP_NOFS);
} }
/* see btrfs_writepage_start_hook for details on why this is required */ /* see btrfs_writepage_start_hook for details on why this is required */
...@@ -1530,6 +1531,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -1530,6 +1531,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
{ {
struct btrfs_writepage_fixup *fixup; struct btrfs_writepage_fixup *fixup;
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
struct extent_state *cached_state = NULL;
struct page *page; struct page *page;
struct inode *inode; struct inode *inode;
u64 page_start; u64 page_start;
...@@ -1548,7 +1550,8 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -1548,7 +1550,8 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
page_start = page_offset(page); page_start = page_offset(page);
page_end = page_offset(page) + PAGE_CACHE_SIZE - 1; page_end = page_offset(page) + PAGE_CACHE_SIZE - 1;
lock_extent(&BTRFS_I(inode)->io_tree, page_start, page_end, GFP_NOFS); lock_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, 0,
&cached_state, GFP_NOFS);
/* already ordered? We're done */ /* already ordered? We're done */
if (PagePrivate2(page)) if (PagePrivate2(page))
...@@ -1556,17 +1559,18 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -1556,17 +1559,18 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
ordered = btrfs_lookup_ordered_extent(inode, page_start); ordered = btrfs_lookup_ordered_extent(inode, page_start);
if (ordered) { if (ordered) {
unlock_extent(&BTRFS_I(inode)->io_tree, page_start, unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start,
page_end, GFP_NOFS); page_end, &cached_state, GFP_NOFS);
unlock_page(page); unlock_page(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(inode, ordered, 1);
goto again; goto again;
} }
btrfs_set_extent_delalloc(inode, page_start, page_end); btrfs_set_extent_delalloc(inode, page_start, page_end, &cached_state);
ClearPageChecked(page); ClearPageChecked(page);
out: out:
unlock_extent(&BTRFS_I(inode)->io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end,
&cached_state, GFP_NOFS);
out_page: out_page:
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
...@@ -1695,6 +1699,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) ...@@ -1695,6 +1699,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
struct btrfs_ordered_extent *ordered_extent = NULL; struct btrfs_ordered_extent *ordered_extent = NULL;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct extent_state *cached_state = NULL;
int compressed = 0; int compressed = 0;
int ret; int ret;
...@@ -1716,9 +1721,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) ...@@ -1716,9 +1721,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
goto out; goto out;
} }
lock_extent(io_tree, ordered_extent->file_offset, lock_extent_bits(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1, ordered_extent->file_offset + ordered_extent->len - 1,
GFP_NOFS); 0, &cached_state, GFP_NOFS);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root, 1);
...@@ -1745,9 +1750,10 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) ...@@ -1745,9 +1750,10 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
ordered_extent->len); ordered_extent->len);
BUG_ON(ret); BUG_ON(ret);
} }
unlock_extent(io_tree, ordered_extent->file_offset, unlock_extent_cached(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1, ordered_extent->file_offset +
GFP_NOFS); ordered_extent->len - 1, &cached_state, GFP_NOFS);
add_pending_csums(trans, inode, ordered_extent->file_offset, add_pending_csums(trans, inode, ordered_extent->file_offset,
&ordered_extent->list); &ordered_extent->list);
...@@ -3084,6 +3090,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from) ...@@ -3084,6 +3090,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
struct extent_state *cached_state = NULL;
char *kaddr; char *kaddr;
u32 blocksize = root->sectorsize; u32 blocksize = root->sectorsize;
pgoff_t index = from >> PAGE_CACHE_SHIFT; pgoff_t index = from >> PAGE_CACHE_SHIFT;
...@@ -3130,12 +3137,14 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from) ...@@ -3130,12 +3137,14 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
} }
wait_on_page_writeback(page); wait_on_page_writeback(page);
lock_extent(io_tree, page_start, page_end, GFP_NOFS); lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state,
GFP_NOFS);
set_page_extent_mapped(page); set_page_extent_mapped(page);
ordered = btrfs_lookup_ordered_extent(inode, page_start); ordered = btrfs_lookup_ordered_extent(inode, page_start);
if (ordered) { if (ordered) {
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(io_tree, page_start, page_end,
&cached_state, GFP_NOFS);
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(inode, ordered, 1);
...@@ -3143,13 +3152,15 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from) ...@@ -3143,13 +3152,15 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
goto again; goto again;
} }
clear_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, page_end,
EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING, EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING,
GFP_NOFS); 0, 0, &cached_state, GFP_NOFS);
ret = btrfs_set_extent_delalloc(inode, page_start, page_end); ret = btrfs_set_extent_delalloc(inode, page_start, page_end,
&cached_state);
if (ret) { if (ret) {
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(io_tree, page_start, page_end,
&cached_state, GFP_NOFS);
goto out_unlock; goto out_unlock;
} }
...@@ -3162,7 +3173,8 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from) ...@@ -3162,7 +3173,8 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
} }
ClearPageChecked(page); ClearPageChecked(page);
set_page_dirty(page); set_page_dirty(page);
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(io_tree, page_start, page_end, &cached_state,
GFP_NOFS);
out_unlock: out_unlock:
if (ret) if (ret)
...@@ -3180,6 +3192,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t size) ...@@ -3180,6 +3192,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct extent_map *em; struct extent_map *em;
struct extent_state *cached_state = NULL;
u64 mask = root->sectorsize - 1; u64 mask = root->sectorsize - 1;
u64 hole_start = (inode->i_size + mask) & ~mask; u64 hole_start = (inode->i_size + mask) & ~mask;
u64 block_end = (size + mask) & ~mask; u64 block_end = (size + mask) & ~mask;
...@@ -3195,11 +3208,13 @@ int btrfs_cont_expand(struct inode *inode, loff_t size) ...@@ -3195,11 +3208,13 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
btrfs_wait_ordered_range(inode, hole_start, btrfs_wait_ordered_range(inode, hole_start,
block_end - hole_start); block_end - hole_start);
lock_extent(io_tree, hole_start, block_end - 1, GFP_NOFS); lock_extent_bits(io_tree, hole_start, block_end - 1, 0,
&cached_state, GFP_NOFS);
ordered = btrfs_lookup_ordered_extent(inode, hole_start); ordered = btrfs_lookup_ordered_extent(inode, hole_start);
if (!ordered) if (!ordered)
break; break;
unlock_extent(io_tree, hole_start, block_end - 1, GFP_NOFS); unlock_extent_cached(io_tree, hole_start, block_end - 1,
&cached_state, GFP_NOFS);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
} }
...@@ -3244,7 +3259,8 @@ int btrfs_cont_expand(struct inode *inode, loff_t size) ...@@ -3244,7 +3259,8 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
break; break;
} }
unlock_extent(io_tree, hole_start, block_end - 1, GFP_NOFS); unlock_extent_cached(io_tree, hole_start, block_end - 1, &cached_state,
GFP_NOFS);
return err; return err;
} }
...@@ -4985,6 +5001,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) ...@@ -4985,6 +5001,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
{ {
struct extent_io_tree *tree; struct extent_io_tree *tree;
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
struct extent_state *cached_state = NULL;
u64 page_start = page_offset(page); u64 page_start = page_offset(page);
u64 page_end = page_start + PAGE_CACHE_SIZE - 1; u64 page_end = page_start + PAGE_CACHE_SIZE - 1;
...@@ -5003,7 +5020,8 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) ...@@ -5003,7 +5020,8 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
btrfs_releasepage(page, GFP_NOFS); btrfs_releasepage(page, GFP_NOFS);
return; return;
} }
lock_extent(tree, page_start, page_end, GFP_NOFS); lock_extent_bits(tree, page_start, page_end, 0, &cached_state,
GFP_NOFS);
ordered = btrfs_lookup_ordered_extent(page->mapping->host, ordered = btrfs_lookup_ordered_extent(page->mapping->host,
page_offset(page)); page_offset(page));
if (ordered) { if (ordered) {
...@@ -5014,7 +5032,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) ...@@ -5014,7 +5032,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
clear_extent_bit(tree, page_start, page_end, clear_extent_bit(tree, page_start, page_end,
EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_LOCKED | EXTENT_DO_ACCOUNTING, 1, 0, EXTENT_LOCKED | EXTENT_DO_ACCOUNTING, 1, 0,
NULL, GFP_NOFS); &cached_state, GFP_NOFS);
/* /*
* whoever cleared the private bit is responsible * whoever cleared the private bit is responsible
* for the finish_ordered_io * for the finish_ordered_io
...@@ -5024,11 +5042,13 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) ...@@ -5024,11 +5042,13 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
page_start, page_end); page_start, page_end);
} }
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
lock_extent(tree, page_start, page_end, GFP_NOFS); cached_state = NULL;
lock_extent_bits(tree, page_start, page_end, 0, &cached_state,
GFP_NOFS);
} }
clear_extent_bit(tree, page_start, page_end, clear_extent_bit(tree, page_start, page_end,
EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING, 1, 1, NULL, GFP_NOFS); EXTENT_DO_ACCOUNTING, 1, 1, &cached_state, GFP_NOFS);
__btrfs_releasepage(page, GFP_NOFS); __btrfs_releasepage(page, GFP_NOFS);
ClearPageChecked(page); ClearPageChecked(page);
...@@ -5061,6 +5081,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -5061,6 +5081,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
struct extent_state *cached_state = NULL;
char *kaddr; char *kaddr;
unsigned long zero_start; unsigned long zero_start;
loff_t size; loff_t size;
...@@ -5099,7 +5120,8 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -5099,7 +5120,8 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
} }
wait_on_page_writeback(page); wait_on_page_writeback(page);
lock_extent(io_tree, page_start, page_end, GFP_NOFS); lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state,
GFP_NOFS);
set_page_extent_mapped(page); set_page_extent_mapped(page);
/* /*
...@@ -5108,7 +5130,8 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -5108,7 +5130,8 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
*/ */
ordered = btrfs_lookup_ordered_extent(inode, page_start); ordered = btrfs_lookup_ordered_extent(inode, page_start);
if (ordered) { if (ordered) {
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(io_tree, page_start, page_end,
&cached_state, GFP_NOFS);
unlock_page(page); unlock_page(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(inode, ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
...@@ -5122,13 +5145,15 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -5122,13 +5145,15 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
* is probably a better way to do this, but for now keep consistent with * is probably a better way to do this, but for now keep consistent with
* prepare_pages in the normal write path. * prepare_pages in the normal write path.
*/ */
clear_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, page_end,
EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING, EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING,
GFP_NOFS); 0, 0, &cached_state, GFP_NOFS);
ret = btrfs_set_extent_delalloc(inode, page_start, page_end); ret = btrfs_set_extent_delalloc(inode, page_start, page_end,
&cached_state);
if (ret) { if (ret) {
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(io_tree, page_start, page_end,
&cached_state, GFP_NOFS);
ret = VM_FAULT_SIGBUS; ret = VM_FAULT_SIGBUS;
btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE); btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE);
goto out_unlock; goto out_unlock;
...@@ -5154,7 +5179,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -5154,7 +5179,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
BTRFS_I(inode)->last_trans = root->fs_info->generation; BTRFS_I(inode)->last_trans = root->fs_info->generation;
BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid;
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS);
out_unlock: out_unlock:
btrfs_unreserve_metadata_for_delalloc(root, inode, 1); btrfs_unreserve_metadata_for_delalloc(root, inode, 1);
...@@ -5833,6 +5858,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, ...@@ -5833,6 +5858,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
static long btrfs_fallocate(struct inode *inode, int mode, static long btrfs_fallocate(struct inode *inode, int mode,
loff_t offset, loff_t len) loff_t offset, loff_t len)
{ {
struct extent_state *cached_state = NULL;
u64 cur_offset; u64 cur_offset;
u64 last_byte; u64 last_byte;
u64 alloc_start; u64 alloc_start;
...@@ -5871,16 +5897,17 @@ static long btrfs_fallocate(struct inode *inode, int mode, ...@@ -5871,16 +5897,17 @@ static long btrfs_fallocate(struct inode *inode, int mode,
/* the extent lock is ordered inside the running /* the extent lock is ordered inside the running
* transaction * transaction
*/ */
lock_extent(&BTRFS_I(inode)->io_tree, alloc_start, locked_end, lock_extent_bits(&BTRFS_I(inode)->io_tree, alloc_start,
GFP_NOFS); locked_end, 0, &cached_state, GFP_NOFS);
ordered = btrfs_lookup_first_ordered_extent(inode, ordered = btrfs_lookup_first_ordered_extent(inode,
alloc_end - 1); alloc_end - 1);
if (ordered && if (ordered &&
ordered->file_offset + ordered->len > alloc_start && ordered->file_offset + ordered->len > alloc_start &&
ordered->file_offset < alloc_end) { ordered->file_offset < alloc_end) {
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
unlock_extent(&BTRFS_I(inode)->io_tree, unlock_extent_cached(&BTRFS_I(inode)->io_tree,
alloc_start, locked_end, GFP_NOFS); alloc_start, locked_end,
&cached_state, GFP_NOFS);
/* /*
* we can't wait on the range with the transaction * we can't wait on the range with the transaction
* running or with the extent lock held * running or with the extent lock held
...@@ -5922,8 +5949,8 @@ static long btrfs_fallocate(struct inode *inode, int mode, ...@@ -5922,8 +5949,8 @@ static long btrfs_fallocate(struct inode *inode, int mode,
break; break;
} }
} }
unlock_extent(&BTRFS_I(inode)->io_tree, alloc_start, locked_end, unlock_extent_cached(&BTRFS_I(inode)->io_tree, alloc_start, locked_end,
GFP_NOFS); &cached_state, GFP_NOFS);
btrfs_free_reserved_data_space(BTRFS_I(inode)->root, inode, btrfs_free_reserved_data_space(BTRFS_I(inode)->root, inode,
alloc_end - alloc_start); alloc_end - alloc_start);
......
...@@ -673,7 +673,7 @@ static int btrfs_defrag_file(struct file *file, ...@@ -673,7 +673,7 @@ static int btrfs_defrag_file(struct file *file,
page_end, EXTENT_DIRTY | EXTENT_DELALLOC | page_end, EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING, GFP_NOFS); EXTENT_DO_ACCOUNTING, GFP_NOFS);
btrfs_set_extent_delalloc(inode, page_start, page_end); btrfs_set_extent_delalloc(inode, page_start, page_end, NULL);
ClearPageChecked(page); ClearPageChecked(page);
set_page_dirty(page); set_page_dirty(page);
unlock_extent(io_tree, page_start, page_end, GFP_NOFS); unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
......
...@@ -2659,7 +2659,7 @@ static int relocate_file_extent_cluster(struct inode *inode, ...@@ -2659,7 +2659,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
EXTENT_BOUNDARY, GFP_NOFS); EXTENT_BOUNDARY, GFP_NOFS);
nr++; nr++;
} }
btrfs_set_extent_delalloc(inode, page_start, page_end); btrfs_set_extent_delalloc(inode, page_start, page_end, NULL);
set_page_dirty(page); set_page_dirty(page);
dirty_page++; dirty_page++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment