public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] xfs: apply rt extent alignment constraints to cow extsize hint
Date: Fri, 14 May 2021 10:24:35 -0700	[thread overview]
Message-ID: <20210514172435.GM9675@magnolia> (raw)
In-Reply-To: <162086772452.3685783.890036737343315171.stgit@magnolia>

On Wed, May 12, 2021 at 06:02:04PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Even though reflink and copy-on-write aren't supported on the realtime
> volume, if we ever turn that on, we'd still be constrained to the same
> rt extent alignment requirements because cow involves remapping, and
> we can only allocate and free in rtextsize units on the realtime volume.
> 
> At the moment there aren't any filesystems with rt and reflink in the
> wild, so this is should be a zero-risk change.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Self NAK; one cannot set a nonzero cowextsize hint on a non-reflink
filesystem, and outside of djwong-dev, reflink on realtime isn't
supported either.  I guess I got too enthusiastic when I was
redistributing patches. :(

--D

> ---
>  fs/xfs/libxfs/xfs_inode_buf.c |   13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
> index 25261dd73290..704faf806e46 100644
> --- a/fs/xfs/libxfs/xfs_inode_buf.c
> +++ b/fs/xfs/libxfs/xfs_inode_buf.c
> @@ -628,14 +628,21 @@ xfs_inode_validate_cowextsize(
>  	uint16_t			flags,
>  	uint64_t			flags2)
>  {
> -	bool				rt_flag;
> +	bool				rt_flag, rtinherit_flag;
>  	bool				hint_flag;
>  	uint32_t			cowextsize_bytes;
> +	uint32_t			blocksize_bytes;
>  
>  	rt_flag = (flags & XFS_DIFLAG_REALTIME);
> +	rtinherit_flag = (flags & XFS_DIFLAG_RTINHERIT);
>  	hint_flag = (flags2 & XFS_DIFLAG2_COWEXTSIZE);
>  	cowextsize_bytes = XFS_FSB_TO_B(mp, cowextsize);
>  
> +	if (rt_flag || (rtinherit_flag && hint_flag))
> +		blocksize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
> +	else
> +		blocksize_bytes = mp->m_sb.sb_blocksize;
> +
>  	if (hint_flag && !xfs_sb_version_hasreflink(&mp->m_sb))
>  		return __this_address;
>  
> @@ -652,13 +659,13 @@ xfs_inode_validate_cowextsize(
>  	if (hint_flag && rt_flag)
>  		return __this_address;
>  
> -	if (cowextsize_bytes % mp->m_sb.sb_blocksize)
> +	if (cowextsize_bytes % blocksize_bytes)
>  		return __this_address;
>  
>  	if (cowextsize > MAXEXTLEN)
>  		return __this_address;
>  
> -	if (cowextsize > mp->m_sb.sb_agblocks / 2)
> +	if (!rt_flag && cowextsize > mp->m_sb.sb_agblocks / 2)
>  		return __this_address;
>  
>  	return NULL;
> 

      reply	other threads:[~2021-05-14 17:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  1:01 [PATCHSET 0/4] xfs: strengthen validation of extent size hints Darrick J. Wong
2021-05-13  1:01 ` [PATCH 1/4] xfs: standardize extent size hint validation Darrick J. Wong
2021-05-14 12:38   ` Brian Foster
2021-05-13  1:01 ` [PATCH 2/4] xfs: don't propagate invalid extent size hints to new files Darrick J. Wong
2021-05-14 12:38   ` Brian Foster
2021-05-14 15:55     ` Darrick J. Wong
2021-05-13  1:01 ` [PATCH 3/4] xfs: validate extsz hints against rt extent size when rtinherit is set Darrick J. Wong
2021-05-14 12:38   ` Brian Foster
2021-05-14 18:22     ` Darrick J. Wong
2021-05-14 18:51       ` Brian Foster
2021-05-14 20:30         ` Darrick J. Wong
2021-05-13  1:02 ` [PATCH 4/4] xfs: apply rt extent alignment constraints to cow extsize hint Darrick J. Wong
2021-05-14 17:24   ` Darrick J. Wong [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=20210514172435.GM9675@magnolia \
    --to=djwong@kernel.org \
    --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