[Ocfs2-commits] mfasheh commits r1581 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Oct 15 16:46:41 CDT 2004


Author: mfasheh
Date: 2004-10-15 16:46:39 -0500 (Fri, 15 Oct 2004)
New Revision: 1581

Modified:
   trunk/src/bitmap.c
   trunk/src/localalloc.c
   trunk/src/ocfs2.h
   trunk/src/suballoc.c
Log:
* use endian safe versions of bitop functions for on disk bitmaps.



Modified: trunk/src/bitmap.c
===================================================================
--- trunk/src/bitmap.c	2004-10-15 20:51:10 UTC (rev 1580)
+++ trunk/src/bitmap.c	2004-10-15 21:46:39 UTC (rev 1581)
@@ -153,11 +153,11 @@
  */
 static int ocfs_test_allocatable(int nr, struct buffer_head *bh)
 {
-	if (test_bit(nr, (unsigned long *)bh->b_data))
+	if (ocfs2_test_bit(nr, (unsigned long *)bh->b_data))
 		return 0;
 	if (!buffer_jbd(bh) || !bh2jh(bh)->b_committed_data)
 		return 1;
-	return !test_bit(nr, (unsigned long *)bh2jh(bh)->b_committed_data);
+	return !ocfs2_test_bit(nr, (unsigned long *)bh2jh(bh)->b_committed_data);
 }
 
 /*
@@ -212,9 +212,9 @@
 	  "localstart=%u\n", c, lastbh, size, localstart);*/
 	buffer = currbh->b_data;
 
-	while ((*bitoff = find_next_zero_bit(buffer,
-					    OCFS_BITS_IN_CHUNK(osb->sb),
-					    localstart)) != -1) {
+	while ((*bitoff = ocfs2_find_next_zero_bit(buffer,
+						   OCFS_BITS_IN_CHUNK(osb->sb),
+						   localstart)) != -1) {
 		/*LOG_TRACE_ARGS("c=%u, globaloff=%u, *bitoff=%u, "
 			       "localstart=%u\n", c, globaloff, *bitoff, 
 			       localstart);*/
@@ -383,7 +383,7 @@
 	buff = currbh->b_data;
 
 	while (num--) {
-		set_bit (local++, buff);
+		ocfs2_set_bit (local++, buff);
 		if ((local >= OCFS_BITS_IN_CHUNK(sb)) && (num != 0)) {
 			local = 0;
 			status = ocfs_journal_dirty(handle, currbh);
@@ -454,8 +454,8 @@
 	buff = currbh->b_data;
 
 	while (num--) {
-		clear_bit (local, buff);
-		set_bit(local, 
+		ocfs2_clear_bit (local, buff);
+		ocfs2_set_bit(local, 
 			(unsigned long *)bh2jh(currbh)->b_committed_data);
 		local++;
 

Modified: trunk/src/localalloc.c
===================================================================
--- trunk/src/localalloc.c	2004-10-15 20:51:10 UTC (rev 1580)
+++ trunk/src/localalloc.c	2004-10-15 21:46:39 UTC (rev 1581)
@@ -601,7 +601,7 @@
 	}
 
 	while(bits_wanted--)
-		set_bit(start++, bitmap);
+		ocfs2_set_bit(start++, bitmap);
 
 	status = ocfs_journal_dirty(handle, osb->local_alloc_bh);
 	if (status < 0) {
@@ -661,7 +661,7 @@
 	numfound = bitoff = startoff = 0;
 	lastzero = -1;
 	left = LOCAL_ALLOC(alloc)->la_bm_bits;
-	while ((bitoff = find_next_zero_bit(bitmap, left, startoff)) != -1) {
+	while ((bitoff = ocfs2_find_next_zero_bit(bitmap, left, startoff)) != -1) {
 		if (bitoff == left) {
 			/* LOG_TRACE_ARGS("bitoff (%d) == left", bitoff); */
 			break;
@@ -794,7 +794,7 @@
 	/* any unset bits in local alloc need to be unset in bitmap. */
 	bit_off = 0;
 	left = LOCAL_ALLOC(alloc)->la_bm_bits;
-	while ((bit_off = find_next_zero_bit(bitmap, left, bit_off)) 
+	while ((bit_off = ocfs2_find_next_zero_bit(bitmap, left, bit_off)) 
 	       != -1) {
 		if (bit_off >= left) {
 			/*LOG_TRACE_ARGS("bit_off (%d) >= left\n", bit_off);*/

Modified: trunk/src/ocfs2.h
===================================================================
--- trunk/src/ocfs2.h	2004-10-15 20:51:10 UTC (rev 1580)
+++ trunk/src/ocfs2.h	2004-10-15 21:46:39 UTC (rev 1581)
@@ -67,4 +67,8 @@
 	return (u64)clusters << cl_bits;
 }
 
+#define ocfs2_set_bit ext2_set_bit
+#define ocfs2_clear_bit ext2_clear_bit
+#define ocfs2_test_bit ext2_test_bit
+#define ocfs2_find_next_zero_bit ext2_find_next_zero_bit
 #endif  /* OCFS2_H */

Modified: trunk/src/suballoc.c
===================================================================
--- trunk/src/suballoc.c	2004-10-15 20:51:10 UTC (rev 1580)
+++ trunk/src/suballoc.c	2004-10-15 21:46:39 UTC (rev 1581)
@@ -125,7 +125,7 @@
 	bg->bg_parent_dinode = OCFS_I(alloc_inode)->ip_blkno;
 	bg->bg_blkno = group_blkno;
 	/* set the 1st bit in the bitmap to account for the descriptor block */
-	set_bit(0, (unsigned long *) bg->bg_bitmap);
+	ocfs2_set_bit(0, (unsigned long *) bg->bg_bitmap);
 	bg->bg_free_bits_count = bg->bg_bits - 1;
 
 	status = ocfs_journal_dirty(handle, bg_bh);
@@ -526,9 +526,9 @@
 	found = start = best_offset = best_size = 0;
 	bitmap = bg->bg_bitmap;
 
-	while((offset = find_next_zero_bit(bitmap, 
-					   bg->bg_bits, 
-					   start)) != -1) {
+	while((offset = ocfs2_find_next_zero_bit(bitmap, 
+						 bg->bg_bits, 
+						 start)) != -1) {
 		if (offset == bg->bg_bits)
 			break;
 
@@ -596,7 +596,7 @@
 	bg->bg_free_bits_count -= num_bits;
 
 	while(num_bits--)
-		set_bit(bit_off++, bitmap);
+		ocfs2_set_bit(bit_off++, bitmap);
 
 	status = ocfs_journal_dirty(handle, 
 				    group_bh);
@@ -1015,8 +1015,8 @@
 
 	tmp = count;
 	while(tmp--)
-		clear_bit((start_bit + tmp),
-			  (unsigned long *) group->bg_bitmap);
+		ocfs2_clear_bit((start_bit + tmp),
+				(unsigned long *) group->bg_bitmap);
 
 	group->bg_free_bits_count += count;
 



More information about the Ocfs2-commits mailing list