[Ocfs2-commits] manish commits r2089 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Mar 30 17:43:12 CST 2005


Author: manish
Signed-off-by: jlbec
Date: 2005-03-30 17:43:11 -0600 (Wed, 30 Mar 2005)
New Revision: 2089

Modified:
   trunk/fs/ocfs2/localalloc.c
   trunk/fs/ocfs2/namei.c
   trunk/fs/ocfs2/ocfs.h
   trunk/fs/ocfs2/ocfs1_fs_compat.h
   trunk/fs/ocfs2/ocfs2.h
   trunk/fs/ocfs2/ocfs2_fs.h
   trunk/fs/ocfs2/super.c
   trunk/fs/ocfs2/vote.c
Log:
Saner namespacing, remove some unused header cruft

Signed-off-by: jlbec


Modified: trunk/fs/ocfs2/localalloc.c
===================================================================
--- trunk/fs/ocfs2/localalloc.c	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/localalloc.c	2005-03-30 23:43:11 UTC (rev 2089)
@@ -178,21 +178,21 @@
 	if (num_used
 	    || alloc->id1.bitmap1.i_used
 	    || alloc->id1.bitmap1.i_total
-	    || LOCAL_ALLOC(alloc)->la_bm_off) {
+	    || OCFS2_LOCAL_ALLOC(alloc)->la_bm_off) {
 		LOG_ERROR_ARGS("Local alloc hasn't been recovered!\n"
 			       "found = %u, set = %u, taken = %u, off = %u\n",
 			       num_used,
 			       le32_to_cpu(alloc->id1.bitmap1.i_used),
 			       le32_to_cpu(alloc->id1.bitmap1.i_total),
-			       LOCAL_ALLOC(alloc)->la_bm_off);
+			       OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
 		status = -EBUSY;
 		goto bail;
 	}
 
-	if (!LOCAL_ALLOC(alloc)->la_size || 
-	    (LOCAL_ALLOC(alloc)->la_size > ocfs2_local_alloc_size(inode->i_sb))) {
+	if ((OCFS2_LOCAL_ALLOC(alloc)->la_size == 0) || 
+	    (OCFS2_LOCAL_ALLOC(alloc)->la_size > ocfs2_local_alloc_size(inode->i_sb))) {
 		LOG_ERROR_ARGS("Local alloc size is invalid (la_size = %u)\n",
-			      LOCAL_ALLOC(alloc)->la_size);
+			       OCFS2_LOCAL_ALLOC(alloc)->la_size);
 		status = -EINVAL;
 		goto bail;
 	}
@@ -586,8 +586,8 @@
 		goto bail;
 	}
 
-	bitmap = LOCAL_ALLOC(alloc)->la_bitmap;
-	*bit_off = LOCAL_ALLOC(alloc)->la_bm_off + start;
+	bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
+	*bit_off = OCFS2_LOCAL_ALLOC(alloc)->la_bm_off + start;
 	/* local alloc is always contiguous by nature -- we never
 	 * delete bits from it! */
 	*num_bits = bits_wanted;
@@ -629,8 +629,8 @@
 
 	LOG_ENTRY();
 
-	buffer = LOCAL_ALLOC(alloc)->la_bitmap;
-	for (i = 0; i < LOCAL_ALLOC(alloc)->la_size; i++)
+	buffer = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
+	for (i = 0; i < OCFS2_LOCAL_ALLOC(alloc)->la_size; i++)
 		count += hweight8(buffer[i]);
 
 	LOG_EXIT_ULONG ((unsigned long)count);
@@ -655,7 +655,7 @@
 		goto bail;
 	}
 
-	bitmap = LOCAL_ALLOC(alloc)->la_bitmap;
+	bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
 
 	numfound = bitoff = startoff = 0;
 	lastzero = -1;
@@ -709,9 +709,9 @@
 
 	alloc->id1.bitmap1.i_total = 0;
 	alloc->id1.bitmap1.i_used = 0;
-	LOCAL_ALLOC(alloc)->la_bm_off = 0;
-	for(i = 0; i < LOCAL_ALLOC(alloc)->la_size; i++)
-		LOCAL_ALLOC(alloc)->la_bitmap[i] = 0;
+	OCFS2_LOCAL_ALLOC(alloc)->la_bm_off = 0;
+	for(i = 0; i < OCFS2_LOCAL_ALLOC(alloc)->la_size; i++)
+		OCFS2_LOCAL_ALLOC(alloc)->la_bitmap[i] = 0;
 
 	LOG_EXIT();
 } /* ocfs_clear_local_alloc */
