xfs
[Top] [All Lists]

[PATCH 24/24] xfs: recognize the reflink feature bit

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 24/24] xfs: recognize the reflink feature bit
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Wed, 29 Jul 2015 15:35:31 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150729223258.17414.91354.stgit@xxxxxxxxxxxxxxxx>
References: <20150729223258.17414.91354.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
Add the reflink feature flag to the set of recognized feature flags.
This enables users to write to reflink filesystems.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_format.h |    3 ++-
 fs/xfs/libxfs/xfs_sb.c     |   10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)


diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index ec14477..c289c2e 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -449,7 +449,8 @@ xfs_sb_has_compat_feature(
 #define XFS_SB_FEAT_RO_COMPAT_REFLINK  (1 << 2)                /* reflinked 
files */
 #define XFS_SB_FEAT_RO_COMPAT_ALL \
                (XFS_SB_FEAT_RO_COMPAT_FINOBT | \
-                XFS_SB_FEAT_RO_COMPAT_RMAPBT)
+                XFS_SB_FEAT_RO_COMPAT_RMAPBT | \
+                XFS_SB_FEAT_RO_COMPAT_REFLINK)
 #define XFS_SB_FEAT_RO_COMPAT_UNKNOWN  ~XFS_SB_FEAT_RO_COMPAT_ALL
 static inline bool
 xfs_sb_has_ro_compat_feature(
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index a7dcbe0..f74287e 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -219,6 +219,16 @@ xfs_mount_validate_sb(
 "EXPERIMENTAL reverse mapping btree feature enabled. Use at your own risk!");
        }
 
+       if (xfs_sb_version_hasreflink(sbp)) {
+               xfs_alert(mp,
+"EXPERIMENTAL reflink feature enabled. Use at your own risk!");
+               if (xfs_sb_version_hasrmapbt(sbp)) {
+                       printk(KERN_ERR
+"EXPERIMENTAL reverse mapping btree conflicts with reflink!  Mount fails.");
+                       return -EINVAL;
+               }
+       }
+
        /*
         * More sanity checking.  Most of these were stolen directly from
         * xfs_repair.

<Prev in Thread] Current Thread [Next in Thread>