[Ocfs-tools-commits] smushran commits r222 - trunk/fsck

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Oct 15 16:55:54 CDT 2004


Author: smushran
Date: 2004-10-15 16:55:52 -0500 (Fri, 15 Oct 2004)
New Revision: 222

Modified:
   trunk/fsck/utils.c
Log:
unset bits in global bitmapped now set and written to disk

Modified: trunk/fsck/utils.c
===================================================================
--- trunk/fsck/utils.c	2004-10-15 18:50:37 UTC (rev 221)
+++ trunk/fsck/utils.c	2004-10-15 21:55:52 UTC (rev 222)
@@ -598,23 +598,43 @@
 	if (!bits->len)
 		goto bail;
 
-	LOG_ERROR("Global bitmap has unset bits");
-	print_bit_ranges(bits, "unset", bitmap);
+	if (ctxt.write_changes) {
+		LOG_PRINT("Global bitmap has unset bits");
+		print_bit_ranges(bits, "unset", bitmap);
+		for (i = 0; i < bits->len; ++i) {
+			bitnum = g_array_index(bits, __u32, i);
+			set_bit (bitnum, ctxt.vol_bm);
+		}
 
-	for (i = 0; i < bits->len; ++i) {
-		bitnum = g_array_index(bits, __u32, i);
+		if (myseek64(ctxt.fd, ctxt.hdr->bitmap_off, SEEK_SET) == -1) {
+			LOG_INTERNAL();
+			goto bail;
+		}
 
-		memset (&kbm, 0, sizeof(bitmap_data));
-		kbm.bitnum = bitnum;
-		kbm.alloc_node = OCFS_INVALID_NODE_NUM;
-		bm = bsearch(&kbm, ctxt.vol_bm_data->data, ctxt.vol_bm_data->len,
-			     sizeof(bitmap_data), &comp_bits);
-		g_array_append_val(files, bm->fnum);
+		if (mywrite(ctxt.fd, ctxt.vol_bm, VOL_BITMAP_BYTES) == -1) {
+			LOG_INTERNAL();
+			goto bail;
+		}
+		LOG_PRINT("Fixed");
+	} else {
+		LOG_ERROR("Global bitmap has unset bits");
+		print_bit_ranges(bits, "unset", bitmap);
+		for (i = 0; i < bits->len; ++i) {
+			bitnum = g_array_index(bits, __u32, i);
+
+			memset (&kbm, 0, sizeof(bitmap_data));
+			kbm.bitnum = bitnum;
+			kbm.alloc_node = OCFS_INVALID_NODE_NUM;
+			bm = bsearch(&kbm, ctxt.vol_bm_data->data, ctxt.vol_bm_data->len,
+			     	sizeof(bitmap_data), &comp_bits);
+			g_array_append_val(files, bm->fnum);
+		}
+
+		LOG_PRINT("List of files affected by the unset bits:");
+		print_filenames(files);
+		LOG_PRINT("To fix, rerun with -w");
 	}
 
-	LOG_PRINT("List of files affected by the unset bits:");
-	print_filenames(files);
-
 bail:
 	if (bits)
 		g_array_free(bits, true);



More information about the Ocfs-tools-commits mailing list