[Ocfs2-commits] jlbec commits r1111 - in branches/format-changes: . src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Jun 16 15:14:17 CDT 2004


Author: jlbec
Date: 2004-06-16 14:14:16 -0500 (Wed, 16 Jun 2004)
New Revision: 1111

Modified:
   branches/format-changes/TODO
   branches/format-changes/src/dcache.c
   branches/format-changes/src/file.c
   branches/format-changes/src/inode.c
   branches/format-changes/src/namei.c
   branches/format-changes/src/nm.c
   branches/format-changes/src/ocfs.h
Log:

Merge 1106:1109 from trunk:
	- [1108] Turn needs_verification into an atomic_int.
	- [1108] Fix ocfs_verify_update_inode() to use priv_sem only
		 when necessary.
	- [1109] Update TODO.



Modified: branches/format-changes/TODO
===================================================================
--- branches/format-changes/TODO	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/TODO	2004-06-16 19:14:16 UTC (rev 1111)
@@ -48,3 +48,14 @@
 
 * Investigate whether we need a seperate sysfile for truncate orphans (in
   the future)
+
+* redo the delete and rename journal credits now that those paths are
+  so different
+
+* the guid we store on disk will need to be dealt with wrt endianness
+
+* change the dirent->inode to block number... it's in bytes currently
+
+* finish the work of removing the bh sem hash
+
+* turn priv_sem into a spinlock

Modified: branches/format-changes/src/dcache.c
===================================================================
--- branches/format-changes/src/dcache.c	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/src/dcache.c	2004-06-16 19:14:16 UTC (rev 1111)
@@ -87,7 +87,7 @@
 	ret = 1;
 
 	/* TODO: Is this really necessary? */
-	OCFS_I(inode)->needs_verification = 1;
+	atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
 
 bail:
 

Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/src/file.c	2004-06-16 19:14:16 UTC (rev 1111)
@@ -198,8 +198,18 @@
 		goto leave;
 	}
 
-	/* kch - for an open request we are already given the 
-	* inode, and therefore we are given the oin too */
+	if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
+		down_read (&(OCFS_I(inode)->ip_io_sem));
+		status = ocfs_verify_update_inode (osb, inode, &truncate_pages,
+						   0);
+		up_read (&(OCFS_I(inode)->ip_io_sem));
+		if (status < 0) {
+			up_write(&OCFS_I(inode)->ip_io_sem);
+			LOG_ERROR_STATUS (status);
+			goto leave;
+		}
+	}
+
 	down_write (&(OCFS_I(inode)->ip_io_sem));
 	down (&(OCFS_I(inode)->priv_sem));
 	have_oin_sem = 1;
@@ -236,16 +246,6 @@
 		}
 	}
 
-	if (OCFS_I(inode)->needs_verification) {
-		status = ocfs_verify_update_inode (osb, inode, &truncate_pages,
-						   0);
-		if (status < 0) {
-			up_write(&OCFS_I(inode)->ip_io_sem);
-			LOG_ERROR_STATUS (status);
-			goto leave;
-		}
-	}
-
 	up_write(&OCFS_I(inode)->ip_io_sem);
 	/* yes, hold onto priv_sem. */
 
@@ -770,13 +770,11 @@
 		}
 	}
 
-	if (OCFS_I(inode)->needs_verification) {
+	if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
 		LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
 		down_read (&(OCFS_I(inode)->ip_io_sem));
-		down (&(OCFS_I(inode)->priv_sem));
 		status = ocfs_verify_update_inode (osb, inode, &needs_trunc, 
 						   0);
-		up (&(OCFS_I(inode)->priv_sem));
 		up_read (&(OCFS_I(inode)->ip_io_sem));
 		if (needs_trunc)
 			ocfs_truncate_inode_pages(inode, 0);
@@ -902,13 +900,10 @@
 		}
 	}
 
-	if (OCFS_I(inode)->needs_verification) {
-		/* yay, locking hell! */
+	if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
 		down_read(&OCFS_I(inode)->ip_io_sem);
-		down (&(OCFS_I(inode)->priv_sem));
 		status = ocfs_verify_update_inode (osb, inode, &needs_trunc, 
 						   0);
-		up (&(OCFS_I(inode)->priv_sem));
 		up_read(&OCFS_I(inode)->ip_io_sem);
 		if (needs_trunc)
 			ocfs_truncate_inode_pages(inode, 0);
@@ -1461,20 +1456,17 @@
 	fileOff = GET_INODE_FEOFF(inode);
 
 	if (attr->ia_valid & ATTR_SIZE) {
-		down (&(OCFS_I(inode)->priv_sem));
-		if (OCFS_I(inode)->needs_verification) {
+		if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
 			LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
 			status = ocfs_verify_update_inode (osb, inode, 
 							   &needs_trunc, 0);
 			if (status < 0) {
 				LOG_ERROR_STATUS (status);
 				LOG_TRACE_STR ("TODO: disable volume");
-				up (&(OCFS_I(inode)->priv_sem));
 				error = -EIO;
 				goto bail;
 			}
 		}
-		up (&(OCFS_I(inode)->priv_sem));
 		if (needs_trunc)
 			ocfs_truncate_inode_pages(inode, 0);
 

Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/src/inode.c	2004-06-16 19:14:16 UTC (rev 1111)
@@ -329,6 +329,8 @@
 
 	init_rwsem(&i->ip_io_sem);
 
+	atomic_set(&i->ip_needs_verification, 0);
+
 	/* These should be set in read_inode2. */
 	i->alloc_size = 0ULL;
 	i->feoff = 0ULL;
@@ -1386,7 +1388,7 @@
 	osb = inode->i_sb->s_fs_info;
 	blocksize_bits = inode->i_sb->s_blocksize_bits;
 	/* make sure we're up to date... */
-	if (OCFS_I(inode)->needs_verification) {
+	if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
 		LOG_TRACE_STR ("ocfs_direct_IO_get_blocks: verify oin.");
 		status = ocfs_verify_update_inode (osb, inode, &needs_trunc,
 						   0);
@@ -1908,12 +1910,13 @@
 
 	down_read (&(OCFS_I(inode)->ip_io_sem));
 	down (&(OCFS_I(inode)->priv_sem));
-
 	if (INODE_DELETED(inode)) {
+		up (&(OCFS_I(inode)->priv_sem));
 		LOG_TRACE_STR("inode deleted!\n");
 		status = -ENOENT;
 		goto bail;
 	}
+	up (&(OCFS_I(inode)->priv_sem));
 
 	if (ocfs_node_map_is_only(osb, &osb->publ_map, osb->node_num)) {
 		LOG_TRACE_STR ("Only node alive.");
@@ -1921,12 +1924,15 @@
 	}
 
 	/* if I hold cache lock, no revalidate needed */
+	ocfs_acquire_lockres(GET_INODE_LOCKRES(inode), 0);
 	if (ocfs_is_local_cache_lock(osb, inode)) {
+		ocfs_release_lockres(GET_INODE_LOCKRES(inode));
 		LOG_TRACE_STR("local cache lock\n");
 		goto bail;
 	}
+	ocfs_release_lockres(GET_INODE_LOCKRES(inode));
 
-	OCFS_I(inode)->needs_verification = 1;
+	atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
 	status = ocfs_verify_update_inode(osb, inode, &needs_trunc, 0);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
@@ -1934,7 +1940,6 @@
 	}
 
 bail:
-	up (&(OCFS_I(inode)->priv_sem));
 	up_read (&(OCFS_I(inode)->ip_io_sem));
 
 	if (needs_trunc)
@@ -1944,7 +1949,7 @@
 
 	LOG_EXIT_STATUS(status);
 	return(status);
-}
+}				/* ocfs_inode_revalidate */
 
 /*
  * ocfs_verify_update_inode()
@@ -1956,6 +1961,7 @@
 	ocfs2_dinode *fe = NULL;
 	ocfs2_extent_list *fel;
 	__u64 offset;
+	int drop_priv_sem = 0;
 
 	/* We are setting the oin Updated flag in the end. */
 	LOG_ENTRY ();
@@ -1974,18 +1980,25 @@
 		goto leave;
 	}
 
+	down(&OCFS_I(inode)->priv_sem);
 	if (INODE_DELETED(inode)) {
+		up(&OCFS_I(inode)->priv_sem);
 		LOG_TRACE_ARGS("Inode %llu was marked as deleted!", 
 			       GET_INODE_FEOFF(inode));
 		status = -ENOENT;
 		goto leave;
 	}
+	up(&OCFS_I(inode)->priv_sem);
 
 	status = ocfs_read_bh(osb, offset, &fe_bh, OCFS_BH_COND_CACHED, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto leave;
 	}
+
+	down(&OCFS_I(inode)->priv_sem);
+	drop_priv_sem = 1;
+
 	fe = OCFS_BH_GET_DATA_READ(fe_bh);
 
 	/* Make sure that what we found is not a directory. */
@@ -2079,14 +2092,20 @@
 	OCFS_BH_PUT_DATA(fe_bh);
 	fe = NULL;
 
+	up(&OCFS_I(inode)->priv_sem);
+	drop_priv_sem = 0;
+
 	status = ocfs_update_lockres (osb, GET_INODE_FEOFF(inode), &fe_bh, 
 				      NULL, 0, inode, 0, lockres_locked);
 
 	status = 0;
 leave:
 	if (status == 0)
-		OCFS_I(inode)->needs_verification = 0;
+		atomic_set(&OCFS_I(inode)->ip_needs_verification, 0);
 
+	if (drop_priv_sem)
+		up(&OCFS_I(inode)->priv_sem);
+
 	if (fe_bh) {
 		if (fe)
 			OCFS_BH_PUT_DATA(fe_bh);

Modified: branches/format-changes/src/namei.c
===================================================================
--- branches/format-changes/src/namei.c	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/src/namei.c	2004-06-16 19:14:16 UTC (rev 1111)
@@ -1075,10 +1075,8 @@
 		/* if our caching is working right, then after the
 		 * verify_update_inode, newfe->i_nlink ==
 		 * new_inode->i_nlink */
-		down (&(OCFS_I(new_inode)->priv_sem));
 		status = ocfs_verify_update_inode (osb, new_inode, 
 						   &needs_trunc, 0);
-		up (&(OCFS_I(new_inode)->priv_sem));
 		if (needs_trunc)
 			ocfs_truncate_inode_pages(new_inode, 0);
 

Modified: branches/format-changes/src/nm.c
===================================================================
--- branches/format-changes/src/nm.c	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/src/nm.c	2004-06-16 19:14:16 UTC (rev 1111)
@@ -882,13 +882,11 @@
 	switch (vote_type) {
 		case UPDATE_OIN_INODE:
 			LOG_TRACE_STR("UPDATE_OIN_INODE");
-			down (&(OCFS_I(inode)->priv_sem));
-			OCFS_I(inode)->needs_verification = 1;
+			atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
 			tmpstat = ocfs_verify_update_inode(osb, inode, 
 							   &needs_trunc, 1);
 			if (tmpstat < 0)
 				LOG_ERROR_STATUS (tmpstat);
-			up (&(OCFS_I(inode)->priv_sem));
 			if (needs_trunc) {
 				if (inode)
 					ocfs_truncate_inode_pages(inode, 0);
@@ -933,8 +931,7 @@
 		case DELETE_ACQUIRE:
 			LOG_TRACE_STR("DELETE_ACQUIRE");
 
-			down (&(OCFS_I(inode)->priv_sem));
-			OCFS_I(inode)->needs_verification = 1;
+			atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
 			tmpstat = ocfs_verify_update_inode(osb, inode, 
 							   &needs_trunc,
 							   1);
@@ -956,6 +953,7 @@
 				inode->i_nlink = 0;
 			}
 
+			down (&(OCFS_I(inode)->priv_sem));
 			/* vote no if the file is still open. */
 			if (OCFS_I(inode)->open_hndl_cnt > 0) {
 				vote_response = FLAG_VOTE_OIN_ALREADY_INUSE;

Modified: branches/format-changes/src/ocfs.h
===================================================================
--- branches/format-changes/src/ocfs.h	2004-06-16 19:08:40 UTC (rev 1110)
+++ branches/format-changes/src/ocfs.h	2004-06-16 19:14:16 UTC (rev 1111)
@@ -591,12 +591,13 @@
 	/* These fields are protected by priv_sem */
 	struct semaphore  priv_sem;
 	__u32             open_hndl_cnt;
-	int               needs_verification;
 	__u64             chng_seq_num;
 	ocfs_extent_map   map;
 	__s64             alloc_size;
 	__u32             oin_flags;
 
+	atomic_t          ip_needs_verification;
+
 	/* This protects io on the metadata buffers related to this
 	 * inode. We also consider an "abort_trans" an I/O as it will
 	 * revert the buffer back to a previous state. */



More information about the Ocfs2-commits mailing list