Merge tag 'for-5.8-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-microblaze.git] / fs / btrfs / inode.c
index 11f81a1..43c803c 100644 (file)
@@ -4925,8 +4925,8 @@ static void evict_inode_truncate_pages(struct inode *inode)
 
        /*
         * Keep looping until we have no more ranges in the io tree.
-        * We can have ongoing bios started by readpages (called from readahead)
-        * that have their endio callback (extent_io.c:end_bio_extent_readpage)
+        * We can have ongoing bios started by readahead that have
+        * their endio callback (extent_io.c:end_bio_extent_readpage)
         * still in progress (unlocked the pages in the bio but did not yet
         * unlocked the ranges in the io tree). Therefore this means some
         * ranges can still be locked and eviction started because before
@@ -7121,11 +7121,11 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend,
                         * for it to complete) and then invalidate the pages for
                         * this range (through invalidate_inode_pages2_range()),
                         * but that can lead us to a deadlock with a concurrent
-                        * call to readpages() (a buffered read or a defrag call
+                        * call to readahead (a buffered read or a defrag call
                         * triggered a readahead) on a page lock due to an
                         * ordered dio extent we created before but did not have
                         * yet a corresponding bio submitted (whence it can not
-                        * complete), which makes readpages() wait for that
+                        * complete), which makes readahead wait for that
                         * ordered extent to complete while holding a lock on
                         * that page.
                         */
@@ -7945,14 +7945,12 @@ out:
        return ret;
 }
 
-#define BTRFS_FIEMAP_FLAGS     (FIEMAP_FLAG_SYNC)
-
 static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                __u64 start, __u64 len)
 {
        int     ret;
 
-       ret = fiemap_check_flags(fieinfo, BTRFS_FIEMAP_FLAGS);
+       ret = fiemap_prep(inode, fieinfo, start, &len, 0);
        if (ret)
                return ret;
 
@@ -7995,21 +7993,16 @@ static int btrfs_writepages(struct address_space *mapping,
        return extent_writepages(mapping, wbc);
 }
 
-static int
-btrfs_readpages(struct file *file, struct address_space *mapping,
-               struct list_head *pages, unsigned nr_pages)
+static void btrfs_readahead(struct readahead_control *rac)
 {
-       return extent_readpages(mapping, pages, nr_pages);
+       extent_readahead(rac);
 }
 
 static int __btrfs_releasepage(struct page *page, gfp_t gfp_flags)
 {
        int ret = try_release_extent_mapping(page, gfp_flags);
-       if (ret == 1) {
-               ClearPagePrivate(page);
-               set_page_private(page, 0);
-               put_page(page);
-       }
+       if (ret == 1)
+               detach_page_private(page);
        return ret;
 }
 
@@ -8031,14 +8024,8 @@ static int btrfs_migratepage(struct address_space *mapping,
        if (ret != MIGRATEPAGE_SUCCESS)
                return ret;
 
-       if (page_has_private(page)) {
-               ClearPagePrivate(page);
-               get_page(newpage);
-               set_page_private(newpage, page_private(page));
-               set_page_private(page, 0);
-               put_page(page);
-               SetPagePrivate(newpage);
-       }
+       if (page_has_private(page))
+               attach_page_private(newpage, detach_page_private(page));
 
        if (PagePrivate2(page)) {
                ClearPagePrivate2(page);
@@ -8160,11 +8147,7 @@ again:
        }
 
        ClearPageChecked(page);
-       if (PagePrivate(page)) {
-               ClearPagePrivate(page);
-               set_page_private(page, 0);
-               put_page(page);
-       }
+       detach_page_private(page);
 }
 
 /*
@@ -10255,7 +10238,7 @@ static const struct address_space_operations btrfs_aops = {
        .readpage       = btrfs_readpage,
        .writepage      = btrfs_writepage,
        .writepages     = btrfs_writepages,
-       .readpages      = btrfs_readpages,
+       .readahead      = btrfs_readahead,
        .direct_IO      = btrfs_direct_IO,
        .invalidatepage = btrfs_invalidatepage,
        .releasepage    = btrfs_releasepage,