@@ -771,8 +771,8 @@
 	}
 
 	la_start_blk = ocfs2_clusters_to_blocks(osb->sb,
-						LOCAL_ALLOC(alloc)->la_bm_off);
-	bitmap = LOCAL_ALLOC(alloc)->la_bitmap;
+						OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
+	bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
 	start = count = bit_off = 0;
 	left = le32_to_cpu(alloc->id1.bitmap1.i_total);
 
@@ -889,19 +889,19 @@
 
 	alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
 
-	LOCAL_ALLOC(alloc)->la_bm_off = cluster_off;
+	OCFS2_LOCAL_ALLOC(alloc)->la_bm_off = cluster_off;
 	alloc->id1.bitmap1.i_total = cpu_to_le32(cluster_count);
 	/* just in case... In the future when we find space ourselves,
 	 * we don't have to get all contiguous -- but we'll have to
 	 * set all previously used bits in bitmap and update
 	 * la_bits_set before setting the bits in the main bitmap. */
 	alloc->id1.bitmap1.i_used = 0;
-	memset(LOCAL_ALLOC(alloc)->la_bitmap, 0,
-	       LOCAL_ALLOC(alloc)->la_size);
+	memset(OCFS2_LOCAL_ALLOC(alloc)->la_bitmap, 0,
+	       OCFS2_LOCAL_ALLOC(alloc)->la_size);
 
 	LOG_TRACE_STR("New window allocated:");
 	LOG_TRACE_ARGS("window la_bm_off = %u\n",
-		       LOCAL_ALLOC(alloc)->la_bm_off);
+		       OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
 	LOG_TRACE_ARGS("window bits = %u\n", le32_to_cpu(alloc->id1.bitmap1.i_total));
 
 bail:

Modified: trunk/fs/ocfs2/namei.c
===================================================================
--- trunk/fs/ocfs2/namei.c	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/namei.c	2005-03-30 23:43:11 UTC (rev 2089)
@@ -152,7 +152,7 @@
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
 			dentry->d_name.len, dentry->d_name.name);
 
-	if (dentry->d_name.len > OCFS2_MAX_FILENAME_LENGTH) {
+	if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) {
 		ret = ERR_PTR (-ENAMETOOLONG);
 		goto bail;
 	}
@@ -1948,14 +1948,14 @@
 	LOG_ENTRY();
 
 	*retval = NULL;
-	name = kmalloc(OCFS2_MAX_FILENAME_LENGTH+1, GFP_KERNEL);
+	name = kmalloc(OCFS2_MAX_FILENAME_LEN + 1, GFP_KERNEL);
 	if (!name) {
 		namelen = -ENOMEM;
 		LOG_ERROR_STATUS(namelen);
 		goto bail;
 	}
 
