mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 04:47:05 +00:00
btrfs: use a separate label for the incompressible case in compress_file_range
compress_file_range can fail to compress either because of resource or alignment constraints or because the data is incompressible. In the latter case the inode is marked so that compression isn't tried again. Currently that check is based on the condition that the pages array has been allocated which is rather cryptic. Use a separate label to clearly distinguish this case. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
6a7167bf9c
commit
184aa1ffa5
1 changed files with 5 additions and 8 deletions
|
@ -950,7 +950,7 @@ static void compress_file_range(struct btrfs_work *work)
|
|||
mapping, start, pages, &nr_pages, &total_in,
|
||||
&total_compressed);
|
||||
if (ret)
|
||||
goto cleanup_and_bail_uncompressed;
|
||||
goto mark_incompressible;
|
||||
|
||||
/*
|
||||
* Zero the tail end of the last page, as we might be sending it down
|
||||
|
@ -1026,7 +1026,7 @@ static void compress_file_range(struct btrfs_work *work)
|
|||
*/
|
||||
total_in = round_up(total_in, fs_info->sectorsize);
|
||||
if (total_compressed + blocksize > total_in)
|
||||
goto cleanup_and_bail_uncompressed;
|
||||
goto mark_incompressible;
|
||||
|
||||
/*
|
||||
* The async work queues will take care of doing actual allocation on
|
||||
|
@ -1041,6 +1041,9 @@ static void compress_file_range(struct btrfs_work *work)
|
|||
}
|
||||
return;
|
||||
|
||||
mark_incompressible:
|
||||
if (!btrfs_test_opt(fs_info, FORCE_COMPRESS) && !inode->prop_compress)
|
||||
inode->flags |= BTRFS_INODE_NOCOMPRESS;
|
||||
cleanup_and_bail_uncompressed:
|
||||
if (pages) {
|
||||
/*
|
||||
|
@ -1055,12 +1058,6 @@ static void compress_file_range(struct btrfs_work *work)
|
|||
pages = NULL;
|
||||
total_compressed = 0;
|
||||
nr_pages = 0;
|
||||
|
||||
/* flag the file so we don't compress in the future */
|
||||
if (!btrfs_test_opt(fs_info, FORCE_COMPRESS) &&
|
||||
!(inode->prop_compress)) {
|
||||
inode->flags |= BTRFS_INODE_NOCOMPRESS;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue