On Sun, Aug 15, 2021 at 11:05 PM Shiyang Ruan <ruansy.fnst@xxxxxxxxxxx> wrote: > > Introduce xfs_mmaplock_two_inodes_and_break_dax_layout() for dax files > who are going to be deduped. After that, call compare range function > only when files are both DAX or not. > > Signed-off-by: Shiyang Ruan <ruansy.fnst@xxxxxxxxxxx> > Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > fs/xfs/xfs_file.c | 2 +- > fs/xfs/xfs_inode.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ > fs/xfs/xfs_inode.h | 1 + > fs/xfs/xfs_reflink.c | 4 ++-- > 4 files changed, 61 insertions(+), 3 deletions(-) [..] > diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c > index 13e461cf2055..86c737c2baeb 100644 > --- a/fs/xfs/xfs_reflink.c > +++ b/fs/xfs/xfs_reflink.c > @@ -1327,8 +1327,8 @@ xfs_reflink_remap_prep( > if (XFS_IS_REALTIME_INODE(src) || XFS_IS_REALTIME_INODE(dest)) > goto out_unlock; > > - /* Don't share DAX file data for now. */ > - if (IS_DAX(inode_in) || IS_DAX(inode_out)) > + /* Don't share DAX file data with non-DAX file. */ > + if (IS_DAX(inode_in) != IS_DAX(inode_out)) > goto out_unlock; What if you have 2 DAX inodes sharing data and one is flipped to non-DAX? Does that operation need to first go undo all sharing?