[Ocfs2-commits] jlbec commits r1082 - branches/format-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Sun Jun 13 21:27:11 CDT 2004


Author: jlbec
Date: 2004-06-13 20:27:09 -0500 (Sun, 13 Jun 2004)
New Revision: 1082

Modified:
   branches/format-changes/src/ocfs2_fs.h
   branches/format-changes/src/super.c
   branches/format-changes/src/sysfile.c
Log:

o Inlines for the system inode name list.



Modified: branches/format-changes/src/ocfs2_fs.h
===================================================================
--- branches/format-changes/src/ocfs2_fs.h	2004-06-14 01:09:17 UTC (rev 1081)
+++ branches/format-changes/src/ocfs2_fs.h	2004-06-14 01:27:09 UTC (rev 1082)
@@ -96,7 +96,7 @@
 	PUBLISH_SYSTEM_INODE,
 	VOTE_SYSTEM_INODE,
 	ORPHAN_DIR_SYSTEM_INODE,
-#define OCFS_LAST_GLOBAL_SYSTEM_INODE ORPHAN_DIR_SYSTEM_INODE
+#define OCFS2_LAST_GLOBAL_SYSTEM_INODE ORPHAN_DIR_SYSTEM_INODE
 	EXTENT_ALLOC_SYSTEM_INODE,
 	EXTENT_ALLOC_BITMAP_SYSTEM_INODE,
 	INODE_ALLOC_SYSTEM_INODE,
@@ -126,12 +126,6 @@
 };
 
 
-/*
- * The last system inode that has only one global copy.  Every system
- * inode after it in the system inode enum has a node-specific copy.
- */
-
-
 /* Default size for the local alloc bitmap */
 #define OCFS2_LOCAL_BITMAP_DEFAULT_SIZE		256
 
@@ -473,4 +467,31 @@
 }
 #endif  /* __KERNEL__ */
 
+
+static inline int ocfs2_system_inode_is_global(int type)
+{
+	return ((type >= 0) &&
+		(type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));
+}
+
+static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
+						  int type, int node)
+{
+	int chars;
+
+        /*
+         * Global system inodes can only have one copy.  Everything
+         * after OCFS_LAST_GLOBAL_SYSTEM_INODE in the system inode
+         * list has a copy per node.
+         */
+	if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
+		chars = snprintf(buf, len,
+				 ocfs2_system_inode_names[type]);
+	else
+		chars = snprintf(buf, len,
+				 ocfs2_system_inode_names[type], node);
+
+	return chars;
+}
+
 #endif  /* _OCFS2_FS_H */

Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c	2004-06-14 01:09:17 UTC (rev 1081)
+++ branches/format-changes/src/super.c	2004-06-14 01:27:09 UTC (rev 1082)
@@ -254,7 +254,7 @@
 	}
 	osb->sys_root_inode = new;
 
-	for (i = 0; i <= OCFS_LAST_GLOBAL_SYSTEM_INODE; i++) {
+	for (i = 0; i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) {
 		new = ocfs_get_system_file_inode(osb, i, osb->node_num);
 		if (!new) {
 			ocfs_release_system_inodes(osb);
@@ -280,7 +280,7 @@
 
 	LOG_ENTRY();
 
-	for (i = OCFS_LAST_GLOBAL_SYSTEM_INODE + 1; i < NUM_SYSTEM_INODES ; i++) {
+	for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1; i < NUM_SYSTEM_INODES ; i++) {
 		new = ocfs_get_system_file_inode(osb, i, osb->node_num);
 		if (!new) {
 			ocfs_release_system_inodes(osb);

Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c	2004-06-14 01:09:17 UTC (rev 1081)
+++ branches/format-changes/src/sysfile.c	2004-06-14 01:27:09 UTC (rev 1082)
@@ -99,15 +99,9 @@
 	struct ocfs2_dir_entry *de = NULL;
 	int status = 0;
 
-        /*
-         * Global system inodes can only have one copy.  Everything
-         * after OCFS_LAST_GLOBAL_SYSTEM_INODE in the system inode
-         * list has a copy per node.
-         */
-	if (type <= OCFS_LAST_GLOBAL_SYSTEM_INODE)
-		sprintf(namebuf, ocfs2_system_inode_names[type]);
-	else
-		sprintf(namebuf, ocfs2_system_inode_names[type], node);
+	ocfs2_sprintf_system_inode_name(namebuf,
+					sizeof(namebuf),
+					type, node);
 	
 	status = ocfs_find_files_on_disk(osb, namebuf, strlen(namebuf),
 					 &fe_off, osb->sys_root_inode, 



More information about the Ocfs2-commits mailing list