[Ocfs2-commits] jlbec commits r2291 - branches/alloc_inode/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu May 19 17:36:53 CDT 2005


Author: jlbec
Date: 2005-05-19 17:36:51 -0500 (Thu, 19 May 2005)
New Revision: 2291

Modified:
   branches/alloc_inode/fs/ocfs2/aops.c
   branches/alloc_inode/fs/ocfs2/buffer_head_io.c
   branches/alloc_inode/fs/ocfs2/buffer_head_io.h
   branches/alloc_inode/fs/ocfs2/dlmglue.c
   branches/alloc_inode/fs/ocfs2/dlmglue.h
   branches/alloc_inode/fs/ocfs2/inode.c
   branches/alloc_inode/fs/ocfs2/namei.c
   branches/alloc_inode/fs/ocfs2/ocfs.h
   branches/alloc_inode/fs/ocfs2/slot_map.c
   branches/alloc_inode/fs/ocfs2/super.c
Log:

o Move ip_clean_buffer_seq to ocfs2_inode_info
o Clean up the handling of ip_clean_buffer_seq.



Modified: branches/alloc_inode/fs/ocfs2/aops.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/aops.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/aops.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -32,7 +32,6 @@
 #include "ocfs2.h"
 
 #include "alloc.h"
-#include "buffer_head_io.h"
 #include "dlmglue.h"
 #include "extent_map.h"
 #include "file.h"
@@ -40,6 +39,8 @@
 #include "journal.h"
 #include "symlink.h"
 
+#include "buffer_head_io.h"
+
 static int ocfs_symlink_get_block(struct inode *inode, sector_t iblock,
 		struct buffer_head *bh_result, int create)
 {

Modified: branches/alloc_inode/fs/ocfs2/buffer_head_io.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/buffer_head_io.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/buffer_head_io.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -192,7 +192,7 @@
 			     "not match inode (%u)\n",
 			     (unsigned long long)bh->b_blocknr, 
 			     (bh->b_state & STATE_BIT_MASK) >> 19,
-			     atomic_read(GET_INODE_CLEAN_SEQ(inode)));
+			     ocfs2_get_inode_seq(inode));
 			ignore_cache = 1;
 		}
 

Modified: branches/alloc_inode/fs/ocfs2/buffer_head_io.h
===================================================================
--- branches/alloc_inode/fs/ocfs2/buffer_head_io.h	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/buffer_head_io.h	2005-05-19 22:36:51 UTC (rev 2291)
@@ -23,8 +23,8 @@
  * Boston, MA 021110-1307, USA.
  */
 
-#ifndef OCFSIO_H
-#define OCFSIO_H
+#ifndef OCFS2_BUFFER_HEAD_IO_H
+#define OCFS2_BUFFER_HEAD_IO_H
 
 #include <linux/buffer_head.h>
 
@@ -64,6 +64,11 @@
 #define STATE_BIT_MASK		((~0UL) << USED_BH_BITS)
 
 
+static inline unsigned int ocfs2_get_inode_seq(struct inode *inode)
+{
+	return atomic_read(&OCFS2_I(inode)->ip_clean_buffer_seq);
+}
+
 static inline void CLEAR_BH_SEQNUM(struct buffer_head *bh)
 {
 	unsigned int prev = bh->b_state & STATE_BIT_MASK;
@@ -72,7 +77,7 @@
 
 static inline void SET_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
 {
-	unsigned int seq = (atomic_read(GET_INODE_CLEAN_SEQ(inode)) & 
+	unsigned int seq = (ocfs2_get_inode_seq(inode) & 
 			    STATE_BIT_MAX_MASK) << USED_BH_BITS;
 
 	CLEAR_BH_SEQNUM(bh);
@@ -85,7 +90,7 @@
 	unsigned int seq =
 		(bh->b_state & STATE_BIT_MASK) >> USED_BH_BITS;
 
-	ret = (seq == atomic_read(GET_INODE_CLEAN_SEQ(inode)));
+	ret = (seq == ocfs2_get_inode_seq(inode));
 	return ret;
 }
 
@@ -119,4 +124,4 @@
 	return status;
 }
 
-#endif /* OCFSIO_H */
+#endif /* OCFS2_BUFFER_HEAD_IO_H */

Modified: branches/alloc_inode/fs/ocfs2/dlmglue.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/dlmglue.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/dlmglue.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -63,6 +63,8 @@
 #define OCFS2_LOCK_ID_MAX_LEN  32
 #define OCFS2_LOCK_ID_PAD "000000"
 
+static spinlock_t clean_buffer_lock = SPIN_LOCK_UNLOCKED;
+
 static char ocfs2_lock_type_char[OCFS_NUM_LOCK_TYPES] = {
 	[OCFS_TYPE_META]  = 'M',
 	[OCFS_TYPE_DATA]  = 'D',
@@ -495,31 +497,33 @@
 	mlog_exit_void();
 }
 
+void ocfs2_init_inode_seq(struct inode *inode)
+{
+	atomic_set(&OCFS2_I(inode)->ip_clean_buffer_seq,
+		   atomic_read(&OCFS2_SB(inode->i_sb)->clean_buffer_seq));
+}
+
 static void ocfs2_inc_inode_seq(ocfs_super *osb,
 				struct inode *inode)
 {
-	atomic_t *seq;
-
 	mlog_entry_void();
 
-	seq = GET_INODE_CLEAN_SEQ(inode);
+	mlog(0, "incrementing inode seq... current is %d\n", ocfs2_get_inode_seq(inode));
 
-	mlog(0, "incrementing inode seq... current is %d\n", atomic_read(seq));
-
 	/* wrap to ONE after 13 bits, will need a spinlock */
-	spin_lock (&osb->clean_buffer_lock);
+	spin_lock (&clean_buffer_lock);
 	if ((atomic_read(&osb->clean_buffer_seq)+1) % STATE_BIT_MAX == 0)
 		atomic_set(&osb->clean_buffer_seq, 1);
 	else
 		atomic_inc(&osb->clean_buffer_seq);
-	spin_unlock (&osb->clean_buffer_lock);
+	spin_unlock (&clean_buffer_lock);
 
 	/* doesn't matter if this another process */
 	/* has already incremented the global seq */
-	atomic_set(seq, atomic_read(&osb->clean_buffer_seq));
+	ocfs2_init_inode_seq(inode);
 
 	mlog(0, "done incrementing inode seq... new is %d\n",
-	     atomic_read(seq));
+	     ocfs2_get_inode_seq(inode));
 
 	mlog_exit_void();
 }

Modified: branches/alloc_inode/fs/ocfs2/dlmglue.h
===================================================================
--- branches/alloc_inode/fs/ocfs2/dlmglue.h	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/dlmglue.h	2005-05-19 22:36:51 UTC (rev 2291)
@@ -117,5 +117,6 @@
 
 void ocfs2_meta_lvb_set_trunc_clusters(struct inode *inode,
 				       unsigned int trunc_clusters);
+void ocfs2_init_inode_seq(struct inode *inode);
 
 #endif	/* DLMGLUE_H */

Modified: branches/alloc_inode/fs/ocfs2/inode.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/inode.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/inode.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -214,7 +214,6 @@
 	memset(i, 0, sizeof(ocfs_inode_private));
 
 	i->ip_flags = 0;
-	atomic_set(&i->ip_clean_buffer_seq, 0);
 	i->ip_next_orphan = NULL;
 
 	init_rwsem(&i->ip_alloc_sem);
@@ -313,20 +312,20 @@
 	
 	switch (inode->i_mode & S_IFMT) {
 	    case S_IFREG:
-		    atomic_set(GET_INODE_CLEAN_SEQ(inode), atomic_read(&osb->clean_buffer_seq));
+		    ocfs2_init_inode_seq(inode);
 		    inode->i_fop = &ocfs_fops;
 		    inode->i_op = &ocfs_file_iops;
 		    i_size_write(inode, fe->i_size);
 		    OCFS2_I(inode)->ip_mmu_private = inode->i_size;
 		    break;
 	    case S_IFDIR:
-		    atomic_set(GET_INODE_CLEAN_SEQ(inode), atomic_read(&osb->clean_buffer_seq));
+		    ocfs2_init_inode_seq(inode);
 		    inode->i_op = &ocfs_dir_iops;
 		    inode->i_fop = &ocfs_dops;
 		    i_size_write(inode, fe->i_size);
 		    break;
 	    case S_IFLNK:
-		    atomic_set(GET_INODE_CLEAN_SEQ(inode), atomic_read(&osb->clean_buffer_seq));
+		    ocfs2_init_inode_seq(inode);
 		    if (ocfs2_inode_is_fast_symlink(inode))
 			inode->i_op = &ocfs_fast_symlink_inode_operations;
 		    else
@@ -777,6 +776,7 @@
 			"Clear inode of %"MLFu64" has non empty handle pointer\n",
 			oi->ip_blkno);
 
+	atomic_set(&oi->ip_clean_buffer_seq, 0);
 	oi->ip_flags = 0;
 	oi->ip_created_trans = 0;
 	oi->ip_last_trans = 0;

Modified: branches/alloc_inode/fs/ocfs2/namei.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/namei.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/namei.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -566,7 +566,7 @@
 		fe->id1.dev1.i_rdev = cpu_to_le64(huge_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));
+		ocfs2_init_inode_seq(inode);
 
 	if (S_ISDIR (mode))
 		fe->i_links_count = 2;

Modified: branches/alloc_inode/fs/ocfs2/ocfs.h
===================================================================
--- branches/alloc_inode/fs/ocfs2/ocfs.h	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/ocfs.h	2005-05-19 22:36:51 UTC (rev 2291)
@@ -200,7 +200,6 @@
 
 	struct semaphore  ip_io_sem;
 
-	atomic_t          ip_clean_buffer_seq;
 	u32             ip_flags; /* see below */
 
 	/* protected by recovery_lock. */
@@ -303,7 +302,6 @@
 	atomic_t needs_checkpoint;
 	struct _ocfs_journal *journal;
 	atomic_t clean_buffer_seq;
-	spinlock_t clean_buffer_lock;
 
 	enum ocfs2_local_alloc_state local_alloc_state;
 	struct buffer_head *local_alloc_bh;

Modified: branches/alloc_inode/fs/ocfs2/slot_map.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/slot_map.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/slot_map.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -37,6 +37,7 @@
 #include "dlmglue.h"
 #include "extent_map.h"
 #include "heartbeat.h"
+#include "inode.h"
 #include "slot_map.h"
 #include "sysfile.h"
 

Modified: branches/alloc_inode/fs/ocfs2/super.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/super.c	2005-05-19 22:31:52 UTC (rev 2290)
+++ branches/alloc_inode/fs/ocfs2/super.c	2005-05-19 22:36:51 UTC (rev 2291)
@@ -1031,7 +1031,6 @@
 	init_waitqueue_head (&osb->checkpoint_event);
 	atomic_set (&osb->needs_checkpoint, 0);
 	atomic_set (&osb->clean_buffer_seq, 1);
-	spin_lock_init (&osb->clean_buffer_lock);
 
 	osb->node_num = OCFS_INVALID_NODE_NUM;
 	osb->slot_num = OCFS_INVALID_NODE_NUM;



More information about the Ocfs2-commits mailing list