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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Jun 11 19:35:26 CDT 2004


Author: jlbec
Date: 2004-06-11 18:35:24 -0500 (Fri, 11 Jun 2004)
New Revision: 1057

Modified:
   branches/format-changes/src/alloc.c
   branches/format-changes/src/extmap.c
   branches/format-changes/src/file.c
   branches/format-changes/src/inode.c
   branches/format-changes/src/namei.c
   branches/format-changes/src/ocfs.h
   branches/format-changes/src/super.c
   branches/format-changes/src/sysfile.c
Log:

o Add ocfs2_super_block (kurt's superblock)
o Clean up the dinode unions.



Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/alloc.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -429,7 +429,8 @@
 		}
 
 		bm_lock = OCFS_BH_GET_DATA_WRITE(globalbh);
-		bm_lock->u.i_bitinfo.b_used = ocfs_count_bits(&osb->cluster_bitmap);
+		bm_lock->id1.bitmap1.i_used =
+			ocfs_count_bits(&osb->cluster_bitmap);
 		OCFS_BH_PUT_DATA(globalbh);
 
 		status = ocfs_journal_dirty(handle, globalbh);
@@ -684,7 +685,7 @@
 		bh_locked = 1;
 	}
 	else
-		el1 = &fe->u.i_list;
+		el1 = &fe->id2.i_list;
 
 	depth = el1->l_tree_depth;
 
@@ -796,7 +797,7 @@
 		bh_locked = 0;
 		eb = NULL;
 
