Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297847
b: refs/heads/master
c: 5df4235
h: refs/heads/master
i:
  297845: 5981929
  297843: d693a44
  297839: b08c31d
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Mar 26, 2012
1 parent da38306 commit 7fb9b95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 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: 3083ee2e18b701122a3b841db83448543a87a583
refs/heads/master: 5df4235ea15bd39f441ef334d8329b3d46b2cc57
17 changes: 15 additions & 2 deletions trunk/fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3683,6 +3683,17 @@ static inline void btrfs_release_extent_buffer(struct extent_buffer *eb)
__free_extent_buffer(eb);
}

static void mark_extent_buffer_accessed(struct extent_buffer *eb)
{
unsigned long num_pages, i;

num_pages = num_extent_pages(eb->start, eb->len);
for (i = 0; i < num_pages; i++) {
struct page *p = extent_buffer_page(eb, i);
mark_page_accessed(p);
}
}

struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
u64 start, unsigned long len)
{
Expand All @@ -3700,7 +3711,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
eb = radix_tree_lookup(&tree->buffer, start >> PAGE_CACHE_SHIFT);
if (eb && atomic_inc_not_zero(&eb->refs)) {
rcu_read_unlock();
mark_page_accessed(eb->pages[0]);
mark_extent_buffer_accessed(eb);
return eb;
}
rcu_read_unlock();
Expand Down Expand Up @@ -3729,6 +3740,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
if (atomic_inc_not_zero(&exists->refs)) {
spin_unlock(&mapping->private_lock);
unlock_page(p);
mark_extent_buffer_accessed(exists);
goto free_eb;
}

Expand Down Expand Up @@ -3771,6 +3783,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
}
spin_unlock(&tree->buffer_lock);
radix_tree_preload_end();
mark_extent_buffer_accessed(exists);
goto free_eb;
}
/* add one reference for the tree */
Expand Down Expand Up @@ -3820,7 +3833,7 @@ struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree,
eb = radix_tree_lookup(&tree->buffer, start >> PAGE_CACHE_SHIFT);
if (eb && atomic_inc_not_zero(&eb->refs)) {
rcu_read_unlock();
mark_page_accessed(eb->pages[0]);
mark_extent_buffer_accessed(eb);
return eb;
}
rcu_read_unlock();
Expand Down

0 comments on commit 7fb9b95

Please sign in to comment.