[Ocfs2-commits] mfasheh commits r1392 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Aug 27 17:56:23 CDT 2004


Author: mfasheh
Date: 2004-08-27 17:56:22 -0500 (Fri, 27 Aug 2004)
New Revision: 1392

Modified:
   trunk/src/dlm.c
   trunk/src/ocfs.h
Log:
* ocfs_update_disk_lock took a buffer_head ** but never was actually
  expected to pass anything back, so change it to a standard buffer_head *

* get rid of DLOCK_ flags to ocfs_update_disk_lock as they were always
  passed in as the same.



Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c	2004-08-27 02:20:00 UTC (rev 1391)
+++ trunk/src/dlm.c	2004-08-27 22:56:22 UTC (rev 1392)
@@ -55,13 +55,13 @@
 
 
 static inline int ocfs_wait_for_readonly_drop(ocfs_super *osb, struct inode *inode);
-static int ocfs_update_disk_lock (ocfs_super * osb, __u32 flags, struct buffer_head **bh, struct inode *inode);
+static int ocfs_update_disk_lock (ocfs_super * osb, struct buffer_head *bh, struct inode *inode);
 
 /*
  * ocfs_update_disk_lock()
  * inode is definitely non NULL
  */
-static int ocfs_update_disk_lock (ocfs_super * osb, __u32 flags, struct buffer_head **bh, struct inode *inode)
+static int ocfs_update_disk_lock (ocfs_super * osb, struct buffer_head *bh, struct inode *inode)
 {
 	int status = 0;
 	ocfs2_dinode *fe = NULL;
@@ -72,28 +72,26 @@
 
 	status = ocfs_read_bh(osb,
 			      OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
-			      bh, 0, inode);
+			      &bh, 0, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto finally;
 	}
 
-	fe = (ocfs2_dinode *) (*bh)->b_data;
+	fe = (ocfs2_dinode *) bh->b_data;
 
-	if (flags & DLOCK_FLAG_MASTER && 
-	    DISK_LOCK(fe)->dl_master != lockres->master_node_num) {
+	if (DISK_LOCK(fe)->dl_master != lockres->master_node_num) {
 		changed = 1;
 		DISK_LOCK(fe)->dl_master = lockres->master_node_num;
 	}
 
-	if (flags & DLOCK_FLAG_LOCK &&
-	    DISK_LOCK(fe)->dl_level != lockres->lock_type) {
+	if (DISK_LOCK(fe)->dl_level != lockres->lock_type) {
 		changed = 1;
 		DISK_LOCK(fe)->dl_level = lockres->lock_type;
 	}
 
 	if (changed) {
-		status = ocfs_write_bh (osb, *bh, 0, inode);
+		status = ocfs_write_bh (osb, bh, 0, inode);
 		if (status < 0) 
 			LOG_ERROR_STATUS (status);
 	}
@@ -519,7 +517,6 @@
 	ocfs_node_map vote_map;
 	ocfs2_dinode *fe = NULL;
 	__u64 lock_id;
-	__u32 lock_write_flags = DLOCK_FLAG_MASTER | DLOCK_FLAG_LOCK;
 	__u32 lock_type = requested_lock;
 	int need_to_zap_buffers = 0, need_lock_write = 1;
 	int is_readonly = (flags & FLAG_READONLY) ? 1 : 0;
@@ -637,7 +634,13 @@
 	if (need_lock_write) {
 		lockres->lock_type = requested_lock;
 		lockres->master_node_num = osb->node_num;
-		status = ocfs_update_disk_lock (osb, lock_write_flags, &bh, inode);
+		if (!bh) {
+			printk("We're trying to write a lock but I wasn't "
+			       "passed a buffer: inode %llu, flags %u\n", 
+			       OCFS_I(inode)->ip_blkno, flags);
+			BUG();
+		}
+		status = ocfs_update_disk_lock (osb, bh, inode);
 		if (status < 0)
 			LOG_ERROR_STATUS (status);
 	}

Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h	2004-08-27 02:20:00 UTC (rev 1391)
+++ trunk/src/ocfs.h	2004-08-27 22:56:22 UTC (rev 1392)
@@ -285,19 +285,6 @@
 #define OCFS_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
 #define OCFS2_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
 
-
-#define DLOCK_FLAG_UNUSED1     (0x1)
-#define DLOCK_FLAG_LOCK        (0x2)
-#define DLOCK_FLAG_SEQ_NUM     (0x4)
-#define DLOCK_FLAG_MASTER      (0x8)
-#define DLOCK_FLAG_LAST_UPDATE (0x10)
-#define DLOCK_FLAG_UNUSED2     (0x20)
-#define DLOCK_FLAG_ALL         (DLOCK_FLAG_LOCK | \
-				DLOCK_FLAG_SEQ_NUM | DLOCK_FLAG_MASTER | \
-				DLOCK_FLAG_LAST_UPDATE)
-
-
-
 #define OCFS_IPC_DEFAULT_PORT   7001
 
 		



More information about the Ocfs2-commits mailing list