xfs
[Top] [All Lists]

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

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 103/145] xfs: provide switch to force filesystem to copy-on-write all the time
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 16 Jun 2016 18:41:37 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <146612704434.16048.12932915166928562654.stgit@xxxxxxxxxxxxxxxx>
References: <146612704434.16048.12932915166928562654.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
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@xxxxxxxxxx>
---
 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;

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