btrfs: Convert page cache to XArray
authorMatthew Wilcox <willy@infradead.org>
Mon, 4 Dec 2017 15:37:22 +0000 (10:37 -0500)
committerMatthew Wilcox <willy@infradead.org>
Sun, 21 Oct 2018 14:46:41 +0000 (10:46 -0400)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Acked-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/extent_io.c

index fd25e12..a65d144 100644 (file)
@@ -437,9 +437,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
                if (pg_index > end_index)
                        break;
 
-               rcu_read_lock();
-               page = radix_tree_lookup(&mapping->i_pages, pg_index);
-               rcu_read_unlock();
+               page = xa_load(&mapping->i_pages, pg_index);
                if (page && !xa_is_value(page)) {
                        misses++;
                        if (misses > 4)
index fc7ca7d..d4ad015 100644 (file)
@@ -5153,11 +5153,9 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb)
 
                clear_page_dirty_for_io(page);
                xa_lock_irq(&page->mapping->i_pages);
-               if (!PageDirty(page)) {
-                       radix_tree_tag_clear(&page->mapping->i_pages,
-                                               page_index(page),
-                                               PAGECACHE_TAG_DIRTY);
-               }
+               if (!PageDirty(page))
+                       __xa_clear_mark(&page->mapping->i_pages,
+                                       page_index(page), PAGECACHE_TAG_DIRTY);
                xa_unlock_irq(&page->mapping->i_pages);
                ClearPageError(page);
                unlock_page(page);