[Ocfs2-commits] mfasheh commits r846 - in branches/nooin/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Apr 16 17:49:59 CDT 2004


Author: mfasheh
Date: 2004-04-16 16:49:58 -0500 (Fri, 16 Apr 2004)
New Revision: 846

Modified:
   branches/nooin/src/alloc.c
   branches/nooin/src/dcache.c
   branches/nooin/src/dlm.c
   branches/nooin/src/file.c
   branches/nooin/src/inc/ocfs.h
   branches/nooin/src/inc/proto.h
   branches/nooin/src/inode.c
   branches/nooin/src/journal.c
   branches/nooin/src/namei.c
   branches/nooin/src/nm.c
   branches/nooin/src/oin.c
   branches/nooin/src/super.c
   branches/nooin/src/sysfile.c
Log:
* get rid of the obj_id field from oin
  
* move the following oin fields to the inode: inode, recovery_list,
  chng_seq_num, open_hndl_cnt, needs_verification

* fix things so that almost no public functions take an ocfs_inode as an
  argument. This makes it alot easier to move the remaining fields to the   
  inode.

* add a root_inode member to osb. This will eventually replace oin_root_dir.

* add an OCFS_I macro, which should be our new prefferred way of getting to 
  the inode private members.



Modified: branches/nooin/src/alloc.c
===================================================================
--- branches/nooin/src/alloc.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/alloc.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -1159,7 +1159,7 @@
  * ocfs_allocate_extent()
  *
  */
