public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [REVIEW] User-space support for bad_features2 patch
@ 2008-02-22  7:52 Barry Naujok
  2008-02-22 17:41 ` Eric Sandeen
  2008-02-23  5:00 ` David Chinner
  0 siblings, 2 replies; 6+ messages in thread
From: Barry Naujok @ 2008-02-22  7:52 UTC (permalink / raw)
  To: xfs@oss.sgi.com

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

The attached patch fixes mkfs.xfs writing the bad features2 in the first  
place (the change to xfs_sb.h does this).

Next xfs_db support printing of this superblock field and xfs_check can  
report the bad_features2 field is set.

xfs_repair can correct the error in the same fashion that David Chinner's  
mount code does it.

This patch applies to the lazy-count xfs_repair conversion code that I  
posted a short time before this patch.

Barry.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bad_features2.patch --]
[-- Type: text/x-patch; name=bad_features2.patch, Size: 3335 bytes --]

Index: ci/xfsprogs/db/check.c
===================================================================
--- ci.orig/xfsprogs/db/check.c	2008-02-22 14:15:42.000000000 +1100
+++ ci/xfsprogs/db/check.c	2008-02-22 18:43:56.698852255 +1100
@@ -869,6 +869,12 @@
 				mp->m_sb.sb_frextents, frextents);
 		error++;
 	}
+	if (mp->m_sb.sb_bad_features2 != 0) {
+		if (!sflag)
+			dbprintf("sb_bad_features2 is non-zero (%x)\n",
+				mp->m_sb.sb_bad_features2);
+		error++;
+	}
 	if ((sbversion & XFS_SB_VERSION_ATTRBIT) &&
 	    !XFS_SB_VERSION_HASATTR(&mp->m_sb)) {
 		if (!sflag)
Index: ci/xfsprogs/db/sb.c
===================================================================
--- ci.orig/xfsprogs/db/sb.c	2008-02-22 14:15:42.000000000 +1100
+++ ci/xfsprogs/db/sb.c	2008-02-22 18:30:10.742626136 +1100
@@ -108,6 +108,7 @@
 	{ "logsectsize", FLDT_UINT16D, OI(OFF(logsectsize)), C1, 0, TYP_NONE },
 	{ "logsunit", FLDT_UINT32D, OI(OFF(logsunit)), C1, 0, TYP_NONE },
 	{ "features2", FLDT_UINT32X, OI(OFF(features2)), C1, 0, TYP_NONE },
+	{ "bad_features2", FLDT_UINT32X, OI(OFF(bad_features2)), C1, 0, TYP_NONE },
 	{ NULL }
 };
 
Index: ci/xfsprogs/include/xfs_sb.h
===================================================================
--- ci.orig/xfsprogs/include/xfs_sb.h	2008-02-22 14:15:42.000000000 +1100
+++ ci/xfsprogs/include/xfs_sb.h	2008-02-22 18:11:58.816553959 +1100
@@ -151,6 +151,7 @@
 	__uint16_t	sb_logsectsize;	/* sector size for the log, bytes */
 	__uint32_t	sb_logsunit;	/* stripe unit size for the log */
 	__uint32_t	sb_features2;	/* additional feature bits */
+	__uint32_t	sb_bad_features2; /* unusable space */
 } xfs_sb_t;
 
 /*
@@ -169,7 +170,7 @@
 	XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
 	XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
 	XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
-	XFS_SBS_FEATURES2,
+	XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2,
 	XFS_SBS_FIELDCOUNT
 } xfs_sb_field_t;
 
Index: ci/xfsprogs/libxfs/xfs_mount.c
===================================================================
--- ci.orig/xfsprogs/libxfs/xfs_mount.c	2008-02-22 14:15:42.000000000 +1100
+++ ci/xfsprogs/libxfs/xfs_mount.c	2008-02-22 18:22:00.330489434 +1100
@@ -140,6 +140,7 @@
     { offsetof(xfs_sb_t, sb_logsectsize),0 },
     { offsetof(xfs_sb_t, sb_logsunit),	 0 },
     { offsetof(xfs_sb_t, sb_features2),	 0 },
+    { offsetof(xfs_sb_t, sb_bad_features2), 0 },
     { sizeof(xfs_sb_t),			 0 }
 };
 
Index: ci/xfsprogs/repair/phase1.c
===================================================================
--- ci.orig/xfsprogs/repair/phase1.c	2008-02-22 17:31:01.000000000 +1100
+++ ci/xfsprogs/repair/phase1.c	2008-02-22 18:44:23.347411378 +1100
@@ -92,6 +92,19 @@
 	}
 
 	/*
+	 * Check bad_features2, if set and features2 is zero, copy
+	 * bad_features2 to features2 and zero bad_features2.
+	 */
+	if (sb->sb_bad_features2 != 0) {
+		if (sb->sb_features2 == 0)
+			sb->sb_features2 = sb->sb_bad_features2;
+		sb->sb_bad_features2 = 0;
+		primary_sb_modified = 1;
+		do_warn(_("superblock's features2 field is in the wrong "
+			"location, correcting\n"));
+	}
+
+	/*
 	 * apply any version changes or conversions after the primary
 	 * superblock has been verified or repaired
 	 */

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-25  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-22  7:52 [REVIEW] User-space support for bad_features2 patch Barry Naujok
2008-02-22 17:41 ` Eric Sandeen
2008-02-25  0:39   ` Barry Naujok
2008-02-25  8:42     ` Eric Sandeen
2008-02-25  9:55       ` Jan Derfinak
2008-02-23  5:00 ` David Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox