linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_repair: warn properly about reflink flag with and without -n
Date: Wed, 12 Sep 2018 14:26:48 -0500	[thread overview]
Message-ID: <700e2326-fd4c-224e-bf9c-cb77756e4a55@redhat.com> (raw)

The decision to emit a warning in fix_inode_reflink_flag seems broken; in
no-modify mode we'll do_warn that we're setting it (even though we don't),
and we'll be silent if it needs to be cleared.

Fix this so it's the standard "would" in no-modify, and "will" in regular
mode.  This also ensures that we return the proper status if flags are
found to be incorrect in -n or -e mode.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/repair/rmap.c b/repair/rmap.c
index bffb5b61..7ef2d0fd 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -1142,16 +1142,27 @@ fix_inode_reflink_flag(
 	struct xfs_dinode	*dino;
 	struct xfs_buf		*buf;
 
+	if (no_modify) {
+		if (set)
+			do_warn(
+_("would set reflink flag on inode %"PRIu64"\n"),
+				XFS_AGINO_TO_INO(mp, agno, agino));
+		else
+			do_warn(
+_("would clear reflink flag on inode %"PRIu64"\n"),
+				XFS_AGINO_TO_INO(mp, agno, agino));
+		return 0;
+	}
+
+	/* Modify mode */
 	if (set)
 		do_warn(
 _("setting reflink flag on inode %"PRIu64"\n"),
 			XFS_AGINO_TO_INO(mp, agno, agino));
-	else if (!no_modify) /* && !set */
+	else
 		do_warn(
 _("clearing reflink flag on inode %"PRIu64"\n"),
 			XFS_AGINO_TO_INO(mp, agno, agino));
-	if (no_modify)
-		return 0;
 
 	buf = get_agino_buf(mp, agno, agino, &dino);
 	if (!buf)

             reply	other threads:[~2018-09-13  0:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 19:26 Eric Sandeen [this message]
2018-09-12 22:05 ` [PATCH] xfs_repair: warn properly about reflink flag with and without -n Eric Sandeen
2018-09-17 16:24   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=700e2326-fd4c-224e-bf9c-cb77756e4a55@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).