-int ocfs_allocate_extent (ocfs_super * osb, ocfs_inode * oin, struct buffer_head *fe_bh, ocfs_journal_handle *handle, __u64 actualDiskOffset, __u64 actualLength, struct inode *inode)
+int ocfs_allocate_extent (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_journal_handle *handle, __u64 actualDiskOffset, __u64 actualLength, struct inode *inode)
 {
 	int status = 0;
 	bool IncreaseTreeDepth = false;
@@ -1169,9 +1169,13 @@
 	bool UpdateParent = false;
 	__u64 newExtentOff, up_ptr;
 	ocfs_file_entry * FileEntry = NULL;
+	ocfs_inode *oin = NULL;
 
 	LOG_ENTRY_ARGS("(actualDiskOffset=%u.%u, actualLength=%u.%u)\n", actualDiskOffset, actualLength);
 
+	if (inode)
+		oin = GET_INODE_OIN(inode);
+
 	FileEntry = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(fe_bh);  /* write */
 	OCFS_ASSERT (FileEntry);
 
@@ -2459,7 +2463,7 @@
  * decoded and updated in the extent map.
  *
  */
-int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode)
+int ocfs_lookup_file_allocation (ocfs_super * osb, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode)
 {
 	int status = -EFAIL;
 	ocfs_file_entry *fe = NULL;
@@ -2471,12 +2475,13 @@
 	__s64 localVbo;
 	__u64 cnt;
 	__u32 NumIndex;
+	ocfs_inode *oin = NULL;
 
 	LOG_ENTRY ();
 
 	OCFS_ASSERT (osb);
-	OCFS_ASSERT (oin);
 	OCFS_ASSERT (inode);
+	oin = GET_INODE_OIN(inode);
 
 	if (INODE_JOURNAL(inode) || Vbo < oin->alloc_size) {
 		if (ocfs_lookup_extent_map_entry (osb, &(oin->map), 

Modified: branches/nooin/src/dcache.c
===================================================================
--- branches/nooin/src/dcache.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/dcache.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -97,8 +97,8 @@
                 /* hit the disk */
                 /* TODO: optimize */
 		ocfs_down_sem (&(oin->main_res), true);
-		oin->needs_verification = true;
-		tmpstat = ocfs_verify_update_oin(osb, oin, &needs_trunc);
+		OCFS_I(inode)->needs_verification = true;
+		tmpstat = ocfs_verify_update_inode(osb, inode, &needs_trunc);
 		if (tmpstat < 0)
 			LOG_ERROR_STATUS (tmpstat);
 		ocfs_up_sem (&(oin->main_res));

Modified: branches/nooin/src/dlm.c
===================================================================
--- branches/nooin/src/dlm.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/dlm.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -1086,16 +1086,19 @@
  * ocfs_create_update_lock()
  *
  */
-int ocfs_create_update_lock (ocfs_super * osb, ocfs_inode * oin, __u64 lock_id, __u32 flags, bool new_file, struct inode *inode, ocfs_journal_handle *handle)
+int ocfs_create_update_lock (ocfs_super * osb, __u64 lock_id, __u32 flags, bool new_file, struct inode *inode, ocfs_journal_handle *handle)
 {
 	int status = 0;
 	ocfs_lock_res *lockres = NULL;
 	ocfs_lock_res *tmp_lockres = NULL;
 	bool is_dir = false;
+	ocfs_inode *oin = NULL;
 
 	LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, %u.%u, %u)\n", osb, oin,
 			HI (lock_id), LO (lock_id), flags);
 
+	oin = GET_INODE_OIN(inode);
+
 	is_dir = (flags & OCFS_OIN_DIRECTORY) ? true : false;
 
 	/* Check the lock state on the disk / in our resource map */

Modified: branches/nooin/src/file.c
===================================================================
--- branches/nooin/src/file.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/file.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -141,7 +141,7 @@
 	}
 
 	/* first open, we've gotta update the lock state. */
-	if (!oin->open_hndl_cnt) {
+	if (!OCFS_I(inode)->open_hndl_cnt) {
 		status = ocfs_read_bh(osb, GET_INODE_FEOFF(inode), &fe_bh, 
 				      OCFS_BH_CACHED, inode);
 		if (status < 0) {
@@ -181,9 +181,8 @@
 		goto leave;
 	}
 
-	/* only call ocfs_verify_update_oin if there's a good inode */
-	if (oin->inode == inode && OIN_NEEDS_VERIFICATION(oin)) {
-		status = ocfs_verify_update_oin (osb, oin, &truncate_pages);
+	if (OCFS_I(inode)->needs_verification) {
+		status = ocfs_verify_update_inode (osb, inode, &truncate_pages);
 		if (status < 0) {
 			/*  disable VOLUME TODO */
 			LOG_ERROR_STATUS (status);
@@ -191,12 +190,13 @@
 		}
 	}
 
-	if (oin->open_hndl_cnt > 0) {
+	if (OCFS_I(inode)->open_hndl_cnt > 0) {
 		/*  The OIN is currently in use by some thread. */
 		/*  We must check whether the requested access/share access */
 		/*  conflicts with the existing open operations. */
 
-		LOG_TRACE_ARGS ("oin->open_hndl_cnt > 0! : %u\n", oin->open_hndl_cnt);
+		LOG_TRACE_ARGS ("oin->open_hndl_cnt > 0! : %u\n", 
+				OCFS_I(inode)->open_hndl_cnt);
 		if (!(mode & O_DIRECT)) {
 			if ((oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO) && !(mode & O_RDONLY)) {
 				status = -EACCES;
@@ -227,7 +227,7 @@
 		}
 	}
 
-	oin->open_hndl_cnt++;
+	OCFS_I(inode)->open_hndl_cnt++;
 
 	/* We should clear the in use now as we are safe from the case */
 	/* where the voting thread can vote and we have an open in */
@@ -339,32 +339,16 @@
 			        ocfs_safefree (ofile->curr_dir_buf);
 			        ofile->curr_dir_buf = NULL;
 		        }
-		     		BUG();
-   ocfs_release_ofile (ofile);
+			ocfs_release_ofile (ofile);
                 }
                 goto bail;
         }
 
 	oin = GET_INODE_OIN(inode);
 
-	if (oin->obj_id.type != OCFS_TYPE_OIN ||
-	    oin->obj_id.size != sizeof (ocfs_inode) ||
-	    oin->main_res.magic != OCFS_SEM_MAGIC) {
-		int i;
-		
-		LOG_ERROR_ARGS("oin appears to have been freed!  oin=%p, inode->oin=%p\n",
-			       oin, GET_INODE_OIN(inode));
-		for (i=0; i<sizeof (ocfs_inode); i++) {
-			printk("%03x ", ((char *)oin)[i]);
-		}
-		printk("\n");
-		goto bail;
-	}
-		
-
         ocfs_down_sem (&(oin->main_res), true);
-        oin->open_hndl_cnt--;
-	if (!oin->open_hndl_cnt) 
+        OCFS_I(inode)->open_hndl_cnt--;
+	if (!OCFS_I(inode)->open_hndl_cnt) 
 		last_close = true;
 
         if (oin->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
@@ -373,7 +357,7 @@
         }
 
         LOG_TRACE_ARGS ("openhandles: %d / osbfiles: %d / refcount: %d\n",
-                         oin->open_hndl_cnt, osb->file_open_cnt,
+                        OCFS_I(inode)->open_hndl_cnt, osb->file_open_cnt,
                         atomic_read(&dentry->d_count)); 
 
 	if (last_close) {
@@ -653,8 +637,8 @@
 	if (!(filp->f_flags & O_DIRECT)) {
 		/* FIXME: is the down_sem supposed to be here?! */
 		LOG_TRACE_ARGS ("non O_DIRECT write, fileopencount=%d\n",
-				oin->open_hndl_cnt);
-		if (oin->open_hndl_cnt > 1) {
+				OCFS_I(inode)->open_hndl_cnt);
+		if (OCFS_I(inode)->open_hndl_cnt > 1) {
 			if (oin->oin_flags & OCFS_OIN_OPEN_FOR_WRITE) {
 				LOG_TRACE_STR
 				    ("uh oh! someone else is doing non O_DIRECT writes!\n");
@@ -669,15 +653,15 @@
 		}
 	}
 
-	if (OIN_NEEDS_VERIFICATION (oin)) {
+	if (OCFS_I(inode)->needs_verification) {
 		LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
 		ocfs_down_sem (&(oin->main_res), true);
-		status = ocfs_verify_update_oin (osb, oin, &needs_trunc);
+		status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
 		ocfs_up_sem (&(oin->main_res));
 		if (needs_trunc)
 			ocfs_truncate_inode_pages(inode, 0);
 		if (status < 0) {
-			LOG_TRACE_STR ("ocfs_verify_update_oin failed");
+			LOG_TRACE_STR ("ocfs_verify_update_inode failed");
 			LOG_TRACE_STR ("TODO: disable volume");
 			ret = -EIO;
 			goto bail;
@@ -713,7 +697,7 @@
 		     HI (oin->alloc_size), LO (oin->alloc_size), HI (newsize),
 		     LO (newsize));
 
-		status = ocfs_extend_file (osb, oin, newsize, GET_INODE_FEOFF(inode), NULL, inode, NULL);
+		status = ocfs_extend_file (osb, newsize, GET_INODE_FEOFF(inode), NULL, inode, NULL);
 		if (status < 0) {
 			if (status != -EINTR && status != -ENOSPC) {
 				LOG_ERROR_STATUS (status);
@@ -797,14 +781,14 @@
 		}
 	}
 
-	if (OIN_NEEDS_VERIFICATION (oin)) {
+	if (OCFS_I(inode)->needs_verification) {
 		ocfs_down_sem (&(oin->main_res), true);
-		status = ocfs_verify_update_oin (osb, oin, &needs_trunc);
+		status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
 		ocfs_up_sem (&(oin->main_res));
 		if (needs_trunc)
 			ocfs_truncate_inode_pages(inode, 0);
 		if (status < 0) {
-			LOG_TRACE_STR ("ocfs_verify_update_oin failed");
+			LOG_TRACE_STR ("ocfs_verify_update_inode failed");
 			LOG_TRACE_STR ("TODO: disable volume");
 			ret = -EIO;
 			goto bail;
@@ -1029,7 +1013,7 @@
 /* ocfs_extend_file()
  *
  */
-int ocfs_extend_file (ocfs_super * osb, ocfs_inode * oin, __u64 file_size, __u64 file_off, ocfs_journal_handle *passed_handle, struct inode *inode, struct iattr *attr)
+int ocfs_extend_file (ocfs_super * osb, __u64 file_size, __u64 file_off, ocfs_journal_handle *passed_handle, struct inode *inode, struct iattr *attr)
 {
 	int status = 0;
 	int tmpstat;
@@ -1050,9 +1034,15 @@
 	struct buffer_head *bh = NULL;
 	int flags = 0;
 	ocfs_journal_handle *handle = NULL;
+	ocfs_inode *oin = NULL;
 
 	LOG_ENTRY ();
 
+	if (!inode)
+		BUG();
+
+	oin = GET_INODE_OIN(inode);
+
 	if (file_size == 0)
 		goto leave;
 
@@ -1186,7 +1176,7 @@
 
 		/* note: ok if oin is null here, not used in
 		 * ocfs_allocate_extent */
-		status = ocfs_allocate_extent (osb, oin, bh, handle,
+		status = ocfs_allocate_extent (osb, bh, handle,
 					actualDiskOffset, actualLength, inode);
 		if (status < 0) {
 			OCFS_BH_PUT_DATA(bh);
@@ -1345,30 +1335,28 @@
 	}
 
 	if (attr->ia_valid & ATTR_SIZE) {
-		if (oin != NULL) {
-			ocfs_down_sem (&(oin->main_res), true);
-			if (OIN_NEEDS_VERIFICATION (oin)) {
-				LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
-				status = ocfs_verify_update_oin (osb, oin, &needs_trunc);
-				if (status < 0) {
-					LOG_ERROR_STATUS (status);
-					LOG_TRACE_STR ("TODO: disable volume");
-					ocfs_up_sem (&(oin->main_res));
-					error = -EIO;
-					goto bail;
-				}
+		ocfs_down_sem (&(oin->main_res), true);
+		if (OCFS_I(inode)->needs_verification) {
+			LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
+			status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
+			if (status < 0) {
+				LOG_ERROR_STATUS (status);
+				LOG_TRACE_STR ("TODO: disable volume");
+				ocfs_up_sem (&(oin->main_res));
+				error = -EIO;
+				goto bail;
 			}
-			ocfs_up_sem (&(oin->main_res));
-			if (needs_trunc)
-				ocfs_truncate_inode_pages(inode, 0);
 		}
+		ocfs_up_sem (&(oin->main_res));
+		if (needs_trunc)
+			ocfs_truncate_inode_pages(inode, 0);
 
                 if (inode->i_size > newsize)
 			status = ocfs_truncate_file(osb, fileOff, newsize, 
 						    oin, inode);
 		else {
-			status = ocfs_extend_file(osb, oin, newsize,
-						  fileOff, NULL, inode, attr);
+			status = ocfs_extend_file(osb, newsize, fileOff, NULL, 
+						  inode, attr);
 			extended = true;
 		}
 		if (status < 0) {
@@ -1483,16 +1471,15 @@
 	oin = GET_INODE_OIN(inode);
 	if (oin == ((ocfs_super *)(OCFS_GENERIC_SB_P(sb)))->oin_root_dir)
 		goto bail;
-	if (oin != NULL) {
-		ocfs_down_sem (&(oin->main_res), true);
-		status = ocfs_verify_update_oin (osb, oin, &needs_trunc);
-		ocfs_up_sem (&(oin->main_res));
-		if (needs_trunc)
-			ocfs_truncate_inode_pages(inode, 0);
-		if (status < 0)
-			LOG_ERROR_STATUS (status);
-	}
 
+	ocfs_down_sem (&(oin->main_res), true);
+	status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
+	ocfs_up_sem (&(oin->main_res));
+	if (needs_trunc)
+		ocfs_truncate_inode_pages(inode, 0);
+	if (status < 0)
+		LOG_ERROR_STATUS (status);
+
 bail:
 	LOG_EXIT_LONG (0);
 	return 0;

Modified: branches/nooin/src/inc/ocfs.h
===================================================================
--- branches/nooin/src/inc/ocfs.h	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/inc/ocfs.h	2004-04-16 21:49:58 UTC (rev 846)
@@ -547,9 +547,6 @@
 #ifndef  _OCFSDEF_H_
 #define  _OCFSDEF_H_
 
-#define  OIN_NEEDS_VERIFICATION(a)	((a)->needs_verification)
-#define  OIN_UPDATED(a)			((a)->needs_verification = false)
-
 #define  IS_VALID_DIR_NODE(ptr)                                       \
                  (!strncmp((ptr)->signature, OCFS_DIR_NODE_SIGNATURE, \
                            strlen(OCFS_DIR_NODE_SIGNATURE)))
@@ -1764,19 +1761,13 @@
 
 struct _ocfs_inode
 {
-	ocfs_obj_id obj_id;
-	struct inode *inode;
-	struct list_head recovery_list;
 	ocfs_sem main_res;
 	struct semaphore extend_sem;
 	__u32 num_extends;
 	ocfs_lock_res *lock_res;
 	ocfs_extent_map map;
 	__s64 alloc_size;
-	__u64 chng_seq_num;
-	__u32 open_hndl_cnt;
 	__u32 oin_flags;
-	bool needs_verification;
 };
 
 /* OCFS2 Inode Private Data
@@ -1790,7 +1781,16 @@
  */
 typedef struct _ocfs_inode_private
 {
+	/* always valid, just a simple back pointer. */
+	struct inode *inode;
+
+	/* protected by main_res */
 	ocfs_inode       oin;
+	__u32            open_hndl_cnt;
+	bool             needs_verification;
+	struct list_head recovery_list;
+	__u64            chng_seq_num;
+
 	__u64            voteoff;
 	__u64            feoff;
 	atomic_t         i_clean_buffer_seq;
@@ -1805,6 +1805,7 @@
 #define GET_INODE_CLEAN_SEQ(i)  (atomic_t *)(&(OCFS_GENERIC_IP(i)->i_clean_buffer_seq))
 
 #define OCFS_GENERIC_IP(i)        ((ocfs_inode_private *)(i->u.generic_ip))
+#define OCFS_I(i) OCFS_GENERIC_IP(i)
 
 #define INODE_DELETED(i) (OCFS_GENERIC_IP(i)->flags & OCFS_INODE_DELETED)
 #define SET_INODE_DELETED(i) (OCFS_GENERIC_IP(i)->flags |= OCFS_INODE_DELETED)
@@ -1959,6 +1960,7 @@
 	HASHTABLE root_sect_node;	/* lockres->sector_num hash */
 	struct list_head cache_lock_list;
 	struct super_block *sb;
+	struct inode *root_inode;
 	ocfs_inode *oin_root_dir;	/* ptr to the root dir ocfs_inode */
 	ocfs_vol_layout vol_layout;
 	ocfs_vol_node_map vol_node_map;

Modified: branches/nooin/src/inc/proto.h
===================================================================
--- branches/nooin/src/inc/proto.h	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/inc/proto.h	2004-04-16 21:49:58 UTC (rev 846)
@@ -27,10 +27,10 @@
 #ifndef _PROTO_H_
 #define _PROTO_H_
 
-int ocfs_allocate_extent (ocfs_super * osb, ocfs_inode * oin, struct buffer_head *fe_bh, ocfs_journal_handle *handle,__u64 actualDiskOffset, __u64 actualLength, struct inode *inode);
+int ocfs_allocate_extent (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_journal_handle *handle,__u64 actualDiskOffset, __u64 actualLength, struct inode *inode);
 int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_journal_handle *handle, struct inode *inode);
 int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, struct inode *inode);
-int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode);
+int ocfs_lookup_file_allocation (ocfs_super * osb, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode);
 int ocfs_get_leaf_extent (ocfs_super * osb, ocfs_file_entry * FileEntry, __s64 Vbo, struct buffer_head **data_extent_bh, struct inode *inode);
 int ocfs_find_contiguous_space_from_bitmap (ocfs_super * osb, __u64 file_size, __u64 * cluster_off, __u64 * cluster_count, bool sysfile, struct buffer_head *lock_bh);
 int ocfs_alloc_node_block (ocfs_super * osb, __u64 FileSize, __u64 * DiskOffset, __u64 * file_off, __u32 NodeNum, __u32 Type, ocfs_journal_handle *handle);
@@ -44,7 +44,7 @@
 int ocfs_acquire_lockres_ex (ocfs_lock_res * lockres, __u32 timeout);
 void ocfs_release_lockres (ocfs_lock_res * lockres);
 void ocfs_init_lockres (ocfs_super * osb, ocfs_lock_res * lockres, __u64 lock_id);
-int ocfs_create_update_lock (ocfs_super * osb, ocfs_inode * oin, __u64 lock_id, __u32 flags, bool new_file, struct inode *inode, ocfs_journal_handle *handle);
+int ocfs_create_update_lock (ocfs_super * osb, __u64 lock_id, __u32 flags, bool new_file, struct inode *inode, ocfs_journal_handle *handle);
 int ocfs_acquire_lock (ocfs_super * osb, __u64 lock_id, __u32 lock_type,
 		   __u32 flags, ocfs_lock_res ** lr, struct buffer_head **bh, struct inode *inode);
 int ocfs_release_lock (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, ocfs_lock_res * lockres, struct buffer_head *bh, struct inode *inode);
@@ -76,7 +76,7 @@
 int ocfs_sync_file (struct file *file, struct dentry *dentry, int datasync);
 ssize_t ocfs_file_write (struct file *filp, const char *buf, size_t count, loff_t * ppos);
 ssize_t ocfs_file_read (struct file *filp, char *buf, size_t count, loff_t * ppos);
-int ocfs_extend_file (ocfs_super * osb, ocfs_inode * oin, __u64 file_size, __u64 file_off, ocfs_journal_handle *passed_handle, struct inode *inode, struct iattr *attr);
+int ocfs_extend_file (ocfs_super * osb, __u64 file_size, __u64 file_off, ocfs_journal_handle *passed_handle, struct inode *inode, struct iattr *attr);
 int ocfs_setattr (struct dentry *dentry, struct iattr *attr);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 int ocfs_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
@@ -173,15 +173,12 @@
 void ocfs_linux_dbg_free (const void *Buffer);
 
 
-int ocfs_verify_update_oin (ocfs_super * osb, ocfs_inode * oin, int *needs_trunc);
+int ocfs_verify_update_inode (ocfs_super * osb, struct inode * inode, int *needs_trunc);
 int ocfs_inode_fill_ext_map(ocfs_super * osb, struct buffer_head * fe_bh, struct inode *inode);
 int ocfs_inode_open(ocfs_super *osb, struct buffer_head *fe_bh, 
 		    ocfs_journal_handle *handle, struct inode *inode);
 int ocfs_create_root_oin (ocfs_super * osb, struct inode *root);
-void ocfs_release_oin (ocfs_super *osb, ocfs_inode * oin, bool FreeMemory);
-void ocfs_release_cached_oin (ocfs_super * osb, ocfs_inode * oin);
 
-
 int ocfs_initialize_osb (ocfs_super * osb, ocfs_vol_disk_hdr * vdh, ocfs_vol_label * vol_label, __u32 sect_size);
 int ocfs_verify_volume (ocfs_vol_disk_hdr * vdh);
 int ocfs_check_volume (ocfs_super * osb);

Modified: branches/nooin/src/inode.c
===================================================================
--- branches/nooin/src/inode.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/inode.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -197,15 +197,15 @@
 	i->flags = 0;
 	atomic_set(&i->i_clean_buffer_seq, 0);
 
-	/* Init OIN stuff. */
-	oin->obj_id.type = OCFS_TYPE_OIN;
-	oin->obj_id.size = sizeof (ocfs_inode);
+	/* Init OIN (or old OIN) stuff. */
+//	oin->obj_id.type = OCFS_TYPE_OIN;
+//	oin->obj_id.size = sizeof (ocfs_inode);
 	ocfs_init_sem (&(oin->main_res));
 	init_MUTEX(&(oin->extend_sem));
 	OCFS_SET_FLAG (oin->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
-	oin->open_hndl_cnt = 0;
+	i->open_hndl_cnt = 0;
 	ocfs_extent_map_init (&oin->map);
-	INIT_LIST_HEAD(&oin->recovery_list);
+	INIT_LIST_HEAD(&i->recovery_list);
 
 	/* These should be set in read_inode2. */
 	oin->alloc_size = 0ULL;
@@ -266,8 +266,8 @@
 
 	oin = GET_INODE_OIN(inode);
 	oin->alloc_size = fe->alloc_size;
-	oin->inode = inode;
-	oin->chng_seq_num = DISK_LOCK_SEQNUM (fe);
+	OCFS_I(inode)->inode = inode;
+	OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
 	if (fe->attribs & OCFS_ATTRIB_DIRECTORY)
 		oin->oin_flags |= OCFS_OIN_DIRECTORY;
 
@@ -362,8 +362,8 @@
 
 		oin = GET_INODE_OIN(inode);
 		oin->alloc_size = 0ULL;
-		oin->inode = inode;
-		oin->chng_seq_num = 0ULL;
+		OCFS_I(inode)->inode = inode;
+		OCFS_I(inode)->chng_seq_num = 0ULL;
 		oin->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
 
 		ocfs_inode_hash_bind(osb, GET_INODE_VOTEOFF(inode), inode);
@@ -495,8 +495,8 @@
 
 		oin = GET_INODE_OIN(inode);
 		oin->alloc_size = 0ULL;
-		oin->inode = inode;
-		oin->chng_seq_num = 0ULL;
+		OCFS_I(inode)->inode = inode;
+		OCFS_I(inode)->chng_seq_num = 0ULL;
 		oin->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
 
 		ocfs_inode_hash_bind(osb, GET_INODE_VOTEOFF(inode), inode);
@@ -809,7 +809,7 @@
 	ocfs_extent_map_init (&oin->map);
 
 	down(&recovery_list_sem);
-	list_del(&oin->recovery_list);
+	list_del(&OCFS_I(inode)->recovery_list);
 	up(&recovery_list_sem);
 
 	ocfs_del_sem (&(oin->main_res));
@@ -932,7 +932,9 @@
 		if (unlock)
 			ocfs_up_sem (&(oin->main_res));
 
-		status = ocfs_extend_file (osb, oin, newsize, GET_INODE_FEOFF(inode), NULL, inode, NULL);
+		status = ocfs_extend_file (osb, newsize, 
+					   GET_INODE_FEOFF(inode), NULL, 
+					   inode, NULL);
 
 		if (unlock)
 			ocfs_down_sem (&(oin->main_res), true);
@@ -1067,8 +1069,7 @@
 
 	len = 1;
 	down(&oin->extend_sem);
-	err = ocfs_lookup_file_allocation(osb, oin, vbo, &lbo, len, NULL, 
-					  inode);
+	err = ocfs_lookup_file_allocation(osb, vbo, &lbo, len, NULL, inode);
 	up(&oin->extend_sem);
 	if (err < 0) {
 		LOG_ERROR_ARGS ("vbo=%u.%u lbo=%u.%u len=%u", HILO(vbo),
@@ -1148,8 +1149,7 @@
 
 	vbo = (__s64) block << inode->i_sb->s_blocksize_bits;
 	len = 1;
-	err = ocfs_lookup_file_allocation(osb, oin, vbo, &lbo, len, 
-					  NULL, inode);
+	err = ocfs_lookup_file_allocation(osb, vbo, &lbo, len, NULL, inode);
 	if (err < 0) {
 		LOG_ERROR_ARGS ("vbo=%u.%u lbo=%u.%u len=%u", HILO(vbo),
 				HILO(lbo), len);
@@ -1190,7 +1190,7 @@
 
 	vbo = (__s64) iblock << inode->i_sb->s_blocksize_bits;
 	len = 1;
-	err = ocfs_lookup_file_allocation (osb, oin, vbo, &lbo, len, NULL, inode);
+	err = ocfs_lookup_file_allocation (osb, vbo, &lbo, len, NULL, inode);
 	if (err < 0) {
 		LOG_ERROR_STATUS (err);
 		err = -1;
@@ -1307,13 +1307,13 @@
 	osb = (ocfs_super *) inode->i_sb->s_fs_info;
 	blocksize_bits = inode->i_sb->s_blocksize_bits;
 	/* make sure we're up to date... */
-	if (OIN_NEEDS_VERIFICATION (oin)) {
+	if (OCFS_I(inode)->needs_verification) {
 		LOG_TRACE_STR ("ocfs_direct_IO_get_blocks: verify oin.");
-		status = ocfs_verify_update_oin (osb, oin, &needs_trunc);
+		status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
 		if (needs_trunc) 
 			ocfs_truncate_inode_pages(inode, 0);
 		if (status < 0) {
-			LOG_TRACE_STR ("ocfs_verify_update_oin failed");
+			LOG_TRACE_STR ("ocfs_verify_update_inode failed");
 			ret = -EIO;
 			goto bail;
 		}
@@ -1342,7 +1342,8 @@
 	/* This figure out the size of the next contiguous block, and
 	 * our logical offset */	
 	/* TODO: Try our damndest to give sizes in multiples of PAGE_SIZE */
-	status = ocfs_lookup_file_allocation(osb, oin, vbo, &lbo, max_blocks, &new_size, inode);
+	status = ocfs_lookup_file_allocation(osb, vbo, &lbo, max_blocks, 
+					     &new_size, inode);
 
 	/* Do whatever we need to the buffer_head */
 	if (set_new) {

Modified: branches/nooin/src/journal.c
===================================================================
--- branches/nooin/src/journal.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/journal.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -944,12 +944,12 @@
 	 * about oins, so we update alloc_size ourselves. */
 	oin = GET_INODE_OIN(inode);
 	oin->alloc_size = alloc_size;
-	status = ocfs_create_update_lock(osb, oin, lock_id, 0, false, inode, NULL);
+	status = ocfs_create_update_lock(osb, lock_id, 0, false, inode, NULL);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto done;
 	}
-	oin->open_hndl_cnt++;
+	OCFS_I(inode)->open_hndl_cnt++;
 	LOG_TRACE_ARGS("oin->alloc_size = %u.%u\n", HI(oin->alloc_size), 
 		       LO(oin->alloc_size));
 
@@ -986,8 +986,8 @@
 				OCFS_BH_PUT_DATA(bh);
 			brelse(bh);
 		}
-		if (oin)
-			oin->open_hndl_cnt--;
+		if (inode)
+			OCFS_I(inode)->open_hndl_cnt--;
 	}
 	LOG_EXIT_STATUS(status);
 	return(status);
@@ -1056,7 +1056,7 @@
 	/* release the oin here. Isn't this racy? */
 	if (inode_data_is_oin(inode)) {
 		oin = GET_INODE_OIN(inode);
-		oin->open_hndl_cnt--;
+		OCFS_I(inode)->open_hndl_cnt--;
 	}
 
 	/* unlock our journal */
@@ -1338,7 +1338,7 @@
 
 	LOG_TRACE_ARGS("Force reading %u blocks\n", totalblks);
 
-	status = ocfs_lookup_file_allocation(osb, oin, vbo, &lbo, size, NULL, 
+	status = ocfs_lookup_file_allocation(osb, vbo, &lbo, size, NULL, 
 					     inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
@@ -1576,7 +1576,7 @@
 
 	oin = GET_INODE_OIN(inode);
 	oin->alloc_size = alloc_size;
-	status = ocfs_create_update_lock(osb, oin, lock_id, 0, false, inode, NULL);
+	status = ocfs_create_update_lock(osb, lock_id, 0, false, inode, NULL);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto done;

Modified: branches/nooin/src/namei.c
===================================================================
--- branches/nooin/src/namei.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/namei.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -266,7 +266,7 @@
 	fe = NULL;
 
 	oin = GET_INODE_OIN(inode);
-	status = ocfs_create_update_lock(osb, oin, GET_INODE_VOTEOFF(inode), 
+	status = ocfs_create_update_lock(osb, GET_INODE_VOTEOFF(inode), 
 					 oinflags, true, inode, handle);
 	if (status < 0)
 		LOG_ERROR_STATUS(status);
@@ -274,7 +274,7 @@
 	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
 
         /*  Insert the OFile on the OIN list */
-	oin->chng_seq_num = DISK_LOCK_SEQNUM (fe);
+	OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
 	if (oin->lock_res != NULL) {
 		ocfs_lock_res *lockres = oin->lock_res;
 		ocfs_acquire_lockres(lockres);
@@ -598,8 +598,8 @@
 
 	if (!ocfs_empty(dentry)) {
 		LOG_TRACE_STR ("dentry is not empty, cannot delete");
-	} else if (oin && oin->open_hndl_cnt > 0) {
-		LOG_TRACE_ARGS ("Cannot remove an open file (open_hndl_cnt = %u, fileOff = %u.%u, d_count=%u)\n", oin->open_hndl_cnt, HILO(fileOff), atomic_read(&dentry->d_count));
+	} else if (OCFS_I(inode)->open_hndl_cnt > 0) {
+		LOG_TRACE_ARGS ("Cannot remove an open file (open_hndl_cnt = %u, fileOff = %u.%u, d_count=%u)\n", OCFS_I(inode)->open_hndl_cnt, HILO(fileOff), atomic_read(&dentry->d_count));
 	} else if (oin && oin->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
 		LOG_TRACE_STR ("Cannot delete the root directory");
 		status = -EPERM;
@@ -954,7 +954,7 @@
 	}
 
 	if (oldOIN) {
-		if (oldOIN->open_hndl_cnt != 0) {
+		if (OCFS_I(old_dentry->d_inode)->open_hndl_cnt != 0) {
 			status = -EBUSY;
 			goto bail;
 		}
@@ -976,7 +976,7 @@
 			/* OIN exists and it's not marked for deletion! */
 			ocfs_down_sem (&(newOIN->main_res), true);
 			OCFS_SET_FLAG (newOIN->oin_flags, OCFS_OIN_IN_USE);
-			status = ocfs_verify_update_oin (osb, newOIN, &needs_trunc);
+			status = ocfs_verify_update_inode (osb, new_dentry->d_inode, &needs_trunc);
 			ocfs_up_sem (&(newOIN->main_res));
 			delete_target_oin = true;
 			if (needs_trunc)
@@ -1376,7 +1376,7 @@
 	OCFS_BH_PUT_DATA(new_fe_bh);
 	fe = NULL;
 
-	status = ocfs_extend_file (osb, NULL, newsize, file_off, handle, inode, NULL);
+	status = ocfs_extend_file (osb, newsize, file_off, handle, inode, NULL);
 	if (status < 0) {
 		if (status != -ENOSPC && status != -EINTR) {
 			LOG_ERROR_ARGS ("Failed to extend file to %u.%u", HILO (newsize));

Modified: branches/nooin/src/nm.c
===================================================================
--- branches/nooin/src/nm.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/nm.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -936,8 +936,8 @@
 		case UPDATE_OIN_INODE:
 			LOG_TRACE_STR("UPDATE_OIN_INODE");
 			ocfs_down_sem (&(oin->main_res), true);
-			oin->needs_verification = true;
-			tmpstat = ocfs_verify_update_oin(osb, oin, &needs_trunc);
+			OCFS_I(inode)->needs_verification = true;
+			tmpstat = ocfs_verify_update_inode(osb, inode, &needs_trunc);
 			if (tmpstat < 0)
 				LOG_ERROR_STATUS (tmpstat);
 			ocfs_up_sem (&(oin->main_res));
@@ -959,8 +959,8 @@
 			if (oin) {
 				oin_sem = &(oin->main_res);
 				ocfs_down_sem (oin_sem, true);
-				oin->needs_verification = true;
-				tmpstat = ocfs_verify_update_oin(osb, oin, &needs_trunc);
+				OCFS_I(inode)->needs_verification = true;
+				tmpstat = ocfs_verify_update_inode(osb, inode, &needs_trunc);
 				if (tmpstat < 0)
 					LOG_ERROR_STATUS (tmpstat);
 		
@@ -975,7 +975,7 @@
 					ocfs_down_sem (oin_sem, true);
 				}
 
-				if (oin && oin->open_hndl_cnt > 0) {
+				if (OCFS_I(inode)->open_hndl_cnt > 0) {
 					/* the NO vote for delete/rename */
 					vote_response = FLAG_VOTE_OIN_ALREADY_INUSE;
 				} else if (oin) {
@@ -1339,7 +1339,7 @@
 				down(&recovery_list_sem);
 				spin_lock(&oin_num_ext_lock);
 				oin->num_extends++;
-				list_add_tail(&oin->recovery_list, &osb->lock_recovery_lists[node_num]);
+				list_add_tail(&OCFS_I(inode)->recovery_list, &osb->lock_recovery_lists[node_num]);
 				spin_unlock(&oin_num_ext_lock);
 				up(&recovery_list_sem);
 			}
@@ -1352,7 +1352,7 @@
 				BUG();
 			
 			if (!oin->num_extends) {
-				list_del(&oin->recovery_list);
+				list_del(&OCFS_I(inode)->recovery_list);
 
 				up(&oin->extend_sem);
 			}
@@ -1450,23 +1450,23 @@
 {
 	struct list_head *iter, *temp;
 	ocfs_inode *oin;
-	
+	struct inode *inode;
+	ocfs_inode_private *i;
+
 	LOG_ENTRY_ARGS("(node_num = %u)\n", node_num);
 
 	down(&recovery_list_sem);
 	list_for_each_safe (iter, temp, &osb->lock_recovery_lists[node_num]) {
-		oin = list_entry (iter, ocfs_inode, recovery_list);
-		if (oin->obj_id.type != OCFS_TYPE_OIN) {
-			LOG_ERROR_ARGS("node %u recovery: invalid oin!\n", node_num);
-			continue;
-		}
+		i = list_entry (iter, ocfs_inode_private, recovery_list);
 
+		inode = i->inode;
+		oin = GET_INODE_OIN(inode);
 		spin_lock(&oin_num_ext_lock);
 		
 		if (oin->num_extends) {
 			oin->num_extends = 0;
-			list_del(&oin->recovery_list);
-			INIT_LIST_HEAD(&oin->recovery_list);
+			list_del(&OCFS_I(inode)->recovery_list);
+			INIT_LIST_HEAD(&OCFS_I(inode)->recovery_list);
 			up(&oin->extend_sem);
 		} else
 			LOG_ERROR_STR("oin is in recovery list, but has zero extend counter value!");

Modified: branches/nooin/src/oin.c
===================================================================
--- branches/nooin/src/oin.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/oin.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -31,43 +31,36 @@
 extern spinlock_t oin_num_ext_lock;
 
 /*
- * ocfs_verify_update_oin()
- *
- * This function searches the cached oin list for a volume for a given
- * filename. We currently cache all the oin's. We should hash this list.
- *
+ * ocfs_verify_update_inode()
  */ 
-int ocfs_verify_update_oin (ocfs_super * osb, ocfs_inode * oin, int *needs_trunc)
+int ocfs_verify_update_inode (ocfs_super * osb, struct inode * inode, int *needs_trunc)
 {
 	int status = 0;
 	struct buffer_head *fe_bh = NULL;
 	ocfs_file_entry *fe = NULL;
 	ocfs_lock_res *pLockRes;
-	struct inode *inode = NULL;
         struct list_head *iter;
         struct list_head *temp_iter;
         int disk_len;
 	__u64 offset;
 	ocfs_disk_lock dlock;   /* ???: is this too much on the stack? */
+	ocfs_inode *oin = NULL;
 
 	/* We are setting the oin Updated flag in the end. */
 	LOG_ENTRY ();
 
-	OCFS_ASSERT (oin);
+	OCFS_ASSERT (inode);
 
-	if (!oin->inode) {
-		printk(KERN_ERR "ocfs2: oin has no inode!\n");
-		BUG();
-	}
+	oin = GET_INODE_OIN(inode);
 
 	*needs_trunc = 0;
 
 	/* This read of feoff from the inode depends on all callers to
 	 * make sure that unlink or rename can't be change it while we're
 	 * in here! */
-	offset = GET_INODE_FEOFF(oin->inode);
+	offset = GET_INODE_FEOFF(inode);
 
-	status = ocfs_read_bh(osb, offset, &fe_bh, OCFS_BH_COND_CACHED, oin->inode);
+	status = ocfs_read_bh(osb, offset, &fe_bh, OCFS_BH_COND_CACHED, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto leave;
@@ -93,13 +86,6 @@
 		}
 
                 disk_len = strlen(fe->filename);
-		inode = oin->inode;
-		if (inode == NULL) {
-			LOG_ERROR_STR ("oin has no matching inode!!!!");
-			OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_INVALID);
-			status = -ENOENT;
-			goto leave;
-		}
 
                 status = -ENOENT;
                 list_for_each_safe (iter, temp_iter, &(inode->i_dentry)) {
@@ -119,7 +105,7 @@
 
 		if ((oin->alloc_size != (__s64) fe->alloc_size) ||
 		    (inode->i_size != (__s64) fe->file_size) ||
-		    (oin->chng_seq_num != DISK_LOCK_SEQNUM (fe)) ||
+		    (OCFS_I(inode)->chng_seq_num != DISK_LOCK_SEQNUM (fe)) ||
 		    inode->i_uid != fe->uid ||
 		    inode->i_gid != fe->gid || inode->i_mode != fe->prot_bits) {
 
@@ -132,7 +118,7 @@
 			    ("Allocsize, filesize or seq no did not match");
 			oin->alloc_size = fe->alloc_size;
 			inode->i_size = fe->file_size;
-			oin->chng_seq_num = DISK_LOCK_SEQNUM (fe);
+			OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
 
 			inode->i_blocks = (inode->i_size + 512) >> 9;
 			inode->i_uid = fe->uid;
@@ -145,7 +131,7 @@
 			if (!S_ISDIR (inode->i_mode) &&
 			    (oin->alloc_size != (__s64) fe->alloc_size ||
 			     inode->i_size != (__s64) fe->file_size ||
-			     oin->chng_seq_num != DISK_LOCK_SEQNUM (fe))) {
+			     OCFS_I(inode)->chng_seq_num != DISK_LOCK_SEQNUM (fe))) {
 				*needs_trunc = 1;
 			}
 
@@ -257,7 +243,7 @@
 
 leave:
 	if (status == 0)
-		OIN_UPDATED (oin);
+		OCFS_I(inode)->needs_verification = false;
 
 	if (fe_bh) {
 		if (fe)
@@ -267,7 +253,7 @@
 
 	LOG_EXIT_STATUS (status);
 	return status;
-}				/* ocfs_verify_update_oin */
+}				/* ocfs_verify_update_inode */
 
 /* you should be holding i_sem and main_res in this function. 
  *
@@ -294,7 +280,7 @@
 
 	/* why do we update these here? */
 	oin->alloc_size = fe->alloc_size;
-	oin->chng_seq_num = DISK_LOCK_SEQNUM (fe);
+	OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
 	if (fe->this_sector == 0)
 		LOG_ERROR_STR ("this_sector=0");
 
@@ -314,8 +300,7 @@
 			ocfs_handle_set_checkpoint(handle, false);
 		}
 
-		status = ocfs_create_update_lock(osb, oin, 
-						 GET_INODE_VOTEOFF(inode), 
+		status = ocfs_create_update_lock(osb, GET_INODE_VOTEOFF(inode),
 						 flags, false, inode, handle);
 		if (status < 0) {
 			if (status != -EINTR)

Modified: branches/nooin/src/super.c
===================================================================
--- branches/nooin/src/super.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/super.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -222,7 +222,7 @@
 		goto read_super_error;
 	}
 
-	inode = osb->oin_root_dir->inode;
+	inode = osb->root_inode;
 	if (!inode) {
 		status = -EIO;
 		LOG_ERROR_STATUS (status);
@@ -1019,6 +1019,7 @@
 		inode = NULL;
 		goto leave;
 	}
+	osb->root_inode = inode;
 	osb->oin_root_dir = GET_INODE_OIN(inode);
 
 	/* Read the publish sector for this node and cleanup dirent being */

Modified: branches/nooin/src/sysfile.c
===================================================================
--- branches/nooin/src/sysfile.c	2004-04-16 01:28:18 UTC (rev 845)
+++ branches/nooin/src/sysfile.c	2004-04-16 21:49:58 UTC (rev 846)
@@ -537,7 +537,7 @@
 		actualLength =
 		    (__u64) (numClusterAlloc * osb->vol_layout.cluster_size);
 
-		status = ocfs_allocate_extent (osb, NULL, fe_bh, handle,  
+		status = ocfs_allocate_extent (osb, fe_bh, handle,  
 					       actualDiskOffset, actualLength, NULL);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);



More information about the Ocfs2-commits mailing list