Skip to contentSkip to conversation

xfs: fix logging of AGF refcount btree fields

PATCH In review Christoph Hellwig 2 participants 2 messages May 31, 2016 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix logging of AGF refcount btree fields

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..

---
 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(-)
fs/xfs/libxfs/xfs_alloc.c +4 -0
index 6cbca1b..e6e32c2 100644
@@ -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)
 	};
 
fs/xfs/libxfs/xfs_format.h +4 -1
index e00037c..5cc0b8c 100644
@@ -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 \
fs/xfs/libxfs/xfs_refcount_btree.c +2 -1
index 3391cbd..303f959 100644
@@ -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
Signature · 6 lines
2.1.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christoph Hellwig

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..

Looks good, tests great!,

(Will keep ears open.)

--D

Quoted 60 lines
---
 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(-)
fs/xfs/libxfs/xfs_alloc.c +4 -0
index 6cbca1b..e6e32c2 100644
@@ -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)
 	};
 
fs/xfs/libxfs/xfs_format.h +4 -1
index e00037c..5cc0b8c 100644
@@ -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 \
fs/xfs/libxfs/xfs_refcount_btree.c +2 -1
index 3391cbd..303f959 100644
@@ -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
Signature · 6 lines
2.1.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs