Skip to contentSkip to conversation

xfs: move extent busy tree initialization to xfs_initialize_perag

PATCH In review Darrick J. Wong 4 participants 4 messages Jul 31, 2018 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: move extent busy tree initialization to xfs_initialize_perag

From: Darrick J. Wong <[email protected]>

Move the per-AG busy extent tree initialization to the per-ag structure initialization since we don't want online repair to leak the old tree. We only deconstruct the tree at unmount time, so this should be safe. This also enables us to eliminate the commented out initialization in the xfsprogs libxfs.

---
 fs/xfs/libxfs/xfs_alloc.c |    3 ---
 fs/xfs/xfs_mount.c        |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_alloc.c +0 -3
index 3c3f2d5119ea..9847c1632712 100644
@@ -2755,9 +2755,6 @@ xfs_alloc_read_agf(
 		pag->pagf_levels[XFS_BTNUM_RMAPi] =
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAPi]);
 		pag->pagf_refcount_level = be32_to_cpu(agf->agf_refcount_level);
-		spin_lock_init(&pag->pagb_lock);
-		pag->pagb_count = 0;
-		pag->pagb_tree = RB_ROOT;
 		pag->pagf_init = 1;
 		pag->pagf_agflreset = xfs_agfl_needs_reset(mp, agf);
 	}
fs/xfs/xfs_mount.c +3 -0
index 8f739e4d0d1c..99db27d6ac8a 100644
@@ -207,6 +207,9 @@ xfs_initialize_perag(
 		if (xfs_buf_hash_init(pag))
 			goto out_free_pag;
 		init_waitqueue_head(&pag->pagb_wait);
+		spin_lock_init(&pag->pagb_lock);
+		pag->pagb_count = 0;
+		pag->pagb_tree = RB_ROOT;
 
 		if (radix_tree_preload(GFP_NOFS))
 			goto out_hash_destroy;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Move the per-AG busy extent tree initialization to the per-ag structure initialization since we don't want online repair to leak the old tree. We only deconstruct the tree at unmount time, so this should be safe. This also enables us to eliminate the commented out initialization in the xfsprogs libxfs.

---

Quoted 36 lines
 fs/xfs/libxfs/xfs_alloc.c |    3 ---
 fs/xfs/xfs_mount.c        |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_alloc.c +0 -3
index 3c3f2d5119ea..9847c1632712 100644
@@ -2755,9 +2755,6 @@ xfs_alloc_read_agf(
 		pag->pagf_levels[XFS_BTNUM_RMAPi] =
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAPi]);
 		pag->pagf_refcount_level = be32_to_cpu(agf->agf_refcount_level);
-		spin_lock_init(&pag->pagb_lock);
-		pag->pagb_count = 0;
-		pag->pagb_tree = RB_ROOT;
 		pag->pagf_init = 1;
 		pag->pagf_agflreset = xfs_agfl_needs_reset(mp, agf);
 	}
fs/xfs/xfs_mount.c +3 -1
index 8f739e4d0d1c..99db27d6ac8a 100644
@@ -207,6 +207,9 @@ xfs_initialize_perag(
 		if (xfs_buf_hash_init(pag))
 			goto out_free_pag;
 		init_waitqueue_head(&pag->pagb_wait);
+		spin_lock_init(&pag->pagb_lock);
+		pag->pagb_count = 0;
+		pag->pagb_tree = RB_ROOT;
 
 		if (radix_tree_preload(GFP_NOFS))
 			goto out_hash_destroy;
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v1 1/1
#2 lore raw
In reply to Darrick J. Wong
Quoted 9 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Move the per-AG busy extent tree initialization to the per-ag structure initialization since we don't want online repair to leak the old tree. We only deconstruct the tree at unmount time, so this should be safe. This also enables us to eliminate the commented out initialization in the xfsprogs libxfs.

Quoted 37 lines
---
 fs/xfs/libxfs/xfs_alloc.c |    3 ---
 fs/xfs/xfs_mount.c        |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_alloc.c +0 -3
index 3c3f2d5119ea..9847c1632712 100644
@@ -2755,9 +2755,6 @@ xfs_alloc_read_agf(
 		pag->pagf_levels[XFS_BTNUM_RMAPi] =
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAPi]);
 		pag->pagf_refcount_level = be32_to_cpu(agf->agf_refcount_level);
-		spin_lock_init(&pag->pagb_lock);
-		pag->pagb_count = 0;
-		pag->pagb_tree = RB_ROOT;
 		pag->pagf_init = 1;
 		pag->pagf_agflreset = xfs_agfl_needs_reset(mp, agf);
 	}
fs/xfs/xfs_mount.c +3 -1
index 8f739e4d0d1c..99db27d6ac8a 100644
@@ -207,6 +207,9 @@ xfs_initialize_perag(
 		if (xfs_buf_hash_init(pag))
 			goto out_free_pag;
 		init_waitqueue_head(&pag->pagb_wait);
+		spin_lock_init(&pag->pagb_lock);
+		pag->pagb_count = 0;
+		pag->pagb_tree = RB_ROOT;
 
 		if (radix_tree_preload(GFP_NOFS))
 			goto out_hash_destroy;
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Carlos