Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274681
b: refs/heads/master
c: 01d658f
h: refs/heads/master
i:
  274679: 1f65418
v: v3
  • Loading branch information
Chris Mason committed Nov 6, 2011
1 parent 3ee7cf4 commit e3355df
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e688b7252f784c2479d559f9f70ca8354752c5e7
refs/heads/master: 01d658f2ca3c85c1ffb20b306e30d16197000ce7
13 changes: 10 additions & 3 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2735,7 +2735,8 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)
return ret;
}

int btree_lock_page_hook(struct page *page)
static int btree_lock_page_hook(struct page *page, void *data,
void (*flush_fn)(void *))
{
struct inode *inode = page->mapping->host;
struct btrfs_root *root = BTRFS_I(inode)->root;
Expand All @@ -2752,7 +2753,10 @@ int btree_lock_page_hook(struct page *page)
if (!eb)
goto out;

btrfs_tree_lock(eb);
if (!btrfs_try_tree_write_lock(eb)) {
flush_fn(data);
btrfs_tree_lock(eb);
}
btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);

if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &eb->bflags)) {
Expand All @@ -2767,7 +2771,10 @@ int btree_lock_page_hook(struct page *page)
btrfs_tree_unlock(eb);
free_extent_buffer(eb);
out:
lock_page(page);
if (!trylock_page(page)) {
flush_fn(data);
lock_page(page);
}
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions trunk/fs/btrfs/disk-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info);
int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
int btree_lock_page_hook(struct page *page);


#ifdef CONFIG_DEBUG_LOCK_ALLOC
void btrfs_init_lockdep(void);
Expand Down
14 changes: 10 additions & 4 deletions trunk/fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2613,10 +2613,16 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
* swizzled back from swapper_space to tmpfs file
* mapping
*/
if (tree->ops && tree->ops->write_cache_pages_lock_hook)
tree->ops->write_cache_pages_lock_hook(page);
else
lock_page(page);
if (tree->ops &&
tree->ops->write_cache_pages_lock_hook) {
tree->ops->write_cache_pages_lock_hook(page,
data, flush_fn);
} else {
if (!trylock_page(page)) {
flush_fn(data);
lock_page(page);
}
}

if (unlikely(page->mapping != mapping)) {
unlock_page(page);
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/btrfs/extent_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ struct extent_io_ops {
struct extent_state *other);
void (*split_extent_hook)(struct inode *inode,
struct extent_state *orig, u64 split);
int (*write_cache_pages_lock_hook)(struct page *page);
int (*write_cache_pages_lock_hook)(struct page *page, void *data,
void (*flush_fn)(void *));
};

struct extent_io_tree {
Expand Down

0 comments on commit e3355df

Please sign in to comment.