Thread (49 messages) 49 messages, 4 authors, 2021-02-11

Re: [PATCH 08/10] xfs_repair: allow setting the needsrepair flag

From: Eric Sandeen <hidden>
Date: 2021-02-10 20:27:59

On 2/9/21 12:10 PM, Darrick J. Wong wrote:
On Tue, Feb 09, 2021 at 12:21:21PM -0500, Brian Foster wrote:
quoted
On Mon, Feb 08, 2021 at 08:10:49PM -0800, Darrick J. Wong wrote:
quoted
From: Darrick J. Wong <djwong@kernel.org>

Quietly set up the ability to tell xfs_repair to set NEEDSREPAIR at
program start and (presumably) clear it by the end of the run.  This
code isn't terribly useful to users; it's mainly here so that fstests
can exercise the functionality.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 repair/globals.c    |    2 ++
 repair/globals.h    |    2 ++
 repair/phase1.c     |   23 +++++++++++++++++++++++
 repair/xfs_repair.c |    9 +++++++++
 4 files changed, 36 insertions(+)
...
quoted
diff --git a/repair/phase1.c b/repair/phase1.c
index 00b98584..b26d25f8 100644
--- a/repair/phase1.c
+++ b/repair/phase1.c
@@ -30,6 +30,26 @@ alloc_ag_buf(int size)
 	return(bp);
 }
 
+static void
+set_needsrepair(
+	struct xfs_sb	*sb)
+{
+	if (!xfs_sb_version_hascrc(sb)) {
+		printf(
+	_("needsrepair flag only supported on V5 filesystems.\n"));
+		exit(0);
+	}
+
+	if (xfs_sb_version_needsrepair(sb)) {
+		printf(_("Filesystem already marked as needing repair.\n"));
+		return;
+	}
Any reason this doesn't exit the repair like the lazy counter logic
does? Otherwise seems fine:
No particular reason.  Will fix for consistency's sake.
I can swap the return; for an exit(0); on my end if you like and note it
in the commit log.

-Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help