[Ocfs2-commits] jlbec commits r962 - trunk/src/inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 1 18:54:59 CDT 2004


Author: jlbec
Date: 2004-06-01 17:54:57 -0500 (Tue, 01 Jun 2004)
New Revision: 962

Modified:
   trunk/src/inc/ocfs.h
   trunk/src/inc/ocfs_journal.h
Log:

o ocfs_journal.h #define functions converted to static inline.



Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-06-01 22:42:22 UTC (rev 961)
+++ trunk/src/inc/ocfs.h	2004-06-01 22:54:57 UTC (rev 962)
@@ -66,7 +66,6 @@
 #include  <linux/pagemap.h>
 #include  <linux/random.h>
 #include  <linux/string.h>
-#include  <linux/jbd.h>
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/writeback.h>
 #else

Modified: trunk/src/inc/ocfs_journal.h
===================================================================
--- trunk/src/inc/ocfs_journal.h	2004-06-01 22:42:22 UTC (rev 961)
+++ trunk/src/inc/ocfs_journal.h	2004-06-01 22:54:57 UTC (rev 962)
@@ -27,6 +27,9 @@
 #ifndef  _OCFSJOURNAL_H_
 #define  _OCFSJOURNAL_H_
 
+#include <linux/fs.h>
+#include <linux/jbd.h>
+
 #define OCFS_JOURNAL_CURRENT_VERSION	1
 #define OCFS_DEFAULT_COMMIT_INTERVAL 	(HZ * 5)
 #define OCFS_JOURNAL_DEFAULT_SIZE	(8 * ONE_MEGA_BYTE)
@@ -102,17 +105,6 @@
 	char                *data;   /* the actual data */
 };
 
-#define ocfs_handle_free_all_copyout(handle)				      \
-do {									      \
-	while (handle->num_co) {					      \
-		handle->num_co--;					      \
-		if (handle->co_buffs[handle->num_co].data)		      \
-			ocfs_free(handle->co_buffs[handle->num_co].data);     \
-	}								      \
-	ocfs_free(handle->co_buffs);					      \
-	handle->co_buffs = NULL;					      \
-} while (0)
-
 struct _ocfs_journal_handle {
 	handle_t            *k_handle; /* kernel handle.                */
 	ocfs_journal        *journal;
@@ -169,6 +161,18 @@
 /* was local alloc used (should we release the sem?) */
 #define OCFS_HANDLE_LOCAL_ALLOC			4
 
+static inline void ocfs_handle_free_all_copyout(ocfs_journal_handle *handle)
+{
+	while (handle->num_co) {
+		handle->num_co--;
+		if (handle->co_buffs[handle->num_co].data)
+			ocfs_free(handle->co_buffs[handle->num_co].data);
+	}
+	ocfs_free(handle->co_buffs);
+	handle->co_buffs = NULL;
+}
+
+
 static inline void ocfs_handle_set_checkpoint(ocfs_journal_handle *handle,
 					      int checkpoint)
 {
@@ -186,25 +190,25 @@
 		handle->flags &= ~OCFS_HANDLE_SYNC;
 }
 
-/* TODO: turn both of these into static inlines, once the include file
- * mess is sorted out. */
-#define ocfs_handle_add_commit_bits(handle, len, fileoff, nodenum, type)      \
-({									      \
-	int rv = 0;							      \
-	if (!handle->commit_bits) 					      \
-		handle->commit_bits = ocfs_alloc_bitmap_free_head();	      \
-									      \
-	if (!handle->commit_bits)					      \
-		rv = -ENOMEM;						      \
-	else								      \
-		rv = ocfs_add_to_bitmap_free_head(handle->osb,		      \
-						  handle->commit_bits,	      \
-						  len, fileoff, nodenum,      \
-						  type);		      \
-	rv;								      \
-})
+static inline int ocfs_handle_add_commit_bits(ocfs_journal_handle *handle,
+					      __u32 len, __u32 fileoff,
+					      __u32 nodenum, __u32 type)
+{
+	int ret = 0;
+	if (!handle->commit_bits)
+		handle->commit_bits = ocfs_alloc_bitmap_free_head();
 
+	if (!handle->commit_bits)
+		ret = -ENOMEM;
+	else
+		ret = ocfs_add_to_bitmap_free_head(handle->osb,
+						   handle->commit_bits,
+						   len, fileoff,
+						   nodenum, type);
+	return ret;
+}
 
+
 /*
  *  Journal Control:
  *  Initialize, Load, Shutdown, Wipe, Create a journal.



More information about the Ocfs2-commits mailing list