All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH v4 4/8] btrfs: add a helper to print out rescue= options
Date: Fri, 16 Oct 2020 11:29:16 -0400	[thread overview]
Message-ID: <4d3297668dd9ab26681b5632232fb1f6eb00cb73.1602862052.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1602862052.git.josef@toxicpanda.com>

We're going to have a lot of rescue options, add a helper to collapse
the /proc/mounts output to rescue=option1:option2:option3 format.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f99e89ec46b2..f41f7af27ff7 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1392,11 +1392,19 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
 	return btrfs_commit_transaction(trans);
 }
 
+static void print_rescue_option(struct seq_file *seq, const char *s,
+				bool *printed)
+{
+	seq_printf(seq, "%s%s", (*printed) ? ":" : ",rescue=", s);
+	*printed = true;
+}
+
 static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
 {
 	struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb);
 	const char *compress_type;
 	const char *subvol_name;
+	bool printed = false;
 
 	if (btrfs_test_opt(info, DEGRADED))
 		seq_puts(seq, ",degraded");
@@ -1429,7 +1437,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
 	if (btrfs_test_opt(info, NOTREELOG))
 		seq_puts(seq, ",notreelog");
 	if (btrfs_test_opt(info, NOLOGREPLAY))
-		seq_puts(seq, ",rescue=nologreplay");
+		print_rescue_option(seq, "nologreplay", &printed);
 	if (btrfs_test_opt(info, FLUSHONCOMMIT))
 		seq_puts(seq, ",flushoncommit");
 	if (btrfs_test_opt(info, DISCARD_SYNC))
-- 
2.26.2


  parent reply	other threads:[~2020-10-16 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 15:29 [PATCH v4 0/8] New rescue mount options Josef Bacik
2020-10-16 15:29 ` [PATCH v4 1/8] btrfs: unify the ro checking for " Josef Bacik
2020-10-16 15:29 ` [PATCH v4 2/8] btrfs: push the NODATASUM check into btrfs_lookup_bio_sums Josef Bacik
2020-10-16 15:29 ` [PATCH v4 3/8] btrfs: add a supported_rescue_options file to sysfs Josef Bacik
2020-10-16 15:29 ` Josef Bacik [this message]
2020-10-19  8:18   ` [PATCH v4 4/8] btrfs: add a helper to print out rescue= options Johannes Thumshirn
2020-10-16 15:29 ` [PATCH v4 5/8] btrfs: show rescue=usebackuproot in /proc/mounts Josef Bacik
2020-10-19  8:18   ` Johannes Thumshirn
2020-10-20 16:03   ` David Sterba
2020-10-21 14:02     ` Josef Bacik
2020-10-16 15:29 ` [PATCH v4 6/8] btrfs: introduce rescue=ignorebadroots Josef Bacik
2020-10-16 15:29 ` [PATCH v4 7/8] btrfs: introduce rescue=ignoredatacsums Josef Bacik
2020-10-16 15:29 ` [PATCH v4 8/8] btrfs: introduce rescue=all Josef Bacik
2020-10-20 16:33   ` David Sterba

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=4d3297668dd9ab26681b5632232fb1f6eb00cb73.1602862052.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.