-	namelen = snprintf(name, OCFS2_MAX_FILENAME_LENGTH+1, "%llu", 
+	namelen = snprintf(name, OCFS2_MAX_FILENAME_LEN + 1, "%llu",
 			   blkno);
 	if (namelen <= 0) {
 		kfree(name);
@@ -2124,14 +2124,14 @@
 
 	LOG_ENTRY();
 
-	name = kmalloc(OCFS2_MAX_FILENAME_LENGTH+1, GFP_KERNEL);
+	name = kmalloc(OCFS2_MAX_FILENAME_LEN + 1, GFP_KERNEL);
 	if (!name) {
 		status = -ENOMEM;
 		LOG_ERROR_STATUS(status);
 		goto leave;
 	}
 
-	namelen = snprintf(name, OCFS2_MAX_FILENAME_LENGTH+1, "%llu", 
+	namelen = snprintf(name, OCFS2_MAX_FILENAME_LEN + 1, "%llu", 
 			   OCFS_I(inode)->ip_blkno);
 	if (namelen <= 0) {
 		if (namelen)

Modified: trunk/fs/ocfs2/ocfs.h
===================================================================
--- trunk/fs/ocfs2/ocfs.h	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/ocfs.h	2005-03-30 23:43:11 UTC (rev 2089)
@@ -71,19 +71,7 @@
 #define  OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED (0x00000001)
 #define  OCFS_FLAG_MEM_LISTS_INITIALIZED          (0x00000002)
 
-#define SHUTDOWN_SIGS   (sigmask(SIGKILL) | sigmask(SIGHUP) | \
-			 sigmask(SIGINT) | sigmask(SIGQUIT))
 
-#define OCFS_MAGIC                 0xa156f7eb
-
-#define OCFS_LINUX_MAX_FILE_SIZE   9223372036854775807LL
-
-#ifndef O_DIRECT
-#warning this depends on the architecture!
-#define O_DIRECT        040000
-#endif
-
-
 #define  IS_VALID_FILE_ENTRY(ptr)     \
 	(!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE))
 #define  IS_VALID_EXTENT_BLOCK(ptr)  \
@@ -95,12 +83,6 @@
 ** Structures...
 */
 
-#define  OCFS_NAME              "OCFS2"
-
-/* ioctl commands */
-#define  OCFS_IOC_MAGIC          'O'
-#define  OCFS_IOC_GETTYPE        _IOR(OCFS_IOC_MAGIC, 1, struct ocfs_ioc)
-
 #define OCFS_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
 #define OCFS2_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
 
@@ -424,14 +406,6 @@
 */
 extern ocfs_global_ctxt OcfsGlobalCtxt;
 
-struct ocfs_ioc
-{
-	char name[255];		/* "OCFS" */
-	char version[255];	/* version */
-	u16 nodenum;		/* node number */
-	char nodename[255];	/* node name */
-};
-
 #define NAMEI_RA_CHUNKS  2
 #define NAMEI_RA_BLOCKS  4
 #define NAMEI_RA_SIZE        (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)

Modified: trunk/fs/ocfs2/ocfs1_fs_compat.h
===================================================================
--- trunk/fs/ocfs2/ocfs1_fs_compat.h	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/ocfs1_fs_compat.h	2005-03-30 23:43:11 UTC (rev 2089)
@@ -28,12 +28,11 @@
 #ifndef _OCFS1_FS_COMPAT_H
 #define _OCFS1_FS_COMPAT_H
 
-#define MAX_VOL_SIGNATURE_LEN_V1          128
-#define MAX_MOUNT_POINT_LEN_V1            128
-#define MAX_VOL_ID_LENGTH_V1               16
-#define MAX_VOL_LABEL_LEN_V1               64
-#define MAX_CLUSTER_NAME_LEN_V1            64
-#define MAX_NODE_NAME_LENGTH	32
+#define OCFS1_MAX_VOL_SIGNATURE_LEN          128
+#define OCFS1_MAX_MOUNT_POINT_LEN            128
+#define OCFS1_MAX_VOL_ID_LENGTH               16
+#define OCFS1_MAX_VOL_LABEL_LEN               64
+#define OCFS1_MAX_CLUSTER_NAME_LEN            64
 
 #define OCFS1_MAJOR_VERSION              (2)
 #define OCFS1_MINOR_VERSION              (0)
@@ -46,8 +45,8 @@
 {
 /*00*/	__u32 minor_version;
 	__u32 major_version;
-/*08*/	__u8 signature[MAX_VOL_SIGNATURE_LEN_V1];
-/*88*/	__u8 mount_point[MAX_MOUNT_POINT_LEN_V1];
+/*08*/	__u8 signature[OCFS1_MAX_VOL_SIGNATURE_LEN];
+/*88*/	__u8 mount_point[OCFS1_MAX_MOUNT_POINT_LEN];
 /*108*/	__u64 serial_num;
 /*110*/	__u64 device_size;
 	__u64 start_off;
@@ -96,11 +95,11 @@
 typedef struct _ocfs1_vol_label
 {
 /*00*/	ocfs1_disk_lock disk_lock;
-/*30*/	__u8 label[MAX_VOL_LABEL_LEN_V1];
+/*30*/	__u8 label[OCFS1_MAX_VOL_LABEL_LEN];
 /*70*/	__u16 label_len;
-/*72*/	__u8 vol_id[MAX_VOL_ID_LENGTH_V1];
+/*72*/	__u8 vol_id[OCFS1_MAX_VOL_ID_LENGTH];
 /*82*/	__u16 vol_id_len;
-/*84*/	__u8 cluster_name[MAX_CLUSTER_NAME_LEN_V1];
+/*84*/	__u8 cluster_name[OCFS1_MAX_CLUSTER_NAME_LEN];
 /*A4*/	__u16 cluster_name_len;
 /*A6*/
 } ocfs1_vol_label;

Modified: trunk/fs/ocfs2/ocfs2.h
===================================================================
--- trunk/fs/ocfs2/ocfs2.h	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/ocfs2.h	2005-03-30 23:43:11 UTC (rev 2089)
@@ -26,8 +26,6 @@
 #ifndef OCFS2_H
 #define OCFS2_H
 
-#define OCFS2_MAX_NODE_NAME_LENGTH	65
-
 static inline u64 ocfs2_clusters_to_blocks(struct super_block *sb,
 					   u32 clusters)
 {

Modified: trunk/fs/ocfs2/ocfs2_fs.h
===================================================================
--- trunk/fs/ocfs2/ocfs2_fs.h	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/ocfs2_fs.h	2005-03-30 23:43:11 UTC (rev 2089)
@@ -43,12 +43,22 @@
 #define OCFS2_SUPER_BLOCK_BLKNO		2
 
 /*
- * As OCFS2 has a minimum clustersize of 4K, it has a maximum blocksize
- * of 4K
+ * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
+ * grow if needed.
  */
+#define OCFS2_MIN_CLUSTERSIZE		4096
+#define OCFS2_MAX_CLUSTERSIZE		1048576
+
+/*
+ * Blocks cannot be bigger than clusters, so the maximum blocksize is the
+ * minimum cluster size.
+ */
 #define OCFS2_MIN_BLOCKSIZE		512
-#define OCFS2_MAX_BLOCKSIZE		4096
+#define OCFS2_MAX_BLOCKSIZE		OCFS2_MIN_CLUSTERSIZE
 
+/* Filesystem magic number */
+#define OCFS2_SUPER_MAGIC		0xa156f7eb
+
 /* Object signatures */
 #define OCFS2_SUPER_BLOCK_SIGNATURE	"OCFSV2"
 #define OCFS2_INODE_SIGNATURE		"INODE01"
@@ -107,20 +117,21 @@
 #define OCFS2_ERROR_FS		(0x00000001)	/* FS saw errors */
 
 /* Limit of space in ocfs2_dir_entry */
-#define OCFS2_MAX_FILENAME_LENGTH       255
+#define OCFS2_MAX_FILENAME_LEN		255
 
 /* Limit of node map bits in ocfs2_disk_lock */
 #define OCFS2_MAX_NODES			255
 
-#define MAX_VOL_ID_LENGTH               16
-#define MAX_VOL_LABEL_LEN               64
-#define MAX_CLUSTER_NAME_LEN            64
+#define OCFS2_VOL_UUID_LEN		16
+#define OCFS2_MAX_VOL_LABEL_LEN		64
 
+#define OCFS2_MAX_CLUSTER_NAME_LEN	64
 
-#define ONE_MEGA_BYTE           	(1 * 1024 * 1024)   /* in bytes */
-#define OCFS2_DEFAULT_JOURNAL_SIZE	(8 * ONE_MEGA_BYTE)
-#define OCFS2_MIN_JOURNAL_SIZE		(4 * ONE_MEGA_BYTE)
 
+/* Journal limits (in bytes) */
+#define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
+#define OCFS2_MAX_JOURNAL_SIZE		(500 * 1024 * 1024)
+
 struct ocfs2_system_inode_info {
 	char	*si_name;
 	int	si_iflags;
@@ -208,8 +219,8 @@
 /*
  * Convenience casts
  */
-#define OCFS2_RAW_SB(dinode)	(&((dinode)->id2.i_super))
-#define LOCAL_ALLOC(dinode)	(&((dinode)->id2.i_lab))
+#define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))
+#define OCFS2_LOCAL_ALLOC(dinode)	(&((dinode)->id2.i_lab))
 
 
 /*
@@ -313,8 +324,8 @@
 	__u32 s_reserved2;
 	__u64 s_first_cluster_group;	/* Block offset of 1st cluster
 					 * group header */
-/*50*/	__u8  s_label[64];		/* Label for mounting, etc. */
-/*90*/	__u8  s_uuid[16];		/* Was vol_id */
+/*50*/	__u8  s_label[OCFS2_MAX_VOL_LABEL_LEN];	/* Label for mounting, etc. */
+/*90*/	__u8  s_uuid[OCFS2_VOL_UUID_LEN];	/* 128-bit uuid */
 /*A0*/
 } ocfs2_super_block;
 
@@ -396,7 +407,7 @@
 	__u16   rec_len;                /* Directory entry length */
 	__u8    name_len;               /* Name length */
 	__u8    file_type;
-/*0C*/	char    name[OCFS2_MAX_FILENAME_LENGTH];    /* File name */
+/*0C*/	char    name[OCFS2_MAX_FILENAME_LEN];   /* File name */
 /* Actual on-disk length specified by rec_len */
 };
 

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/super.c	2005-03-30 23:43:11 UTC (rev 2089)
@@ -68,6 +68,8 @@
 
 #include "buffer_head_io.h"
 
+#define OCFS_LINUX_MAX_FILE_SIZE	9223372036854775807LL
+
 #define OCFS_DEBUG_CONTEXT  OCFS_DEBUG_CONTEXT_SUPER
 
 /*
@@ -327,11 +329,11 @@
 		goto read_super_error;
 	}
 
-	sb->s_magic = OCFS_MAGIC;
+	sb->s_magic = OCFS2_SUPER_MAGIC;
 	sb->s_op = &ocfs_sops;
 	sb->s_flags |= MS_NOATIME;
 
-	/* this is needed to support O_LARGE_FILE */
+	/* this is needed to support O_LARGEFILE */
 	sb->s_maxbytes = OCFS_LINUX_MAX_FILE_SIZE;
 
 	status = ocfs_mount_volume (sb, reclaim_id, NULL);
@@ -499,9 +501,7 @@
 	}
 
 	memset (&OcfsGlobalCtxt, 0, sizeof (ocfs_global_ctxt));
-
 	INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
-	INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
 
 	/* Initialize the global data resource */
 	init_MUTEX (&(OcfsGlobalCtxt.global_res));
@@ -634,9 +634,9 @@
 	numbits = le32_to_cpu(bm_lock->id1.bitmap1.i_total);
 	freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used);
 
-	buf->f_type = OCFS_MAGIC;
+	buf->f_type = OCFS2_SUPER_MAGIC;
 	buf->f_bsize = sb->s_blocksize;
-	buf->f_namelen = OCFS2_MAX_FILENAME_LENGTH;
+	buf->f_namelen = OCFS2_MAX_FILENAME_LEN;
 	buf->f_blocks = ((sector_t) numbits) *
 			(osb->s_clustersize >> osb->sb->s_blocksize_bits);
 	buf->f_bfree = ((sector_t) freebits) *
@@ -1019,15 +1019,15 @@
 	int i, ret;
 	char *ptr;
 
-	BUG_ON(uuid_bytes != MAX_VOL_ID_LENGTH);
+	BUG_ON(uuid_bytes != OCFS2_VOL_UUID_LEN);
 
-	osb->uuid_str = kcalloc(1, MAX_VOL_ID_LENGTH*2 + 1, GFP_KERNEL);
+	osb->uuid_str = kcalloc(1, OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL);
 	if (osb->uuid_str == NULL)
 		return -ENOMEM;
 
-	memcpy(osb->uuid, uuid, MAX_VOL_ID_LENGTH);
+	memcpy(osb->uuid, uuid, OCFS2_VOL_UUID_LEN);
 
-	for (i = 0, ptr = osb->uuid_str; i < MAX_VOL_ID_LENGTH; i++) {
+	for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) {
 		/* print with null */
 		ret = snprintf(ptr, 3, "%02X", uuid[i]);
 		if (ret != 2) /* drop super cleans up */
@@ -1062,7 +1062,7 @@
 		status = -ENOMEM;
 		goto bail;
 	}
-	osb->uuid = kmalloc(MAX_VOL_ID_LENGTH, GFP_KERNEL);
+	osb->uuid = kmalloc(OCFS2_VOL_UUID_LEN, GFP_KERNEL);
 	if (!osb->uuid) {
 		LOG_ERROR_STR("unable to alloc uuid");
 		status = -ENOMEM;

Modified: trunk/fs/ocfs2/vote.c
===================================================================
--- trunk/fs/ocfs2/vote.c	2005-03-30 23:31:35 UTC (rev 2088)
+++ trunk/fs/ocfs2/vote.c	2005-03-30 23:43:11 UTC (rev 2089)
@@ -821,7 +821,7 @@
 
 int ocfs2_register_net_handlers(ocfs_super *osb)
 {
-	int i = MAX_VOL_ID_LENGTH - sizeof(osb->net_key);
+	int i = OCFS2_VOL_UUID_LEN - sizeof(osb->net_key);
 	int status = 0;
 
 	memcpy(&osb->net_key, &osb->uuid[i], sizeof(osb->net_key));



More information about the Ocfs2-commits mailing list