aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent_io.c11
-rw-r--r--fs/btrfs/file.c5
2 files changed, 9 insertions, 7 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index f29a54e454d4..4cd0ac983f91 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4510,7 +4510,8 @@ static void check_buffer_tree_ref(struct extent_buffer *eb)
4510 spin_unlock(&eb->refs_lock); 4510 spin_unlock(&eb->refs_lock);
4511} 4511}
4512 4512
4513static void mark_extent_buffer_accessed(struct extent_buffer *eb) 4513static void mark_extent_buffer_accessed(struct extent_buffer *eb,
4514 struct page *accessed)
4514{ 4515{
4515 unsigned long num_pages, i; 4516 unsigned long num_pages, i;
4516 4517
@@ -4519,7 +4520,8 @@ static void mark_extent_buffer_accessed(struct extent_buffer *eb)
4519 num_pages = num_extent_pages(eb->start, eb->len); 4520 num_pages = num_extent_pages(eb->start, eb->len);
4520 for (i = 0; i < num_pages; i++) { 4521 for (i = 0; i < num_pages; i++) {
4521 struct page *p = extent_buffer_page(eb, i); 4522 struct page *p = extent_buffer_page(eb, i);
4522 mark_page_accessed(p); 4523 if (p != accessed)
4524 mark_page_accessed(p);
4523 } 4525 }
4524} 4526}
4525 4527
@@ -4533,7 +4535,7 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,
4533 start >> PAGE_CACHE_SHIFT); 4535 start >> PAGE_CACHE_SHIFT);
4534 if (eb && atomic_inc_not_zero(&eb->refs)) { 4536 if (eb && atomic_inc_not_zero(&eb->refs)) {
4535 rcu_read_unlock(); 4537 rcu_read_unlock();
4536 mark_extent_buffer_accessed(eb); 4538 mark_extent_buffer_accessed(eb, NULL);
4537 return eb; 4539 return eb;
4538 } 4540 }
4539 rcu_read_unlock(); 4541 rcu_read_unlock();
@@ -4581,7 +4583,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
4581 spin_unlock(&mapping->private_lock); 4583 spin_unlock(&mapping->private_lock);
4582 unlock_page(p); 4584 unlock_page(p);
4583 page_cache_release(p); 4585 page_cache_release(p);
4584 mark_extent_buffer_accessed(exists); 4586 mark_extent_buffer_accessed(exists, p);
4585 goto free_eb; 4587 goto free_eb;
4586 } 4588 }
4587 4589
@@ -4596,7 +4598,6 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
4596 attach_extent_buffer_page(eb, p); 4598 attach_extent_buffer_page(eb, p);
4597 spin_unlock(&mapping->private_lock); 4599 spin_unlock(&mapping->private_lock);
4598 WARN_ON(PageDirty(p)); 4600 WARN_ON(PageDirty(p));
4599 mark_page_accessed(p);
4600 eb->pages[i] = p; 4601 eb->pages[i] = p;
4601 if (!PageUptodate(p)) 4602 if (!PageUptodate(p))
4602 uptodate = 0; 4603 uptodate = 0;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index ae6af072b635..74272a3f9d9b 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -470,11 +470,12 @@ static void btrfs_drop_pages(struct page **pages, size_t num_pages)
470 for (i = 0; i < num_pages; i++) { 470 for (i = 0; i < num_pages; i++) {
471 /* page checked is some magic around finding pages that 471 /* page checked is some magic around finding pages that
472 * have been modified without going through btrfs_set_page_dirty 472 * have been modified without going through btrfs_set_page_dirty
473 * clear it here 473 * clear it here. There should be no need to mark the pages
474 * accessed as prepare_pages should have marked them accessed
475 * in prepare_pages via find_or_create_page()
474 */ 476 */
475 ClearPageChecked(pages[i]); 477 ClearPageChecked(pages[i]);
476 unlock_page(pages[i]); 478 unlock_page(pages[i]);
477 mark_page_accessed(pages[i]);
478 page_cache_release(pages[i]); 479 page_cache_release(pages[i]);
479 } 480 }
480} 481}