[Ocfs2-tools-commits] jlbec commits r274 - in branches/dlm-changes/libocfs2: . include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Sep 28 20:36:38 CDT 2004


Author: jlbec
Date: 2004-09-28 20:36:35 -0500 (Tue, 28 Sep 2004)
New Revision: 274

Modified:
   branches/dlm-changes/libocfs2/bitmap.c
   branches/dlm-changes/libocfs2/include/bitmap.h
Log:

o Add operation for merge testing.



Modified: branches/dlm-changes/libocfs2/bitmap.c
===================================================================
--- branches/dlm-changes/libocfs2/bitmap.c	2004-09-29 00:51:11 UTC (rev 273)
+++ branches/dlm-changes/libocfs2/bitmap.c	2004-09-29 01:36:35 UTC (rev 274)
@@ -267,14 +267,8 @@
 	    next->bc_start_bit)
 		return OCFS2_ET_INVALID_BIT;
 
-	/*
-	 * If at least one cpos is not zero, then these have real disk
-	 * locations, and they better be cpos contig as well.
-	 */
-	if ((prev->bc_cpos || next->bc_cpos) &&
-	    ((prev->bc_cpos +
-	     ((prev->bc_total_bits / 8) /
-	      bitmap->b_fs->fs_clusters)) != next->bc_cpos))
+	if (bitmap->b_ops->merge_cluster &&
+	    !(*bitmap->b_ops->merge_cluster)(bitmap, prev, next))
 		return OCFS2_ET_INVALID_BIT;
 
 	new_bits = (uint64_t)(prev->bc_total_bits) +

Modified: branches/dlm-changes/libocfs2/include/bitmap.h
===================================================================
--- branches/dlm-changes/libocfs2/include/bitmap.h	2004-09-29 00:51:11 UTC (rev 273)
+++ branches/dlm-changes/libocfs2/include/bitmap.h	2004-09-29 01:36:35 UTC (rev 274)
@@ -29,6 +29,20 @@
 
 #include "kernel-rbtree.h"
 
+struct ocfs2_bitmap_cluster {
+	struct rb_node bc_node;
+	uint64_t bc_start_bit;		/* Bit offset.  Must be
+					   aligned on
+					   (clustersize * 8) */
+	int bc_total_bits;		/* set_bit() and friends can't
+					   handle bitmaps larger than
+					   int offsets */
+	int bc_set_bits;
+	uint32_t bc_cpos;		/* If this bitmap is stored
+					   on disk, where it lives */
+	char *bc_bitmap;
+};
+
 struct ocfs2_bitmap_operations {
 	errcode_t (*set_bit)(ocfs2_bitmap *bm, uint64_t bit,
 			     int *oldval);
@@ -36,6 +50,9 @@
 			       int *oldval);
 	errcode_t (*test_bit)(ocfs2_bitmap *bm, uint64_t bit,
 			      int *val);
+	errcode_t (*merge_cluster)(ocfs2_bitmap *bm,
+				   struct ocfs2_bitmap_cluster *prev,
+				   struct ocfs2_bitmap_cluster *next);
 	errcode_t (*read_bitmap)(ocfs2_bitmap *bm);
 	errcode_t (*write_bitmap)(ocfs2_bitmap *bm);
 	void (*destroy_notify)(ocfs2_bitmap *bm);
@@ -56,21 +73,7 @@
 	void *b_private;
 };
 
-struct ocfs2_bitmap_cluster {
-	struct rb_node bc_node;
-	uint64_t bc_start_bit;		/* Bit offset.  Must be
-					   aligned on
-					   (clustersize * 8) */
-	int bc_total_bits;		/* set_bit() and friends can't
-					   handle bitmaps larger than
-					   int offsets */
-	int bc_set_bits;
-	uint32_t bc_cpos;		/* If this bitmap is stored
-					   on disk, where it lives */
-	char *bc_bitmap;
-};
 
-
 errcode_t ocfs2_bitmap_new(ocfs2_filesys *fs,
 			   uint64_t total_bits,
 			   const char *description,



More information about the Ocfs2-tools-commits mailing list