[Ocfs2-commits] khackel commits r1166 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 21 17:33:09 CDT 2004


Author: khackel
Date: 2004-06-21 16:33:08 -0500 (Mon, 21 Jun 2004)
New Revision: 1166

Modified:
   trunk/src/alloc.c
   trunk/src/super.c
Log:
change global bitmap over to use cache locking and bh caching
if this works out, we can try using the same for other bitmaps, then eliminate EXCLUSIVE locks altogether

Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c	2004-06-21 21:32:22 UTC (rev 1165)
+++ trunk/src/alloc.c	2004-06-21 21:33:08 UTC (rev 1166)
@@ -534,16 +534,23 @@
 	ocfs_alloc_bm *bitmap;
 	int status;
 	__u32 bitmapblocks; /* we only care about the valid blocks */
+	struct inode *bitmap_inode = NULL;
 
 	LOG_ENTRY();
 
+	bitmap_inode = ocfs_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE, -1);
+	if (!bitmap_inode) {
+		LOG_ERROR_STATUS (status = -EINVAL);
+		goto bail;
+	}
+
 	bitmap = &osb->cluster_bitmap;
 
 	bitmapblocks = ocfs_blocks_for_bits(osb->sb, bitmap->validbits);
 
 	status = ocfs_read_bhs(osb, osb->bitmap_blkno << osb->sb->s_blocksize_bits, 
 			       bitmapblocks << osb->sb->s_blocksize_bits, 
-			       bitmap->chunk, 0, NULL);
+			       bitmap->chunk, OCFS_BH_CACHED, bitmap_inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto bail;
@@ -556,6 +563,8 @@
 
 	status = 0;
 bail:
+	if (bitmap_inode)
+		iput(bitmap_inode);
 	LOG_EXIT_STATUS(status);
 	return(0);
 }
@@ -2911,14 +2920,14 @@
 		ocfs_handle_add_inode(handle, bitmap_inode);
 
 		/* Get the allocation lock here */
-		status = ocfs_acquire_lock(osb, OCFS_DLM_EXCLUSIVE_LOCK,
+		status = ocfs_acquire_lock(osb, OCFS_DLM_ENABLE_CACHE_LOCK, 
 					   0, &bh, bitmap_inode);
 		if (status < 0) {
 			if (status != -EINTR)
 				LOG_ERROR_STATUS (status);
 			goto leave;
 		}
-		ocfs_handle_add_lock(handle, OCFS_DLM_EXCLUSIVE_LOCK, 
+		ocfs_handle_add_lock(handle, OCFS_DLM_ENABLE_CACHE_LOCK, 
 				      0, bh, bitmap_inode, 1);
 	}
 
@@ -2977,7 +2986,7 @@
 	/* Ok, somewhat lame, but we submit the whole bitmap for reading here*/
 	if (ocfs_read_bhs(osb, osb->bitmap_blkno << osb->sb->s_blocksize_bits, 
 			  bitmapblocks << osb->sb->s_blocksize_bits,
-			  osb->cluster_bitmap.chunk, 0, bitmap_inode)) {
+			  osb->cluster_bitmap.chunk, OCFS_BH_CACHED, bitmap_inode)) {
 		LOG_ERROR_STATUS(-EIO);
 		goto leave;
 	}
@@ -3528,7 +3537,7 @@
 	status = ocfs_read_bhs(osb,
 			       (osb->bitmap_blkno + start) << osb->sb->s_blocksize_bits,
 			       numblocks << osb->sb->s_blocksize_bits,
-			       &osb->cluster_bitmap.chunk[start], 0, 
+			       &osb->cluster_bitmap.chunk[start], OCFS_BH_CACHED, 
 			       main_bm_inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
@@ -3833,9 +3842,8 @@
 		ocfs_handle_add_inode(handle, main_bm_inode);
 
 		/* Get the allocation lock here */
-		status = ocfs_acquire_lock(osb, OCFS_DLM_EXCLUSIVE_LOCK,
-					   0, &main_bm_bh,
-					   main_bm_inode);
+		status = ocfs_acquire_lock(osb, OCFS_DLM_ENABLE_CACHE_LOCK, 
+					   0, &main_bm_bh, main_bm_inode);
 		if (status < 0) {
 			main_bm_bh = NULL;
 			if (status != -EINTR)
@@ -3843,8 +3851,8 @@
 			goto bail;
 		}
 
-		ocfs_handle_add_lock(handle, OCFS_DLM_EXCLUSIVE_LOCK, 0,
-				      main_bm_bh, main_bm_inode, 1);
+		ocfs_handle_add_lock(handle, OCFS_DLM_ENABLE_CACHE_LOCK, 
+				     0, main_bm_bh, main_bm_inode, 1);
 
 
 		alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-06-21 21:32:22 UTC (rev 1165)
+++ trunk/src/super.c	2004-06-21 21:33:08 UTC (rev 1166)
@@ -282,18 +282,21 @@
 static int ocfs_release_system_inodes(ocfs_super *osb)
 {
 	int status = 0, i;
+	struct inode *inode;
 
 	LOG_ENTRY();
 
 	for (i = 0; i < NUM_SYSTEM_INODES; i++) {
-		if (osb->system_inodes[i]) {
-			iput(osb->system_inodes[i]);
+		inode = osb->system_inodes[i];
+		if (inode) {
+			iput(inode);
 			osb->system_inodes[i] = NULL;
 		}
 	}
 
-	if (osb->sys_root_inode) {
-		iput(osb->sys_root_inode);
+	inode = osb->sys_root_inode;
+	if (inode) {
+		iput(inode);
 		osb->sys_root_inode = NULL;
 	}
 
@@ -718,8 +721,8 @@
 		return -EIO;
 	}
 
-	/* must this be a non cached read? */
-	status = ocfs_read_bh (osb, GET_INODE_FEOFF(inode), &bh, 0, inode);
+	status = ocfs_read_bh (osb, GET_INODE_FEOFF(inode), &bh, 
+			       OCFS_BH_CACHED, inode);
 	if (status < 0) {
 		LOG_ERROR_STR("failed to read bitmap data");
 		iput (inode);



More information about the Ocfs2-commits mailing list