[PATCH 103/145] xfs: provide switch to force filesystem to copy-on-write all the time

Darrick J. Wong darrick.wong at oracle.com
Thu Jun 16 20:41:37 CDT 2016


Make it possible to force XFS to use copy on write all the time, at
least if reflink is turned on.

Signed-off-by: Darrick J. Wong <darrick.wong at oracle.com>
---
 libxfs/libxfs_priv.h  |    2 ++
 libxfs/xfs_refcount.c |    6 ++++++
 2 files changed, 8 insertions(+)


diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 41f6b96..527bd49 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -517,4 +517,6 @@ int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb,
 
 bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
 
+#define xfs_always_cow	(false)
+
 #endif	/* __LIBXFS_INTERNAL_XFS_H__ */
diff --git a/libxfs/xfs_refcount.c b/libxfs/xfs_refcount.c
index e03a9b7..855ab54 100644
--- a/libxfs/xfs_refcount.c
+++ b/libxfs/xfs_refcount.c
@@ -1189,6 +1189,12 @@ xfs_refcount_find_shared(
 
 	trace_xfs_refcount_find_shared(mp, agno, agbno, aglen);
 
+	if (xfs_always_cow) {
+		*fbno = agbno;
+		*flen = aglen;
+		return 0;
+	}
+
 	error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
 	if (error)
 		goto out;



More information about the xfs mailing list