Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/4] Btrfs: remove no longer needed range length checks for deduplication
Date: Thu, 13 Dec 2018 14:20:16 +0200
Message-ID: <889d40aa-e517-6e33-875c-e7aba4764440@suse.com> (raw)
In-Reply-To: <20181212180559.15249-5-fdmanana@kernel.org>



On 12.12.18 г. 20:05 ч., fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Comparing the content of the pages in the range to deduplicate is now done
> by the generic helper generic_remap_file_range_prep(), which takes care of

very minor nit: the checks are performed in generic_remap_checks which
is called by generic_remap_file_range_prep. But even without this change
LGTM.

> ensuring we do not compare/deduplicate undefined data beyond a file's eof
> (range from eof to the next block boundary). So remove these checks which
> are now redundant.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
>  fs/btrfs/ioctl.c | 19 ++-----------------
>  1 file changed, 2 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 4e9efc93340e..3a27efa2b955 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -3206,31 +3206,16 @@ static void btrfs_double_inode_lock(struct inode *inode1, struct inode *inode2)
>  	inode_lock_nested(inode2, I_MUTEX_CHILD);
>  }
>  
> -static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen,
> +static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 len,
>  				   struct inode *dst, u64 dst_loff)
>  {
> -	u64 bs = BTRFS_I(src)->root->fs_info->sb->s_blocksize;
>  	int ret;
> -	u64 len = olen;
> -
> -	if (loff + len == src->i_size)
> -		len = ALIGN(src->i_size, bs) - loff;
> -	/*
> -	 * For same inode case we don't want our length pushed out past i_size
> -	 * as comparing that data range makes no sense.
> -	 *
> -	 * This effectively means we require aligned extents for the single
> -	 * inode case, whereas the other cases allow an unaligned length so long
> -	 * as it ends at i_size.
> -	 */
> -	if (dst == src && len != olen)
> -		return -EINVAL;
>  
>  	/*
>  	 * Lock destination range to serialize with concurrent readpages().
>  	 */
>  	lock_extent(&BTRFS_I(dst)->io_tree, dst_loff, dst_loff + len - 1);
> -	ret = btrfs_clone(src, dst, loff, olen, len, dst_loff, 1);
> +	ret = btrfs_clone(src, dst, loff, len, len, dst_loff, 1);
>  	unlock_extent(&BTRFS_I(dst)->io_tree, dst_loff, dst_loff + len - 1);
>  
>  	return ret;
> 

  reply index

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 18:05 [PATCH 0/4] Btrfs: a few more cleanups and fixes for clone/deduplication fdmanana
2018-12-12 18:05 ` [PATCH 1/4] Btrfs: move duplicated nodatasum check into common reflink/dedupe helper fdmanana
2019-01-11 14:55   ` David Sterba
2018-12-12 18:05 ` [PATCH 2/4] Btrfs: use cross mount point check for cloning and deduplication fdmanana
2018-12-13 16:02   ` David Sterba
2019-01-11 14:38     ` David Sterba
2018-12-12 18:05 ` [PATCH 3/4] Btrfs: check if destination root is read-only for deduplication fdmanana
2018-12-13 16:07   ` David Sterba
2019-01-31 16:39     ` Filipe Manana
2019-01-31 16:44       ` Hugo Mills
2019-02-18 15:38         ` David Sterba
2019-02-18 16:55           ` Filipe Manana
2019-02-12 17:59       ` Filipe Manana
2019-02-20 16:41       ` Zygo Blaxell
2019-02-20 16:54         ` Filipe Manana
2019-02-20 17:17           ` Zygo Blaxell
2019-02-22 11:13             ` Filipe Manana
2019-02-22 17:25               ` David Sterba
2019-02-21 16:54           ` Zygo Blaxell
2019-02-18 16:01   ` David Sterba
2018-12-12 18:05 ` [PATCH 4/4] Btrfs: remove no longer needed range length checks " fdmanana
2018-12-13 12:20   ` Nikolay Borisov [this message]
2019-01-31 16:31   ` Filipe Manana
2019-02-12 17:58     ` Filipe Manana
2019-02-18 15:10     ` David Sterba
2018-12-13 12:19 ` [PATCH 0/4] Btrfs: a few more cleanups and fixes for clone/deduplication Nikolay Borisov

Reply instructions:

You may reply publically 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=889d40aa-e517-6e33-875c-e7aba4764440@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

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox