[Ocfs2-commits] jlbec commits r1152 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Jun 18 18:08:53 CDT 2004


Author: jlbec
Date: 2004-06-18 17:08:51 -0500 (Fri, 18 Jun 2004)
New Revision: 1152

Modified:
   trunk/src/buffer_head_io.c
   trunk/src/namei.c
   trunk/src/nm.c
   trunk/src/ocfs.h
   trunk/src/ocfs2_fs.h
   trunk/src/ocfs_compat.h
   trunk/src/super.c
Log:

o Remove more useless junk.



Modified: trunk/src/buffer_head_io.c
===================================================================
--- trunk/src/buffer_head_io.c	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/buffer_head_io.c	2004-06-18 22:08:51 UTC (rev 1152)
@@ -63,38 +63,9 @@
 	return;
 }
 
-#warning should we really still be doing this every write
-/*
- * This is an ugly sign of no-confidence.  Heck, we should never write
- * block 0 under *any* circumstances now, as our superblock is
- * block 2 
- */
-#include "ocfs1_fs_compat.h"
-static inline int check_block_zero_write(struct buffer_head *bh)
+int ocfs_write_bhs (ocfs_super *osb, struct buffer_head *bhs[], 
+		    int nr, int flags, struct inode *inode)
 {
-	if (unlikely(bh->b_blocknr == 0)) {
-		ocfs1_vol_disk_hdr *hdr = (ocfs1_vol_disk_hdr *) bh->b_data;
-
-		if (hdr == NULL) {
-			printk ("ocfs2: failed to map bh page!!!\n");
-			return -EIO;
-		}
-
-		if (memcmp(hdr->signature, 
-			   OCFS1_VOLUME_SIGNATURE, 
-			   strlen(OCFS1_VOLUME_SIGNATURE)) != 0) {
-			printk("ocfs2: WARNING! attempting to write non "
-			       "volume header to block 0\n");
-			return -EIO;
-		}
-	}
-
-	return 0;
-}
-
-int ocfs_write_bhs (ocfs_super * osb, struct buffer_head *bhs[], 
-				  int nr, int flags, struct inode *inode)
-{
 	int status = 0;
 	int i;
 	struct super_block *sb;
@@ -143,7 +114,8 @@
 			goto bail;
 		}
 
-		if (check_block_zero_write(bh) < 0) {
+		if (unlikely(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO)) {
+			BUG();
 			status = -EIO;	
 			LOG_ERROR_STATUS(status);
 			goto bail;

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/namei.c	2004-06-18 22:08:51 UTC (rev 1152)
@@ -277,14 +277,14 @@
 		de->rec_len =
 			cpu_to_le16(OCFS2_DIR_REC_LEN(de->name_len));
 		strcpy (de->name, ".");
-		ocfs_set_de_type(dir->i_sb, de, S_IFDIR);
+		ocfs_set_de_type(de, S_IFDIR);
 		de = (struct ocfs2_dir_entry *) ((char *) de + le16_to_cpu(de->rec_len));
 		de->inode = cpu_to_le64(GET_INODE_FEOFF(dir) >> dir->i_sb->s_blocksize_bits);
 		de->rec_len = cpu_to_le16(inode->i_sb->s_blocksize -
 					  OCFS2_DIR_REC_LEN(1));
 		de->name_len = 2;
 		strcpy (de->name, "..");
-		ocfs_set_de_type(dir->i_sb, de, S_IFDIR);
+		ocfs_set_de_type(de, S_IFDIR);
 		inode->i_nlink = 2;
 		status = ocfs_journal_dirty(handle, newdirbh);
 		brelse (newdirbh);
@@ -1605,7 +1605,7 @@
 			de->file_type = OCFS2_FT_UNKNOWN;
 			if (blkno) {
 				de->inode = cpu_to_le64(blkno);
-				ocfs_set_de_type(dir->i_sb, de, inode->i_mode);
+				ocfs_set_de_type(de, inode->i_mode);
 			} else
 				de->inode = 0;
 			de->name_len = namelen;

Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/nm.c	2004-06-18 22:08:51 UTC (rev 1152)
@@ -274,8 +274,6 @@
 	LOG_ENTRY ();
 
 	osb = arg;
-	if (osb->obj_id.type != OCFS_TYPE_OSB)
-		goto eek;
 
 	sprintf (proc, "ocfs2nm-%d", osb->osb_id);
 	ocfs_daemonize (proc, strlen(proc));
@@ -449,7 +447,7 @@
 	flush_scheduled_work();
 
 	complete (&(osb->dlm_complete));
-eek:
+
 	LOG_EXIT_INT (0);
 	return 0;
 }				/* ocfs_volume_thread */

Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/ocfs.h	2004-06-18 22:08:51 UTC (rev 1152)
@@ -23,7 +23,7 @@
  * Boston, MA 021110-1307, USA.
  *
  * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
- *	    Manish Singh, Neeraj Goyal, Suchit Kaura
+ *	    Manish Singh, Neeraj Goyal, Suchit Kaura, Joel Becker
  */
 
 #ifndef OCFS_H
@@ -96,14 +96,6 @@
 #define  OCFS_DLM_MAX_MSG_SIZE			256
 #define  OCFS_DLM_MSG_MAGIC			0x79677083
 
-enum {
-    OSB_DATA_LOCK,
-    OSB_MD_LOCK,
-    OSB_CFG_LOCK,
-    OSB_LOG_LOCK
-};
-
-
 /* convenience macro */
 
 #define OCFS_ASSERT(x)             do { if (!(x)) BUG(); } while (0)
@@ -115,13 +107,6 @@
 			     - (((x)>>3)&0x11111111))
 
 
-#ifndef list_for_each_prev_safe
-#define list_for_each_prev_safe(pos, n, head) \
-	for (pos = (head)->prev, n = pos->prev; pos != (head); \
-		pos = n, n = pos->prev)
-#endif
-
-
 #define OCFS_CURRENT_TIME               ocfs_get_seconds(CURRENT_TIME)
 #define OCFS_SET_INODE_TIME(i, x, y)    (ocfs_get_seconds(i->x) = (y))
 
@@ -197,12 +182,6 @@
 	NONLOCAL_EXT = 2
 } ocfs_ext_flag;
 
-/*
-** Structure signatures 
-*/
-#define  OCFS_TYPE_OSB            (0x05534643)
-#define  OCFS_TYPE_GLOBAL_DATA    (0x07534643)
-
 // LOCKTYPE ONE
 #define  OCFS_DLM_NO_LOCK              (0x0)
 #define  OCFS_DLM_EXCLUSIVE_LOCK       (0x2)
@@ -210,14 +189,6 @@
 
 #define  OCFS_INVALID_NODE_NUM         UINT_MAX
 
-typedef enum _ocfs_rw_mode
-{
-	OCFS_READ,
-	OCFS_WRITE
-}
-ocfs_rw_mode;
-
-
 /* lockres->lock_state flags */
 #define  FLAG_READONLY_DROPPING        0x00000008
 
@@ -250,11 +221,6 @@
 #define  FLAG_VOTE_FILE_DEL           0x10
 
 
-#define  INVALID_NODE_POINTER		-1
-#define  OCFS_LOCAL_ALLOC_SIGNATURE	"LCLBMP"
-
-#define  MAX_IP_ADDR_LEN	32
-
 #define SHUTDOWN_SIGS   (sigmask(SIGKILL) | sigmask(SIGHUP) | \
 			 sigmask(SIGINT) | sigmask(SIGQUIT))
 
@@ -264,10 +230,7 @@
 #define OCFS_MAGIC                 0xa156f7eb
 
 #define OCFS_LINUX_MAX_FILE_SIZE   9223372036854775807LL
-#define INITIAL_EXTENT_MAP_SIZE    10
 
-#define OCFS_UNUSED_INODE_NUMBER   1
-
 #define OCFS_VOLCFG_LOCK_ITERATE	(HZ/10)	/* in jiffies */
 #define OCFS_VOLCFG_LOCK_TIME		1000    /* in ms */
 #define OCFS_VOLCFG_HDR_SECTORS		2	/* in sectors */
@@ -281,14 +244,7 @@
 #define O_DIRECT        040000
 #endif
 
-#define NOT_MOUNTED_EXCLUSIVE   (-1)
 
-
-#define BLOCKS_PER_CLEAN_LIST     ( ((PAGE_SIZE-sizeof(void *))/sizeof(unsigned long)) >> 3 )
-
-#ifndef  _OCFSDEF_H_
-#define  _OCFSDEF_H_
-
 /* sm - ocfs 1.0 fails to set fe->sig for dirs */
 #define  IS_VALID_FILE_ENTRY(ptr)     \
 	(!strcmp((ptr)->i_signature, OCFS2_FILE_ENTRY_SIGNATURE))
@@ -336,14 +292,7 @@
 }
 
 
-typedef enum _ocfs_protocol
-{
-	OCFS_TCP = 1,
-	OCFS_UDP
-}
-ocfs_protocol;
 
-
 #define ocfs_allocate_extent_entry()  (ocfs_extent *)kmem_cache_alloc ( \
 						    OcfsGlobalCtxt.extent_cache, GFP_NOFS)
 #define ocfs_free_extent_entry(ext)   kmem_cache_free(OcfsGlobalCtxt.extent_cache, ext)
@@ -356,16 +305,6 @@
 #define  OCFS_IOC_GETTYPE        _IOR(OCFS_IOC_MAGIC, 1, struct ocfs_ioc)
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-typedef long sector_t;
-#define map_bh(bh, sb, blk)   \
-	({ \
-	 	bh->b_dev = sb->s_dev; \
-		bh->b_blocknr = blk; \
-		bh->b_state |= (1UL << BH_Mapped); \
-	})
-#endif
-
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 typedef dev_t ocfs_dev;
 #define OCFS_NODEV     0
@@ -428,14 +367,7 @@
 ocfs_extent_map;
 
 
-typedef struct _ocfs_obj_id
-{
-	__u32 type;		/* 4 byte signature to uniquely identify the struct */
-	__u32 size;		/* sizeof the struct */
-}
-ocfs_obj_id;
 
-
 typedef struct _ocfs_super ocfs_super;
 typedef struct _ocfs_lock_res ocfs_lock_res;
 
@@ -626,7 +558,6 @@
  */
 struct _ocfs_super
 {
-	ocfs_obj_id obj_id;
 	struct semaphore osb_res; /* resource to protect the ocfs_super */
 	struct list_head osb_next;	/* list of ocfs_super(s) */
 	__u32 osb_id;		/* id used by the proc interface */
@@ -732,7 +663,6 @@
 
 typedef struct _ocfs_global_ctxt
 {
-	ocfs_obj_id obj_id;
 	struct semaphore global_res;
 	struct list_head osb_next;	/* List of all volumes */
 	kmem_cache_t *inode_cache;
@@ -1051,17 +981,9 @@
 		__ocfs_wait(wq, condition, timeout, __ret);	\
 	__ret;							\
 })
-#endif				/* !USERSPACE_TOOL */
 
 
 
-static inline unsigned long ino_from_fe_off(struct inode *inode)
-{
-	__u64 block_off = GET_INODE_FEOFF(inode) >> inode->i_sb->s_blocksize_bits;
-
-	return (unsigned long)(block_off & (__u64)ULONG_MAX);
-}
-
 static inline unsigned long ino_from_blkno(struct super_block *sb,
 					   u64 blkno)
 {
@@ -1076,13 +998,6 @@
 	return (unsigned long)(block_off & (__u64)ULONG_MAX);
 }
 
-static inline void ocfs_set_de_type(struct super_block *sb,
-				    struct ocfs2_dir_entry *de,
-				    umode_t mode)
-{
-	de->file_type = ocfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
-}
-
 static inline ocfs_bitmap_free_head * ocfs_alloc_bitmap_free_head(void)
 {
 	struct _ocfs_bitmap_free_head *f;
@@ -1153,56 +1068,6 @@
 	return -EINVAL;
 }
 
-#define ocfs_check_inode(inode)  __ocfs_check_inode(inode, __LINE__)
-
-/* call this right before an atomic_dec or iput. */
-static inline void __ocfs_check_inode(struct inode *inode, unsigned int line)
-{
-	struct dentry *dentry = NULL;
-	struct list_head *iter;
-	int max_cnt = 1; /* one for the inode hash */
-	ocfs_super *osb = NULL;
-
-	if (!inode)
-		return;
-
-	osb = OCFS_SB(inode->i_sb);
-
-	if (INODE_DELETED(inode))
-		max_cnt--;
-
-	list_for_each (iter, &(inode->i_dentry)) {
-		dentry = list_entry (iter, struct dentry, d_alias);
-		// what the heck, take the first one ;-)
-		break;
-	}
-
-	/* add one for the dentrys ref... */
-	if (dentry)
-		max_cnt++;
-
-	/* +1 for the ref you're about to remove. */
-	if (atomic_read(&inode->i_count) >= (max_cnt+1))
-		return;
-
-
-	LOG_ERROR_ARGS("max_cnt = %d, line = %u\n", max_cnt, line);
-	if (dentry)
-		LOG_ERROR_ARGS("eek! i_count=%d, i_state=%lu, i_ino=%lu, name='%*s'\n",
-			       atomic_read(&inode->i_count), inode->i_state, inode->i_ino,
-			       dentry->d_name.len, dentry->d_name.name);
-	else
-		LOG_ERROR_ARGS("eek! i_count=%d, i_state=%lu, i_ino=%lu, no dentry\n",
-			       atomic_read(&inode->i_count), inode->i_state, inode->i_ino);
-
-	LOG_ERROR_ARGS("feoff=%llu, deleted=%u\n", 
-		       GET_INODE_FEOFF(inode),
-		       INODE_DELETED(inode));
-
-	BUG();
-}
-
-
 static inline int ocfs_is_local_cache_lock(ocfs_super *osb, struct inode *inode)
 {
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
@@ -1212,43 +1077,6 @@
 	return 0;
 }
 
-static inline int ocfs_get_right_shift_bits(int num)
-{
-	int i, ret;
-
-	ret = 0;
-	for (i=0; i<32; i++) {
-		if (1 << i == num) {
-			ret = i;
-			break;
-		}
-	}
-	return ret;
-}
-
-static inline int ocfs_extent_for_offset(struct super_block *sb,
-					 ocfs2_extent_block *eb,
-					 u64 vbo)
-{ 
-	int k;
-	ocfs2_extent_list *el = &eb->h_list;
-	ocfs2_extent_rec *ext;
-	u32 cluster;
-	u64 byte_off;
-
-	for (k = 0; k < el->l_count; k++) {
-		ext = &el->l_recs[k];
-
-		cluster = ext->e_cpos + ext->e_clusters;
-		byte_off = cluster << OCFS_SB(sb)->s_clustersize_bits;
-
-      		if (byte_off >= vbo)
-	    		break;
-	}
-
-	return k;
-}
-
 static inline u64 ocfs_clusters_to_blocks(struct super_block *sb,
 		    			  u32 clusters)
 {

Modified: trunk/src/ocfs2_fs.h
===================================================================
--- trunk/src/ocfs2_fs.h	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/ocfs2_fs.h	2004-06-18 22:08:51 UTC (rev 1152)
@@ -523,4 +523,11 @@
 	return chars;
 }
 
+static inline void ocfs_set_de_type(struct ocfs2_dir_entry *de,
+				    umode_t mode)
+{
+	de->file_type = ocfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
+}
+
 #endif  /* _OCFS2_FS_H */
+

Modified: trunk/src/ocfs_compat.h
===================================================================
--- trunk/src/ocfs_compat.h	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/ocfs_compat.h	2004-06-18 22:08:51 UTC (rev 1152)
@@ -64,8 +64,29 @@
 {
 	return getblk(sb->s_dev, block, sb->s_blocksize);
 }
+
+/* Assumes that blocksize is > 256 */
+static inline unsigned int blksize_bits(unsigned int size)
+{
+	unsigned int bits = 8;
+	do {
+		bits++;
+		size >>= 1;
+	} while (size > 256);
+	return bits;
+}
 #endif
 
+typedef long sector_t;
+
+#define map_bh(bh, sb, blk) \
+	({ \
+	 typeof(bh) _bh = (bh); \
+	 _bh->b_dev = (sb)->s_dev; \
+	 _bh->b_blocknr = (blk); \
+	 _bh->b_state |= (1UL << BH_Mapped); \
+	 })
+
 #define io_schedule		schedule
 #define io_schedule_timeout	schedule_timeout
 #define bdev_hardsect_size(b)	get_hardsect_size((b)->bd_dev);

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-06-18 19:47:10 UTC (rev 1151)
+++ trunk/src/super.c	2004-06-18 22:08:51 UTC (rev 1152)
@@ -537,10 +537,6 @@
 	if ((status = ocfs_read_params ()) < 0)
 	    goto leave;
 
-	/* Initialize some required fields */
-	OcfsGlobalCtxt.obj_id.type = OCFS_TYPE_GLOBAL_DATA;
-	OcfsGlobalCtxt.obj_id.size = sizeof (ocfs_global_ctxt);
-
 	/* Initialize the global data resource */
 	init_MUTEX (&(OcfsGlobalCtxt.global_res));
 	OCFS_SET_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED);
@@ -970,7 +966,7 @@
 	osb->sb = sb;
 
 	/* Save off for ocfs_rw_direct */
-	osb->s_sectsize_bits = ocfs_get_right_shift_bits(sector_size);
+	osb->s_sectsize_bits = blksize_bits(sector_size);
 	if (!osb->s_sectsize_bits)
 		BUG();
 
@@ -1451,8 +1447,6 @@
 		
 	OCFS_CLEAR_FLAG (osb->osb_flags, OCFS_OSB_FLAGS_SHUTDOWN);
 
-	osb->obj_id.type = OCFS_TYPE_OSB;
-	osb->obj_id.size = sizeof (ocfs_super);
 	INIT_LIST_HEAD (&(osb->osb_next));
 
 	snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",



More information about the Ocfs2-commits mailing list