[Ocfs2-commits] manish commits r1021 - branches/format-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 7 13:41:43 CDT 2004


Author: manish
Date: 2004-06-07 12:41:41 -0500 (Mon, 07 Jun 2004)
New Revision: 1021

Modified:
   branches/format-changes/src/hash.c
   branches/format-changes/src/hash.h
Log:
clean up ocfs_bh_sem_lock_modify debug code


Modified: branches/format-changes/src/hash.c
===================================================================
--- branches/format-changes/src/hash.c	2004-06-07 17:41:19 UTC (rev 1020)
+++ branches/format-changes/src/hash.c	2004-06-07 17:41:41 UTC (rev 1021)
@@ -274,7 +274,46 @@
 	return ret;
 }
 
-#ifndef BH_SEM_DEBUG
+#ifdef BH_SEM_DEBUG
+int __ocfs_bh_sem_lock_modify(struct buffer_head *bh, const char *func,
+			      const char *file, int line)
+{
+	ocfs_bh_sem *sem;
+	int ret;
+
+	sem = ocfs_bh_sem_lookup(bh);
+	if (!sem)
+		BUG();
+
+	ocfs_bh_sem_down(sem);
+	ret = OCFS_BH_SEM_GOT_LOCK;
+	if (buffer_modified(bh)) {
+		if (sem->s_pid == 0) {
+			sem->s_pid = current->pid;
+
+			snprintf(sem->s_modifier, 40, "%s:%s:%d",
+				 func, file, line);
+
+			ocfs_bh_sem_get(sem);
+		} else if (sem->s_pid != current->pid) {
+			ret = OCFS_BH_SEM_WAIT_ON_MODIFY;
+		}
+	} else {
+		if (sem->s_pid != 0)
+			printk("first to modify, but pid is NOT 0!\n");
+		sem->s_pid = current->pid;
+
+		snprintf(sem->s_modifier, 40, "%s:%s:%d", 
+			 func, file, line);
+
+		ocfs_bh_sem_get(sem);
+
+		set_buffer_modified(bh);
+	}
+
+	return ret;
+}
+#else
 int ocfs_bh_sem_lock_modify(struct buffer_head *bh)
 {
 	ocfs_bh_sem *sem;

Modified: branches/format-changes/src/hash.h
===================================================================
--- branches/format-changes/src/hash.h	2004-06-07 17:41:19 UTC (rev 1020)
+++ branches/format-changes/src/hash.h	2004-06-07 17:41:41 UTC (rev 1021)
@@ -36,33 +36,12 @@
 int ocfs_bh_sem_unlock(struct buffer_head *bh);
 void ocfs_clear_buffer_modified(struct buffer_head *bh);
 void wait_on_buffer_modified(struct buffer_head *bh);
+
 #ifdef BH_SEM_DEBUG
-#define ocfs_bh_sem_lock_modify(bh) ({ \
-	ocfs_bh_sem *sem; \
-	int ret; \
-	sem = ocfs_bh_sem_lookup(bh); \
-	if (!sem) \
-		BUG(); \
-	ocfs_bh_sem_down(sem); \
-	ret = OCFS_BH_SEM_GOT_LOCK; \
-	if (buffer_modified(bh)) { \
-		if (sem->s_pid == 0) { \
-			sem->s_pid = current->pid; \
-			snprintf(sem->s_modifier, 40, "%s:%s:%d",  __FUNCTION__, __FILE__, __LINE__); \
-			ocfs_bh_sem_get(sem); \
-		} else if (sem->s_pid != current->pid) { \
-			ret = OCFS_BH_SEM_WAIT_ON_MODIFY; \
-		} \
-	} else { \
-		if (sem->s_pid != 0) \
-			printk("first to modify, but pid is NOT 0!\n"); \
-		sem->s_pid = current->pid; \
-		snprintf(sem->s_modifier, 40, "%s:%s:%d",  __FUNCTION__, __FILE__, __LINE__); \
-		ocfs_bh_sem_get(sem); \
-		set_buffer_modified(bh); \
-	} \
-	ret; \
-})
+#define ocfs_bh_sem_lock_modify(bh) \
+	__ocfs_bh_sem_lock_modify(bh, __FUNCTION__, __FILE__, __LINE__)
+int __ocfs_bh_sem_lock_modify(struct buffer_head *bh, const char *func,
+			      const char *file, int line);
 #else
 int ocfs_bh_sem_lock_modify(struct buffer_head *bh);
 #endif



More information about the Ocfs2-commits mailing list