Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v5 3/3] btrfs: refactor btrfs_check_can_nocow() into two variants
Date: Fri, 26 Jun 2020 17:37:32 +0200	[thread overview]
Message-ID: <20200626153732.GH27795@twin.jikos.cz> (raw)
In-Reply-To: <20200623232352.668681-4-wqu@suse.com>

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.

      parent reply	other threads:[~2020-06-26 15:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 23:23 [PATCH v5 0/3] btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservation Qu Wenruo
2020-06-23 23:23 ` [PATCH v5 1/3] " Qu Wenruo
2020-06-24  8:22   ` Anand Jain
2020-06-23 23:23 ` [PATCH v5 2/3] btrfs: add comments for btrfs_check_can_nocow() and can_nocow_extent() Qu Wenruo
2020-06-23 23:23 ` [PATCH v5 3/3] btrfs: refactor btrfs_check_can_nocow() into two variants Qu Wenruo
2020-06-24  4:38   ` Anand Jain
2020-06-26 15:37   ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200626153732.GH27795@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox