public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: always swap the cow forks when swapping extents
Date: Mon, 25 Sep 2017 07:33:21 -0400	[thread overview]
Message-ID: <20170925113321.GB12869@bfoster.bfoster> (raw)
In-Reply-To: <20170923071208.GN5728@magnolia>

On Sat, Sep 23, 2017 at 12:12:08AM -0700, Darrick J. Wong wrote:
> Since the CoW fork exists as a secondary data structure to the data
> fork, we must always swap cow forks during swapext.  We also need to
> swap the extent counts and reset the cowblocks tags.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_bmap_util.c |   24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index bc6c6e1..e9db7fc 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -2122,11 +2122,31 @@ xfs_swap_extents(
>  		ip->i_d.di_flags2 |= tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
>  		tip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
>  		tip->i_d.di_flags2 |= f & XFS_DIFLAG2_REFLINK;
> +	}
> +
> +	/* Swap the cow forks. */
> +	if (xfs_sb_version_hasreflink(&mp->m_sb)) {
> +		xfs_extnum_t	extnum;
> +
> +		ASSERT(ip->i_cformat == XFS_DINODE_FMT_EXTENTS);
> +		ASSERT(tip->i_cformat == XFS_DINODE_FMT_EXTENTS);
> +
> +		extnum = ip->i_cnextents;
> +		ip->i_cnextents = tip->i_cnextents;
> +		tip->i_cnextents = extnum;
> +
>  		cowfp = ip->i_cowfp;
>  		ip->i_cowfp = tip->i_cowfp;
>  		tip->i_cowfp = cowfp;
> -		xfs_inode_set_cowblocks_tag(ip);
> -		xfs_inode_set_cowblocks_tag(tip);
> +
> +		if (ip->i_cowfp && ip->i_cnextents)
> +			xfs_inode_set_cowblocks_tag(ip);
> +		else
> +			xfs_inode_clear_cowblocks_tag(ip);
> +		if (tip->i_cowfp && tip->i_cnextents)
> +			xfs_inode_set_cowblocks_tag(tip);
> +		else
> +			xfs_inode_clear_cowblocks_tag(tip);
>  	}
>  
>  	xfs_trans_log_inode(tp, ip,  src_log_flags);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-09-25 11:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-23  7:12 [PATCH] xfs: always swap the cow forks when swapping extents Darrick J. Wong
2017-09-25 11:33 ` Brian Foster [this message]
2017-09-26 14:44 ` Christoph Hellwig
2017-09-26 16:01   ` Darrick J. Wong

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=20170925113321.GB12869@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@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