Re: [PATCH v5 3/3] btrfs: refactor btrfs_check_can_nocow() into two variants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 24, 2020 at 07:23:52AM +0800, Qu Wenruo wrote:
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 339d739b2d29..3e2596f2ab74 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4541,10 +4541,8 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
>  	ret = btrfs_check_data_free_space(inode, &data_reserved, block_start,
>  					  blocksize);
>  	if (ret < 0) {
> -		if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW |
> -					      BTRFS_INODE_PREALLOC)) &&
> -		    btrfs_check_can_nocow(BTRFS_I(inode), block_start,
> -					  &write_bytes, false) > 0) {
> +		if (btrfs_check_nocow_lock(BTRFS_I(inode), block_start,
> +					   &write_bytes) > 0) {
>  			/* For nocow case, no need to reserve data space. */
>  			only_release_metadata = true;
>  		} else {

I don't see the pairing btrfs_check_nocow_unlock in this function,
there's still the btrfs_drew_write_unlock.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux