On Wed, May 12, 2021 at 06:02:04PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > 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@xxxxxxxxxx> 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; >