-	       	el1 = &fe->u.i_list;
+	       	el1 = &fe->id2.i_list;
 
 		status = ocfs_journal_dirty(handle, eb_bh);
 		if (status < 0) {
@@ -899,6 +900,7 @@
 
 	/* too complicated to deal with both reads and writes to the structure     */
 	/* just save off a copy and replace the fe_bh with the new data at the end */
+#warning markflar, fix the fe copy
 	fe = kmalloc(osb->sb->s_blocksize, GFP_NOFS);
 	if (fe == NULL) {
 		LOG_ERROR_STATUS (status = -ENOMEM);
@@ -909,7 +911,7 @@
 	OCFS_BH_PUT_DATA(fe_bh);
 	real_fe = NULL;
 	
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 	numbhs = fel->l_tree_depth + 2;
 
 	bhs = kmalloc(numbhs * sizeof(*bhs), GFP_KERNEL);
@@ -1198,7 +1200,7 @@
 		LOG_ERROR_STATUS(status = -EINVAL);
 		goto finally;
 	}
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 
 	if (fel->l_tree_depth < 0) {
 		LOG_TRACE_STR("Using local extents");
@@ -1864,7 +1866,7 @@
 	__u64 total_bytes;  /* FIXME needs to be clusters!!! */
 	__u32 num_clusters, bitmap_offset;
 	int done = 0;
-	int depth = fe->u.i_list.l_tree_depth;
+	int depth = fe->id2.i_list.l_tree_depth;
 	int needs_brelse = 0;
 
 	LOG_ENTRY();
@@ -2410,7 +2412,7 @@
 
 	LOG_ENTRY ();
 
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 	if (fel->l_next_free_rec == 0) {
 		LOG_TRACE_STR("setting to zero as there isn't any used extents");
 		fe->i_last_eb_blk = 0;
@@ -2502,7 +2504,7 @@
 
 	LOG_ENTRY ();
 
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 
 	/* local extents */
 	if (fel->l_tree_depth < 0) {
@@ -2674,7 +2676,7 @@
 		goto finally;
 	}
 
-	if (fe->u.i_list.l_tree_depth < 0) {
+	if (fe->id2.i_list.l_tree_depth < 0) {
 		status = ocfs_update_extent_map(osb,
 						&OCFS_I(inode)->map, fe,
 						NULL, NULL, LOCAL_EXT);
@@ -2788,7 +2790,7 @@
 
 	LOG_ENTRY ();
 
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 
 	for (i = 0; i < fel->l_next_free_rec; i++) {
 		if ((__s64)((u64)(fel->l_recs[i].e_cpos + fel->l_recs[i].e_clusters) << osb->s_clustersize_bits) > Vbo) {
@@ -3039,7 +3041,8 @@
 	LOG_TRACE_ARGS("bitoffset = %u, ClusterCount = %u, startbh = %u, numblocks = %u\n", bitoffset, ClusterCount, startbh, numblocks);
 
 	/* write the bitmap size info to the lock sector */
-	bm_lock->u.i_bitinfo.b_used = ocfs_count_bits(&osb->cluster_bitmap);
+	bm_lock->id1.bitmap1.i_used =
+		ocfs_count_bits(&osb->cluster_bitmap);
 	OCFS_BH_PUT_DATA(bh);
 	bm_lock = NULL;
 
@@ -3330,7 +3333,7 @@
 		SET_BH_SEQNUM(inode, fe_bh);
 
 	fe = OCFS_BH_GET_DATA_READ(fe_bh);
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 
 	if (fel->l_tree_depth < 0) {
 		for (i = 0; i < fel->l_next_free_rec; i++) {

Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/extmap.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -598,7 +598,7 @@
 
 	if (Flag == LOCAL_EXT) {
 		fe = Buffer;
-		el = &fe->u.i_list;
+		el = &fe->id2.i_list;
 
 		OCFS_ASSERT(el->l_tree_depth < 0);
 

Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/file.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -434,6 +434,7 @@
 
 	/* get a copy of fe, used readonly in this path and */
 	/* ocfs_create_new_oin will deadlock if fe_bh is locked */
+#warning markflar, fix the fe copy
 	fe = kmalloc(osb->sb->s_blocksize, GFP_NOFS);
 	if (fe == NULL) {
 		LOG_ERROR_STATUS(ret = -ENOMEM);
@@ -448,7 +449,7 @@
 	if (S_ISDIR(fe->i_mode))
 		goto leave;
 
-	el = &fe->u.i_list;
+	el = &fe->id2.i_list;
 	if (el->l_tree_depth < 0) {
 		for (j = 0; j < el->l_next_free_rec; j++) {
 			/* Add the Extent to extent map */

Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/inode.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -394,7 +394,8 @@
 
 	inode->i_version = 1;
 	inode->i_generation = le32_to_cpu(fe->i_generation);
-	inode->i_rdev = ocfs_decode_dev(le64_to_cpu(fe->u.i_rdev));
+	inode->i_rdev =
+		ocfs_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
 	inode->i_mode = fe->i_mode;
 	inode->i_uid = fe->i_uid;
 	inode->i_gid = fe->i_gid;
@@ -416,9 +417,7 @@
 		(u64)fe->i_clusters << osb->s_clustersize_bits;
 	OCFS_I(inode)->inode = inode;
 	OCFS_I(inode)->chng_seq_num = DISK_LOCK(fe)->dl_seq_num;
-#if 0 /* This can't be right, can it? */
-	OCFS_I(inode)->u.fe_private = fe->u.i_private;
-#endif
+	OCFS_I(inode)->u.fe_private = fe->id1.i_pad1;
 
 	if (S_ISDIR(fe->i_mode))
 		OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY;
@@ -546,7 +545,7 @@
 	fe = OCFS_BH_GET_DATA_READ(bh);
 
 	if (S_ISCHR(fe->i_mode) || S_ISBLK(fe->i_mode))
-    		inode->i_rdev = ocfs_decode_dev(le64_to_cpu(fe->u.i_rdev));
+    		inode->i_rdev = ocfs_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
 
 	ocfs_populate_inode (inode, fe, 0);
 
@@ -846,7 +845,7 @@
 	}
 
 	map_bh(bh_result, inode->i_sb,
-	       fe->u.i_list.l_recs[0].e_blkno + iblock);
+	       fe->id2.i_list.l_recs[0].e_blkno + iblock);
 	OCFS_BH_PUT_DATA(bh);
 
 	err = 0;
@@ -1857,10 +1856,10 @@
 	     	    S_ISSOCK(fe->i_mode)) {
 			inode->i_rdev = OCFS_NODEV;
 			init_special_inode(inode, inode->i_mode,
-					   ocfs_decode_dev(le64_to_cpu(fe->u.i_rdev)));
+					   ocfs_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev)));
 		}
 
-		fel = &fe->u.i_list;
+		fel = &fe->id2.i_list;
 		if (fel->l_tree_depth < 0) {
 			__u32 j;
 

Modified: branches/format-changes/src/namei.c
===================================================================
--- branches/format-changes/src/namei.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/namei.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -388,7 +388,7 @@
 	fe->i_gid = current->fsgid;
 	fe->i_mode = mode;
 	if (S_ISCHR (mode) || S_ISBLK (mode))
-		fe->u.i_rdev = ocfs_encode_dev(dev);
+		fe->id1.dev1.i_rdev = ocfs_encode_dev(dev);
 
 	if (S_ISLNK (mode) || S_ISDIR (mode) || S_ISREG (mode)) 
 		atomic_set(GET_INODE_CLEAN_SEQ(inode), atomic_read(&osb->clean_buffer_seq));
@@ -409,7 +409,7 @@
 	fe->i_atime = fe->i_ctime = fe->i_mtime = OCFS_CURRENT_TIME;
 	fe->i_dtime = 0;
 
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 	fel->l_tree_depth = -1;
 	fel->l_next_free_rec = 0;
 	fel->l_count = ocfs_extent_recs_per_inode(osb->sb);

Modified: branches/format-changes/src/ocfs.h
===================================================================
--- branches/format-changes/src/ocfs.h	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/ocfs.h	2004-06-11 23:35:24 UTC (rev 1057)
@@ -315,11 +315,13 @@
 ** File Entry contains this information
 */
 /* OCFS2 file flags */
-#define OCFS2_VALID_FL			(0x1)
-#define OCFS2_CHANGE_FL			(0x2)
-#define OCFS2_MARK_FOR_DELETION_FL	(0x4)
-#define OCFS2_NAME_DELETED_FL		(0x8)
+#define OCFS2_VALID_FL			(0x01)
+#define OCFS2_CHANGE_FL			(0x02)
+#define OCFS2_MARK_FOR_DELETION_FL	(0x04)
+#define OCFS2_NAME_DELETED_FL		(0x08)
 #define	OCFS2_SYSTEM_FL			(0x10)
+#define	OCFS2_SUPER_FL			(0x11)
+#define	OCFS2_ALLOC_FL			(0x12)
 
 
 #define  INVALID_NODE_POINTER		-1
@@ -483,6 +485,7 @@
 #endif /* >= 2.6.0  */
 
 #define OCFS_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
+#define OCFS2_RAW_SB(inode)	(inode->id2.i_super)
 
 
 #define  OCFS_MINOR_VERSION              (0)
@@ -556,7 +559,7 @@
 
 
 /*
- * On disk extent record for OCFSv2.  It describes a range of clusters
+ * On disk extent record for OCFS2.  It describes a range of clusters
  * on disk.
  */
 typedef struct _ocfs2_extent_rec {
@@ -567,7 +570,7 @@
 } ocfs2_extent_rec;	
 
 /*
- * On disk extent list for OCFSv2 (node in the tree)
+ * On disk extent list for OCFS2 (node in the tree)
  */
 typedef struct _ocfs2_extent_list {
 /*00*/	__s16 l_tree_depth;		/* Extent tree depth from this
@@ -583,7 +586,7 @@
 } ocfs2_extent_list;
 
 /*
- * On disk extent block (indirect block) for OCFSv2
+ * On disk extent block (indirect block) for OCFS2
  */
 typedef struct _ocfs2_extent_block
 {
@@ -605,7 +608,7 @@
 } ocfs2_extent_block;
 
 /*
- * On disk lock structure for OCFSv2
+ * On disk lock structure for OCFS2
  */
 typedef struct _ocfs2_disk_lock
 {
@@ -619,8 +622,40 @@
 } ocfs2_disk_lock;
 
 /*
- * On disk inode for OCFS v2
+ * On disk superblock for OCFS2.  Note that it is contained inside an
+ * ocfs2_dinode, so all offsets are relative to the start of ocfs2_dinode.id2.
  */
+typedef struct _ocfs2_super_block {
+/*00*/	__u16 s_major_rev_level;
+	__u16 s_minor_rev_level;
+	__u16 s_mnt_count;
+	__s16 s_max_mnt_count;
+	__u16 s_state;			/* File system state */
+	__u16 s_errors;			/* Behaviour when detecting errors */
+	__u32 s_checkinterval;		/* Max time between checks */
+/*10*/	__u64 s_lastcheck;		/* Time of last check */
+	__u32 s_creator_os;		/* OS */
+	__u32 s_feature_compat;		/* Compatible feature set */
+/*20*/	__u32 s_feature_incompat;	/* Incompatible feature set */
+	__u32 s_feature_ro_compat;	/* Readonly-compatible feature set */
+	__u64 s_root_blkno;		/* Offset, in blocks, of root directory
+					   dinode */
+/*30*/	__u64 s_system_dir_blkno;	/* Offset, in blocks, of system
+					   directory dinode */
+	__u32 s_blocksize_bits;		/* Blocksize for this fs */
+	__u32 s_clustersize_bits;	/* Clustersize for this fs */
+/*40*/	__u32 s_max_nodes;		/* Max nodes in this cluster before
+					   tunefs required */
+	__u32 s_reserved1;
+	__u64 s_reserved2;
+/*50*/	__u8  s_label[64];		/* Label for mounting, etc. */
+/*90*/	__u8  s_uuid[16];		/* Was vol_id */
+/*A0*/
+} ocfs2_super_block;
+
+/*
+ * On disk inode for OCFS2
+ */
 typedef struct _ocfs2_dinode {
 /*00*/	__u8 i_signature[8];		/* Signature for validation */
 	__u32 i_generation;		/* Generation number */
@@ -648,15 +683,22 @@
 	__u64 i_reserved3;
 /*A0*/	__u64 i_reserved4;
 	__u64 i_reserved5;
-/*B0*/	union {
-		__u64 i_private;
-		__u64 i_rdev;
-		struct _bitinfo {
-			__u32 b_used;
-			__u32 b_total;
-		} i_bitinfo;
+/*B0*/	__u64 i_reserved6;
+	union {
+		__u64 i_pad1;		/* Generic way to refer to this 64bit
+					   union */
+		struct {
+			__u64 i_rdev;	/* Device number */
+		} dev1;
+		struct {		/* Info for bitmap system inodes */
+			__u32 i_used;	/* Bits (ie, clusters) used  */
+			__u32 i_total;	/* Total bits (clusters) available */
+		} bitmap1;
+	} id1;				/* Inode type dependant 1 */
+/*C0*/	union {
+		ocfs2_super_block i_super;
 		ocfs2_extent_list i_list;
-	} u;
+	} id2;
 } ocfs2_dinode;
 
 
@@ -1777,7 +1819,7 @@
 	int size;
 
 	size = sb->s_blocksize -
-		offsetof(struct _ocfs2_dinode, u.i_list.l_recs);
+		offsetof(struct _ocfs2_dinode, id2.i_list.l_recs);
 
 	return size / sizeof(struct _ocfs2_extent_rec);
 }

Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/super.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -692,9 +692,9 @@
  *
  */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static int ocfs_statfs (struct super_block *sb, struct kstatfs *buf)
+static int ocfs_statfs(struct super_block *sb, struct kstatfs *buf)
 #else
-static int ocfs_statfs (struct super_block *sb, struct statfs *buf)
+static int ocfs_statfs(struct super_block *sb, struct statfs *buf)
 #endif
 {
 	ocfs_super *osb;
@@ -718,8 +718,8 @@
 
 	freebits = numbits = osb->cluster_bitmap.validbits;
 
-	if (numbits >= bm_lock->u.i_bitinfo.b_used)
-	    freebits -= bm_lock->u.i_bitinfo.b_used;
+	if (numbits >= bm_lock->id1.bitmap1.i_used)
+	    freebits -= bm_lock->id1.bitmap1.i_used;
 
 	/* take out the space reserved for system files */
 	reserved_bits = ocfs_clusters_for_bytes(sb, 8 * ONE_MEGA_BYTE);

Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c	2004-06-11 21:43:33 UTC (rev 1056)
+++ branches/format-changes/src/sysfile.c	2004-06-11 23:35:24 UTC (rev 1057)
@@ -490,7 +490,7 @@
 		goto leave;
 	}
 
-	fel = &fe->u.i_list;
+	fel = &fe->id2.i_list;
 
 	if (fel->l_tree_depth < 0)
        	{



More information about the Ocfs2-commits mailing list