[Ocfs-tools-commits] rev 4 - trunk/fsck
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Feb 4 19:21:02 CST 2004
Author: manish
Date: 2004-02-04 19:20:59 -0600 (Wed, 04 Feb 2004)
New Revision: 4
Modified:
trunk/fsck/fsck.c
trunk/fsck/fsck.h
Log:
added print_free_bits
prints unset bits in the global bitmap in ranges
Modified: trunk/fsck/fsck.c
===================================================================
--- trunk/fsck/fsck.c 2004-02-05 01:20:01 UTC (rev 3)
+++ trunk/fsck/fsck.c 2004-02-05 01:20:59 UTC (rev 4)
@@ -708,7 +708,47 @@
exit(0);
} /* main */
+/*
+ * print_free_bits()
+ *
+ */
+void print_free_bits(GArray *bits, char *str)
+{
+ __u32 i, j, k;
+ __u32 bit1, bit2;
+ if (!bits)
+ goto bail;
+
+#if 0
+ for (i = 0; i < bits->len; ++i) {
+ bit1 = g_array_index(bits, __u32, i);
+ if (i == 0)
+ printf("\nbits: ");
+ printf("%d, ", bit1);
+ }
+ printf("\n");
+#endif
+
+ for (i = 0; i < bits->len;) {
+ bit1 = g_array_index(bits, __u32, i);
+ for (k = 0, j = i + 1; j < bits->len; ++k, ++j) {
+ bit2 = g_array_index(bits, __u32, j);
+ if (bit1 + k + 1 != bit2)
+ break;
+ }
+ if (k)
+ LOG_ERROR("Bits %u-%u are unset in the %s bitmap",
+ bit1, bit1 + k, str);
+ else
+ LOG_ERROR("Bit %u is unset in the %s bitmap", bit1, str);
+ i += k + 1;
+ }
+
+bail:
+ return ;
+} /* print_free_bits */
+
/*
* check_global_bitmap()
*
@@ -721,6 +761,9 @@
__u8 *vol_bm = NULL;
__u32 i;
__u32 j;
+ GArray *bits = NULL;
+
+ bits = g_array_new(false, true, sizeof(__u32));
/* sorting the global bitmap data on alloc_node and bit_num */
qsort(ctxt.vol_bm_data->data, ctxt.vol_bm_data->len,
@@ -763,11 +806,12 @@
j = __test_and_clear_bit(bm1->bitnum, vol_bm);
if (!j) {
if (!test_bit(bm1->bitnum, ctxt.vol_bm))
- LOG_ERROR("Bit %u is unset in the global bitmap",
- bm1->bitnum);
+ g_array_append_val(bits, bm1->bitnum);
}
}
+ print_free_bits(bits, "global");
+
#ifdef STILL_DEBUGGING
/* cross check... ensure no bit in the global bitmap is set */
/* The first 1MB in the bitmap is for the system fe's */
@@ -781,6 +825,8 @@
ret = 0;
bail:
+ if (bits)
+ g_array_free(bits, true);
free_aligned(vol_bm);
return ret;
} /* check_global_bitmap */
Modified: trunk/fsck/fsck.h
===================================================================
--- trunk/fsck/fsck.h 2004-02-05 01:20:01 UTC (rev 3)
+++ trunk/fsck/fsck.h 2004-02-05 01:20:59 UTC (rev 4)
@@ -165,6 +165,7 @@
void *mem_alloc(int len);
int fsck_initialize(char **buf);
int qsort_compare(const void *q1, const void *q2);
+void print_free_bits(GArray *bits, char *str);
int check_global_bitmap(int fd);
int check_node_bitmaps(int fd, GArray *bm_data, __u8 **node_bm,
__u32 *node_bm_sz, char *str);
More information about the Ocfs-tools-commits
mailing list