mirror of https://gitee.com/openkylin/linux.git
for-5.3-rc1-tag
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE8rQSAMVO+zA4DBdWxWXV+ddtWDsFAl01plkACgkQxWXV+ddt WDtdmQ/7B4dLmod95cUIY6vhkmlZ3joVEPCCacSj1i1VXFP+QxDgHmmGXQQ0gTuP fJ0oe1gae5wFGnSZTVJ1WADkVeHqg3rZenSZaBNgLnNORwRVJUpgUchuvd+3L9z6 G0W7CU4bTX99eAERKHAy2uZ3t8bihmKySnZ79gkkfNTN0sV+yq68+5nQLMghGjwM svutFEEKOenkXaV24a9cffcxcQliRMVjjHojHNqA5l6QJJpjM4ZKy7KPxvOkmeFx VTko8E33kMO4TvipwrdZ7wD1E/mdMoUDe3dh1oJDL6h1DFlhvr/DhdYOx2cXq/0O 3zlAL8AEWPZp2gPeRgpmydvuVLdUkgd54yvbROYYpo0GcQgINSxW6VJ+wpHOMdhA dmfE0NzNhLMklfJFhCL5l6GFrsdXXl1zzaVcYanZly4HY60RNu4N3rG0YE1gHKvO biioerrMR9/+r0ZZh9RLcw0pnvVlx2VlD9lbE7QtoeJvQX6l3yQ2r/MFvNlluGiU 9z21wqtQf9aDnSETvvec0JM3eOgDe6PnjINxj/zUzUY1qoc/ESuSqf9i6AJ3/ix7 L9cevq/+hMARPAqILbtKWZWI/gqtKX22DckUIHcvqYdkG4zJW3e+PworBbsTI6Lb 4QpEHW++dzctc/sdgoEBnwFgewXGtZnSHSCL88y3Zxt0suqwixY= =6yeW -----END PGP SIGNATURE----- Merge tag 'for-5.3-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux Pull btrfs fixes from David Sterba: - fixes for leaks caused by recently merged patches - one build fix - a fix to prevent mixing of incompatible features * tag 'for-5.3-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: don't leak extent_map in btrfs_get_io_geometry() btrfs: free checksum hash on in close_ctree btrfs: Fix build error while LIBCRC32C is module btrfs: inode: Don't compress if NODATASUM or NODATACOW set
This commit is contained in:
commit
21c730d734
|
@ -4,6 +4,7 @@ config BTRFS_FS
|
|||
tristate "Btrfs filesystem support"
|
||||
select CRYPTO
|
||||
select CRYPTO_CRC32C
|
||||
select LIBCRC32C
|
||||
select ZLIB_INFLATE
|
||||
select ZLIB_DEFLATE
|
||||
select LZO_COMPRESS
|
||||
|
|
|
@ -4106,6 +4106,7 @@ void close_ctree(struct btrfs_fs_info *fs_info)
|
|||
percpu_counter_destroy(&fs_info->dev_replace.bio_counter);
|
||||
cleanup_srcu_struct(&fs_info->subvol_srcu);
|
||||
|
||||
btrfs_free_csum_hash(fs_info);
|
||||
btrfs_free_stripe_hash_table(fs_info);
|
||||
btrfs_free_ref_cache(fs_info);
|
||||
}
|
||||
|
|
|
@ -395,10 +395,31 @@ static noinline int add_async_extent(struct async_chunk *cow,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the inode has flags compatible with compression
|
||||
*/
|
||||
static inline bool inode_can_compress(struct inode *inode)
|
||||
{
|
||||
if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW ||
|
||||
BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the inode needs to be submitted to compression, based on mount
|
||||
* options, defragmentation, properties or heuristics.
|
||||
*/
|
||||
static inline int inode_need_compress(struct inode *inode, u64 start, u64 end)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
|
||||
if (!inode_can_compress(inode)) {
|
||||
WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
|
||||
KERN_ERR "BTRFS: unexpected compression for ino %llu\n",
|
||||
btrfs_ino(BTRFS_I(inode)));
|
||||
return 0;
|
||||
}
|
||||
/* force compress */
|
||||
if (btrfs_test_opt(fs_info, FORCE_COMPRESS))
|
||||
return 1;
|
||||
|
@ -1631,7 +1652,8 @@ int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
|
|||
} else if (BTRFS_I(inode)->flags & BTRFS_INODE_PREALLOC && !force_cow) {
|
||||
ret = run_delalloc_nocow(inode, locked_page, start, end,
|
||||
page_started, 0, nr_written);
|
||||
} else if (!inode_need_compress(inode, start, end)) {
|
||||
} else if (!inode_can_compress(inode) ||
|
||||
!inode_need_compress(inode, start, end)) {
|
||||
ret = cow_file_range(inode, locked_page, start, end, end,
|
||||
page_started, nr_written, 1, NULL);
|
||||
} else {
|
||||
|
|
|
@ -5941,6 +5941,7 @@ int btrfs_get_io_geometry(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
|
|||
u64 stripe_len;
|
||||
u64 raid56_full_stripe_start = (u64)-1;
|
||||
int data_stripes;
|
||||
int ret = 0;
|
||||
|
||||
ASSERT(op != BTRFS_MAP_DISCARD);
|
||||
|
||||
|
@ -5961,8 +5962,8 @@ int btrfs_get_io_geometry(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
|
|||
btrfs_crit(fs_info,
|
||||
"stripe math has gone wrong, stripe_offset=%llu offset=%llu start=%llu logical=%llu stripe_len=%llu",
|
||||
stripe_offset, offset, em->start, logical, stripe_len);
|
||||
free_extent_map(em);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* stripe_offset is the offset of this block in its stripe */
|
||||
|
@ -6009,7 +6010,10 @@ int btrfs_get_io_geometry(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
|
|||
io_geom->stripe_offset = stripe_offset;
|
||||
io_geom->raid56_stripe_offset = raid56_full_stripe_start;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
/* once for us */
|
||||
free_extent_map(em);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
|
||||
|
|
Loading…
Reference in New Issue