]> Pileus Git - ~andy/linux/blobdiff - fs/btrfs/compression.c
btrfs: Introduce extent_read_full_page_nolock()
[~andy/linux] / fs / btrfs / compression.c
index b189bd1e7a3e45bf92002e35c8db525886c7593d..37dff5b2d56dcb0e57511337796d3ed200285bdb 100644 (file)
@@ -639,7 +639,11 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
        faili = nr_pages - 1;
        cb->nr_pages = nr_pages;
 
-       add_ra_bio_pages(inode, em_start + em_len, cb);
+       /* In the parent-locked case, we only locked the range we are
+        * interested in.  In all other cases, we can opportunistically
+        * cache decompressed data that goes beyond the requested range. */
+       if (!(bio_flags & EXTENT_BIO_PARENT_LOCKED))
+               add_ra_bio_pages(inode, em_start + em_len, cb);
 
        /* include any pages we added in add_ra-bio_pages */
        uncompressed_len = bio->bi_vcnt * PAGE_CACHE_SIZE;