Skip to contentSkip to conversation

Factor per-ag radix tree intialisation

PATCH New David Chinner 1 participant 1 message Aug 9, 2007 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Factor per-ag radix tree intialisation

Factor out common intialisation code.

---
 fs/xfs/xfs_mount.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
fs/xfs/xfs_mount.c +13 -10
Index: 2.6.x-xfs-new/fs/xfs/xfs_mount.c
===================================================================
@@ -337,6 +337,17 @@ xfs_mount_validate_sb(
 	return 0;
 }
 
+STATIC void
+xfs_initialize_perag_icache(
+	xfs_perag_t	*pag)
+{
+	if (!pag->pag_ici_init) {
+		rwlock_init(&pag->pag_ici_lock);
+		INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
+		pag->pag_ici_init = 1;
+	}
+}
+
 xfs_agnumber_t
 xfs_initialize_perag(
 	bhv_vfs_t	*vfs,
@@ -391,22 +402,14 @@ xfs_initialize_perag(
 			pag->pagi_inodeok = 1;
 			if (index < max_metadata)
 				pag->pagf_metadata = 1;
-			if (!pag->pag_ici_init) {
-				rwlock_init(&pag->pag_ici_lock);
-				INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
-				pag->pag_ici_init = 1;
-			}
+			xfs_initialize_perag_icache(pag);
 		}
 	} else {
 		/* Setup default behavior for smaller filesystems */
 		for (index = 0; index < agcount; index++) {
 			pag = &mp->m_perag[index];
 			pag->pagi_inodeok = 1;
-			if (!pag->pag_ici_init) {
-				rwlock_init(&pag->pag_ici_lock);
-				INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
-				pag->pag_ici_init = 1;
-			}
+			xfs_initialize_perag_icache(pag);
 		}
 	}
 	return index;