diff options
author | Mark Fasheh <mfasheh@suse.de> | 2013-08-06 22:42:50 +0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 16:04:59 +0400 |
commit | 4b384318a74e38eb248f74f9a92a700d2ce841f1 (patch) | |
tree | 5ef01855a2824b7c832e9303a19cfb2527c9d08d /fs/btrfs/compression.c | |
parent | 32b7c687c52a0b78a7d41ce6423c2fd8f5ca92da (diff) | |
download | linux-4b384318a74e38eb248f74f9a92a700d2ce841f1.tar.xz |
btrfs: Introduce extent_read_full_page_nolock()
We want this for btrfs_extent_same. Basically readpage and friends do their
own extent locking but for the purposes of dedupe, we want to have both
files locked down across a set of readpage operations (so that we can
compare data). Introduce this variant and a flag which can be set for
extent_read_full_page() to indicate that we are already locked.
Partial credit for this patch goes to Gabriel de Perthuis <g2p.code@gmail.com>
as I have included a fix from him to the original patch which avoids a
deadlock on compressed extents.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index b189bd1e7a3e..37dff5b2d56d 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -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; |