[Ocfs-tools-commits]
khackel commits r60 - in trunk/ocfs2/format: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Jun 14 03:06:08 CDT 2004
Author: khackel
Date: 2004-06-14 02:06:05 -0500 (Mon, 14 Jun 2004)
New Revision: 60
Modified:
trunk/ocfs2/format/inc/ocfs2_fs.h
trunk/ocfs2/format/mkfs2.c
Log:
changed from 3 inodes for autoconfig/publish/vote to 1
Modified: trunk/ocfs2/format/inc/ocfs2_fs.h
===================================================================
--- trunk/ocfs2/format/inc/ocfs2_fs.h 2004-06-14 00:33:51 UTC (rev 59)
+++ trunk/ocfs2/format/inc/ocfs2_fs.h 2004-06-14 07:06:05 UTC (rev 60)
@@ -45,6 +45,12 @@
*/
#define OCFS2_SUPER_BLOCK_BLKNO 2
+/*
+ * As OCFS2 has a minimum clustersize of 4K, it has a maximum blocksize
+ * of 4K
+ */
+#define OCFS2_MAX_BLOCKSIZE 4096
+
/* Object signatures */
#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
#define OCFS2_FILE_ENTRY_SIGNATURE "INODE01"
@@ -53,14 +59,17 @@
/*
* Flags on ocfs2_dinode.i_flags
*/
-#define OCFS2_VALID_FL (0x01)
-#define OCFS2_UNUSED2_FL (0x02)
-#define OCFS2_ORPHANED_FL (0x04)
-#define OCFS2_UNUSED3_FL (0x08)
-#define OCFS2_SYSTEM_FL (0x10)
-#define OCFS2_SUPER_BLOCK_FL (0x20)
-#define OCFS2_LOCAL_ALLOC_FL (0x40)
-#define OCFS2_BITMAP_FL (0x80)
+#define OCFS2_VALID_FL (0x00000001) /* Inode is valid */
+#define OCFS2_UNUSED2_FL (0x00000002)
+#define OCFS2_ORPHANED_FL (0x00000004) /* On the orphan list */
+#define OCFS2_UNUSED3_FL (0x00000008)
+/* System inode flags */
+#define OCFS2_SYSTEM_FL (0x00000010) /* System inode */
+#define OCFS2_SUPER_BLOCK_FL (0x00000020) /* Super block */
+#define OCFS2_LOCAL_ALLOC_FL (0x00000040) /* Node local alloc bitmap */
+#define OCFS2_BITMAP_FL (0x00000080) /* Allocation bitmap */
+#define OCFS2_JOURNAL_FL (0x00000100) /* Node journal */
+#define OCFS2_DLM_FL (0x00000200) /* DLM area */
/* Limit of space in ocfs2_dir_entry */
@@ -83,10 +92,12 @@
GLOBAL_BITMAP_SYSTEM_INODE = 0,
GLOBAL_INODE_ALLOC_SYSTEM_INODE,
GLOBAL_INODE_ALLOC_BITMAP_SYSTEM_INODE,
- AUTOCONFIG_SYSTEM_INODE,
- PUBLISH_SYSTEM_INODE,
- VOTE_SYSTEM_INODE,
+ //AUTOCONFIG_SYSTEM_INODE,
+ //PUBLISH_SYSTEM_INODE,
+ //VOTE_SYSTEM_INODE,
+ DLM_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,
@@ -96,13 +107,27 @@
NUM_SYSTEM_INODES
};
-/*
- * 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.
- */
-#define OCFS_LAST_GLOBAL_SYSTEM_INODE ORPHAN_DIR_SYSTEM_INODE
+static char *ocfs2_system_inode_names[NUM_SYSTEM_INODES] = {
+ /* Global system inodes (single copy) */
+ [GLOBAL_BITMAP_SYSTEM_INODE] "global_bitmap",
+ [GLOBAL_INODE_ALLOC_SYSTEM_INODE] "global_inode_alloc",
+ [GLOBAL_INODE_ALLOC_BITMAP_SYSTEM_INODE] "global_inode_alloc_bitmap",
+ //[AUTOCONFIG_SYSTEM_INODE] "autoconfig",
+ //[PUBLISH_SYSTEM_INODE] "publish",
+ //[VOTE_SYSTEM_INODE] "vote",
+ [DLM_SYSTEM_INODE] "dlm",
+ [ORPHAN_DIR_SYSTEM_INODE] "orphan_dir",
+ /* Node-specific system inodes (one copy per node) */
+ [EXTENT_ALLOC_SYSTEM_INODE] "extent_alloc:%04d",
+ [EXTENT_ALLOC_BITMAP_SYSTEM_INODE] "extent_alloc_bitmap:%04d",
+ [INODE_ALLOC_SYSTEM_INODE] "inode_alloc:%04d",
+ [INODE_ALLOC_BITMAP_SYSTEM_INODE] "inode_alloc_bitmap:%04d",
+ [JOURNAL_SYSTEM_INODE] "journal:%04d",
+ [LOCAL_ALLOC_SYSTEM_INODE] "local_alloc:%04d"
+};
+
/* Default size for the local alloc bitmap */
#define OCFS2_LOCAL_BITMAP_DEFAULT_SIZE 256
@@ -159,11 +184,11 @@
#define OCFS2_NODE_MIN_SUPPORTED_VER 2
#define MAX_IP_ADDR_LEN 32
-#define HOSTID_LEN 20
-#define MACID_LEN 12
-#define GUID_LEN (HOSTID_LEN+MACID_LEN)
#define MAX_NODE_NAME_LENGTH 32
+#define OCFS2_GUID_HOSTID_LEN 20
+#define OCFS2_GUID_MACID_LEN 12
+#define OCFS2_GUID_LEN (OCFS2_GUID_HOSTID_LEN + OCFS2_GUID_MACID_LEN)
@@ -354,17 +379,17 @@
__u8 ip_mask[MAX_IP_ADDR_LEN+1]; // CHAR[MAX_IP_ADDR_LEN+1]
}
ocfs_ipc_config_info; // END CLASS
+
/* TODO this structure will break in 64-bit.... need to pack */
-typedef union _ocfs_guid // CLASS
+typedef union _ocfs_guid
{
struct
{
- char host_id[HOSTID_LEN];
- char mac_id[MACID_LEN];
+ char host_id[OCFS2_GUID_HOSTID_LEN];
+ char mac_id[OCFS2_GUID_MACID_LEN];
} id;
- __u8 guid[GUID_LEN]; // CHAR[GUID_LEN]
-}
-ocfs_guid; // END CLASS
+ __u8 guid[OCFS2_GUID_LEN];
+} ocfs_guid;
typedef struct _ocfs_node_config_info // CLASS
{
@@ -444,4 +469,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: trunk/ocfs2/format/mkfs2.c
===================================================================
--- trunk/ocfs2/format/mkfs2.c 2004-06-14 00:33:51 UTC (rev 59)
+++ trunk/ocfs2/format/mkfs2.c 2004-06-14 07:06:05 UTC (rev 60)
@@ -98,8 +98,8 @@
enum {
sfi_journal,
sfi_bitmap,
- sfi_alloc,
sfi_local_alloc,
+ sfi_dlm,
sfi_other
};
@@ -113,15 +113,16 @@
system_file_info system_files[] = {
{ "global_bitmap", sfi_bitmap, 1, 0 },
- { "global_inode_alloc", sfi_alloc, 1, 0 },
+ { "global_inode_alloc", sfi_other, 1, 0 },
{ "global_inode_alloc_bitmap", sfi_bitmap, 1, 0 },
- { "autoconfig", sfi_other, 1, 0 },
- { "publish", sfi_other, 1, 0 },
- { "vote", sfi_other, 1, 0 },
+ //{ "autoconfig", sfi_other, 1, 0 },
+ //{ "publish", sfi_other, 1, 0 },
+ //{ "vote", sfi_other, 1, 0 },
+ { "dlm", sfi_dlm, 1, 0 },
{ "orphan_dir", sfi_other, 1, 1 },
- { "extent_alloc:%04d", sfi_alloc, 0, 0 },
+ { "extent_alloc:%04d", sfi_other, 0, 0 },
{ "extent_alloc_bitmap:%04d", sfi_bitmap, 0, 0 },
- { "inode_alloc:%04d", sfi_alloc, 0, 0 },
+ { "inode_alloc:%04d", sfi_other, 0, 0 },
{ "inode_alloc_bitmap:%04d", sfi_bitmap, 0, 0 },
{ "journal:%04d", sfi_journal, 0, 0 },
{ "local_alloc:%04d", sfi_local_alloc, 0, 0 },
@@ -190,8 +191,6 @@
void write_bitmap_data(alloc_bm *bm);
void write_directory_data(funky_dir *dir);
void format_leading_space(__u64 start);
-void format_autoconf_publish_vote(__u64 autoconf_off, __u64 publish_off, __u64 vote_off,
- __u64 data_off, __u64 data_len);
void init_device(void);
void init_globals(void);
void usage(void);
@@ -205,6 +204,7 @@
system_file_disk_record *vote_rec);
void write_autoconfig_header(system_file_disk_record *rec);
void init_record(system_file_disk_record *rec, int type, int dir);
+void version(char *progname);
@@ -970,6 +970,7 @@
{
ocfs_node_config_hdr *hdr;
+ // first sector of the whole dlm block is a header
hdr = (mapping + rec->extent_off);
memset(hdr, 0, blocksize);
strcpy(hdr->signature, OCFS2_NODE_CONFIG_HDR_SIGN);
@@ -992,17 +993,17 @@
switch (type) {
case sfi_journal:
- //rec->flags |= OCFS2_JOURNAL_FL;
+ rec->flags |= OCFS2_JOURNAL_FL;
break;
case sfi_bitmap:
rec->flags |= OCFS2_BITMAP_FL;
break;
- case sfi_alloc:
- //rec->flags |= OCFS2_ALLOC_FL;
- break;
case sfi_local_alloc:
rec->flags |= OCFS2_LOCAL_ALLOC_FL;
break;
+ case sfi_dlm:
+ rec->flags |= OCFS2_DLM_FL;
+ break;
case sfi_other:
break;
}
@@ -1019,7 +1020,7 @@
funky_dir *orphan_dir;
funky_dir *root_dir;
funky_dir *system_dir;
- system_file_disk_record *tmprec, *tmprec2, *tmprec3;
+ system_file_disk_record *tmprec, *tmprec2;
progname = strdup(argv[0]);
process_args(argc, argv);
@@ -1033,8 +1034,9 @@
/*
* ALLOCATE STUFF
*/
+
// dummy record representing the whole volume
- init_record(&global_alloc_rec, sfi_alloc, 0);
+ init_record(&global_alloc_rec, sfi_other, 0);
global_alloc_rec.extent_off = 0;
global_alloc_rec.extent_len = volume_size_in_bytes;
@@ -1129,18 +1131,13 @@
}
}
- /* autoconfig, publish, vote data */
- /* XXX: ok this is messy ;-) */
- /* give everything to autoconfig, then adjust it */
- tmprec = &(record[AUTOCONFIG_SYSTEM_INODE][0]);
- tmprec2 = &(record[PUBLISH_SYSTEM_INODE][0]);
- tmprec3 = &(record[VOTE_SYSTEM_INODE][0]);
+ /* dlm area data */
+ tmprec = &(record[DLM_SYSTEM_INODE][0]);
need = (AUTOCONF_BLOCKS(initial_nodes, 32) +
PUBLISH_BLOCKS(initial_nodes, 32) +
VOTE_BLOCKS(initial_nodes, 32));
tmprec->extent_off = alloc_inode(need);
- tmprec->extent_len = need << blocksize_bits;
- adjust_autoconfig_publish_vote(tmprec, tmprec2, tmprec3);
+ tmprec->file_size = tmprec->extent_len = need << blocksize_bits;
/* orphan dir */
@@ -1193,7 +1190,7 @@
write_directory_data(system_dir);
write_directory_data(orphan_dir);
- write_autoconfig_header(&record[AUTOCONFIG_SYSTEM_INODE][0]);
+ write_autoconfig_header(&record[DLM_SYSTEM_INODE][0]);
/*
* SYNC TO DISK
*/
More information about the Ocfs-tools-commits
mailing list