linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] Btrfs: add support for fallocate's zero range operation
Date: Thu, 2 Nov 2017 10:33:59 +0200	[thread overview]
Message-ID: <fcf6ffd1-1126-c7a2-23a5-2e2160d12777@suse.com> (raw)
In-Reply-To: <20171025145908.7311-1-fdmanana@kernel.org>



On 25.10.2017 17:59, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> This implements support the zero range operation of fallocate. For now
> at least it's as simple as possible while reusing most of the existing
> fallocate and hole punching infrastructure.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> 
> V2: Removed double inode unlock on error path from failure to lock range.
> 
>  fs/btrfs/file.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 290 insertions(+), 42 deletions(-)
> 
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index aafcc785f840..e0d15c0d1641 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -2448,7 +2448,48 @@ static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len)
>  	return ret;
>  }
>  

<snip>

>  
> +static int btrfs_zero_range_update_isize(struct inode *inode,
> +					 const loff_t offset,
> +					 const loff_t len,
> +					 const int mode)
> +{
> +	struct btrfs_root *root = BTRFS_I(inode)->root;
> +	struct btrfs_trans_handle *trans;
> +	const u64 end = offset + len;
> +	int ret;
> +
> +	if (mode & FALLOC_FL_KEEP_SIZE || end <= i_size_read(inode))
> +		return 0;
> +

Don't we also want to add inode->i_ctime = current_time(inode) similar
to what we have when updating the isize at the end of btrfs_fallocate
and __btrfs_prealloc_file_range


Also this function is very similarto the code right before the
'out_unlock' label in btrfs_fallocate. Perhaps this function could be
named btrfs_update_isize and used there as well?

<snip>

  parent reply	other threads:[~2017-11-02  8:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 12:53 [PATCH] Btrfs: add support for fallocate's zero range operation fdmanana
2017-10-25 14:59 ` [PATCH v2] " fdmanana
2017-10-30 14:57   ` David Sterba
2017-11-01 10:34   ` Nikolay Borisov
2017-11-01 10:59     ` Filipe Manana
2017-11-02  8:33   ` Nikolay Borisov [this message]
2017-11-03  9:30   ` Nikolay Borisov
2017-11-03 10:29     ` Filipe Manana
2017-11-03 10:45       ` Filipe Manana
2017-11-03 17:20 ` [PATCH v3] " fdmanana
2017-11-03 20:59   ` Edmund Nadolski
2017-11-04  4:07   ` [PATCH v4] " fdmanana
2017-11-10 16:43     ` Nikolay Borisov
2018-01-05 16:49     ` David Sterba

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=fcf6ffd1-1126-c7a2-23a5-2e2160d12777@suse.com \
    --to=nborisov@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).