xfs
[Top] [All Lists]

[PATCH, reflink] xfs: fix logging of AGF refcount btree fields

To: darrick.wong@xxxxxxxxxx
Subject: [PATCH, reflink] xfs: fix logging of AGF refcount btree fields
From: Christoph Hellwig <hch@xxxxxx>
Date: Tue, 31 May 2016 21:32:55 +0200
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
These fields are separate from the existing roots and levels array
and thus need a separate logging flag.

That being said the API to logs the AGI/AGF is a bit of a nightmare,
and I have an idea how to improve it.  Stay tuned..

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/xfs/libxfs/xfs_alloc.c          | 4 ++++
 fs/xfs/libxfs/xfs_format.h         | 5 ++++-
 fs/xfs/libxfs/xfs_refcount_btree.c | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 6cbca1b..e6e32c2 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -2327,6 +2327,10 @@ xfs_alloc_log_agf(
                offsetof(xfs_agf_t, agf_longest),
                offsetof(xfs_agf_t, agf_btreeblks),
                offsetof(xfs_agf_t, agf_uuid),
+               offsetof(xfs_agf_t, agf_refcount_root),
+               offsetof(xfs_agf_t, agf_refcount_level),
+               /* needed so that we don't log the whole rest of the structure: 
*/
+               offsetof(xfs_agf_t, agf_spare64),
                sizeof(xfs_agf_t)
        };
 
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index e00037c..5cc0b8c 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -681,7 +681,10 @@ typedef struct xfs_agf {
 #define        XFS_AGF_LONGEST         0x00000400
 #define        XFS_AGF_BTREEBLKS       0x00000800
 #define        XFS_AGF_UUID            0x00001000
-#define        XFS_AGF_NUM_BITS        13
+#define        XFS_AGF_REFCOUNT_ROOT   0x00002000
+#define        XFS_AGF_REFCOUNT_LEVEL  0x00004000
+#define        XFS_AGF_SPARE64         0x00008000
+#define        XFS_AGF_NUM_BITS        16
 #define        XFS_AGF_ALL_BITS        ((1 << XFS_AGF_NUM_BITS) - 1)
 
 #define XFS_AGF_FLAGS \
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.c 
b/fs/xfs/libxfs/xfs_refcount_btree.c
index 3391cbd..303f959 100644
--- a/fs/xfs/libxfs/xfs_refcount_btree.c
+++ b/fs/xfs/libxfs/xfs_refcount_btree.c
@@ -61,7 +61,8 @@ xfs_refcountbt_set_root(
        pag->pagf_refcount_level += inc;
        xfs_perag_put(pag);
 
-       xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_ROOTS | XFS_AGF_LEVELS);
+       xfs_alloc_log_agf(cur->bc_tp, agbp,
+                       XFS_AGF_REFCOUNT_ROOT | XFS_AGF_REFCOUNT_LEVEL);
 }
 
 STATIC int
-- 
2.1.4

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