[Ocfs2-commits] manish commits r950 - trunk/src/inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed May 26 21:56:32 CDT 2004


Author: manish
Date: 2004-05-26 20:56:30 -0500 (Wed, 26 May 2004)
New Revision: 950

Modified:
   trunk/src/inc/io.h
Log:
minor cleanups


Modified: trunk/src/inc/io.h
===================================================================
--- trunk/src/inc/io.h	2004-05-27 01:56:05 UTC (rev 949)
+++ trunk/src/inc/io.h	2004-05-27 01:56:30 UTC (rev 950)
@@ -109,20 +109,24 @@
 	unsigned char *kaddr;
 	
 	OCFS_ASSERT(bh);
+
 	if (!bh->b_blocknr) {
 		printk("%d: warning trying to OCFS_BH_GET_DATA_READ block zero!\n", current->pid);
 		ocfs_show_stack(NULL);
 	}		
 
 	while (1) {
-		if (ocfs_bh_sem_lock(bh)==OCFS_BH_SEM_WAIT_ON_MODIFY) {
+		if (ocfs_bh_sem_lock(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
 			ocfs_bh_sem_unlock(bh);
 			wait_on_buffer_modified(bh);
-		} else
+		} else {
 			break;
+		}
 	}
-	kaddr = kmap((bh)->b_page);
-	kaddr += ((unsigned long)(bh)->b_data & ~PAGE_MASK);
+
+	kaddr = kmap(bh->b_page);
+	kaddr += ((unsigned long)bh->b_data & ~PAGE_MASK);
+
 	return kaddr;
 }
 
@@ -160,10 +164,12 @@
 	unsigned char *kaddr;
 
 	OCFS_ASSERT(bh);
+
 	if (!bh->b_blocknr) {
 		printk("%d: trying to OCFS_BH_GET_DATA_WRITE block zero!\n", current->pid);
 		BUG();
 	}		
+
 	while (1) {
 		if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
 #ifdef VERBOSE_BH_SEM
@@ -177,20 +183,24 @@
 			break;
 		}
 	}
-	kaddr = kmap((bh)->b_page);
-	kaddr += ((unsigned long)(bh)->b_data & ~PAGE_MASK);
+
+	kaddr = kmap(bh->b_page);
+	kaddr += ((unsigned long)bh->b_data & ~PAGE_MASK);
+
 	return kaddr;
 }
 
 static inline void * OCFS_BH_GET_DATA_WRITE_TRYLOCK(struct buffer_head *bh)
 {
 	unsigned char *kaddr;
+
 	OCFS_ASSERT(bh);
 
 	if (!bh->b_blocknr) {
 		printk("%d: trying to OCFS_BH_GET_DATA_WRITE_TRYLOCK block zero!\n", current->pid);
 		BUG();
 	}		
+
 	if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
 #ifdef VERBOSE_BH_SEM
 		printk("ocfs2: called getdata for write but "
@@ -200,8 +210,10 @@
 		ocfs_bh_sem_unlock(bh);
 		return NULL;
 	}
-	kaddr = kmap((bh)->b_page);
-	kaddr += ((unsigned long)(bh)->b_data & ~PAGE_MASK);
+
+	kaddr = kmap(bh->b_page);
+	kaddr += ((unsigned long)bh->b_data & ~PAGE_MASK);
+
 	return kaddr;
 }
 
@@ -218,7 +230,8 @@
 static inline void OCFS_BH_PUT_DATA(struct buffer_head *bh)
 {
 	OCFS_ASSERT(bh);
-	kunmap((bh)->b_page);
+
+	kunmap(bh->b_page);
 	ocfs_bh_sem_unlock(bh);
 }
 
@@ -258,8 +271,8 @@
 static inline int check_block_zero_write(struct buffer_head *bh)
 {
 	if (unlikely(bh->b_blocknr == 0)) {
-		ocfs_vol_disk_hdr *hdr = 
-			(ocfs_vol_disk_hdr *) OCFS_BH_GET_DATA_READ(bh);
+		ocfs_vol_disk_hdr *hdr = OCFS_BH_GET_DATA_READ(bh);
+
 		if (hdr == NULL) {
 			printk ("ocfs2: failed to map bh page!!!\n");
 			return -EIO;
@@ -273,8 +286,10 @@
 			OCFS_BH_PUT_DATA(bh);
 			return -EIO;
 		}
+
 		OCFS_BH_PUT_DATA(bh);
 	}
+
 	return 0;
 }
 



More information about the Ocfs2-commits mailing list