From: Eric Sandeen <sandeen@redhat.com>
To: jack@suse.com
Cc: linux-ext4@vger.kernel.org, Eric Sandeen <sandeen@redhat.com>
Subject: [PATCH 2/2] ext2: create ext2_msg_fc for use during parsing
Date: Sun, 23 Feb 2025 13:57:41 -0600 [thread overview]
Message-ID: <20250223201014.7541-3-sandeen@redhat.com> (raw)
In-Reply-To: <20250223201014.7541-1-sandeen@redhat.com>
Rather than send a NULL sb to ext2_msg, which omits the s_id from
messages, create a new ext2_msg_fc which is able to provide this
information from the filesystem context *fc when parsing.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/ext2/super.c | 48 +++++++++++++++++++++++++++++++++++-------------
1 file changed, 35 insertions(+), 13 deletions(-)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index cb6253656eb2..2a4c007972b9 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -81,6 +81,31 @@ void ext2_error(struct super_block *sb, const char *function,
}
}
+static void ext2_msg_fc(struct fs_context *fc, const char *prefix,
+ const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ const char *s_id;
+
+ if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
+ s_id = fc->root->d_sb->s_id;
+ } else {
+ /* get last path component of source */
+ s_id = strrchr(fc->source, '/');
+ if (s_id)
+ s_id++;
+ }
+ va_start(args, fmt);
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ printk("%sEXT2-fs (%s): %pV\n", prefix, s_id, &vaf);
+
+ va_end(args);
+}
+
void ext2_msg(struct super_block *sb, const char *prefix,
const char *fmt, ...)
{
@@ -92,10 +117,7 @@ void ext2_msg(struct super_block *sb, const char *prefix,
vaf.fmt = fmt;
vaf.va = &args;
- if (sb)
- printk("%sEXT2-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
- else
- printk("%sEXT2-fs: %pV\n", prefix, &vaf);
+ printk("%sEXT2-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
va_end(args);
}
@@ -544,7 +566,7 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
ctx_clear_mount_opt(ctx, EXT2_MOUNT_OLDALLOC);
break;
case Opt_nobh:
- ext2_msg(NULL, KERN_INFO, "nobh option not supported\n");
+ ext2_msg_fc(fc, KERN_INFO, "nobh option not supported\n");
break;
#ifdef CONFIG_EXT2_FS_XATTR
case Opt_user_xattr:
@@ -555,7 +577,7 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
break;
#else
case Opt_user_xattr:
- ext2_msg(NULL, KERN_INFO, "(no)user_xattr options not supported");
+ ext2_msg_fc(fc, KERN_INFO, "(no)user_xattr options not supported");
break;
#endif
#ifdef CONFIG_EXT2_FS_POSIX_ACL
@@ -567,20 +589,20 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
break;
#else
case Opt_acl:
- ext2_msg(NULL, KERN_INFO, "(no)acl options not supported");
+ ext2_msg_fc(fc, KERN_INFO, "(no)acl options not supported");
break;
#endif
case Opt_xip:
- ext2_msg(NULL, KERN_INFO, "use dax instead of xip");
+ ext2_msg_fc(fc, KERN_INFO, "use dax instead of xip");
ctx_set_mount_opt(ctx, EXT2_MOUNT_XIP);
fallthrough;
case Opt_dax:
#ifdef CONFIG_FS_DAX
- ext2_msg(NULL, KERN_WARNING,
+ ext2_msg_fc(fc, KERN_WARNING,
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
ctx_set_mount_opt(ctx, EXT2_MOUNT_DAX);
#else
- ext2_msg(NULL, KERN_INFO, "dax option not supported");
+ ext2_msg_fc(fc, KERN_INFO, "dax option not supported");
#endif
break;
@@ -597,16 +619,16 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
case Opt_quota:
case Opt_usrquota:
case Opt_grpquota:
- ext2_msg(NULL, KERN_INFO, "quota operations not supported");
+ ext2_msg_fc(fc, KERN_INFO, "quota operations not supported");
break;
#endif
case Opt_reservation:
if (!result.negated) {
ctx_set_mount_opt(ctx, EXT2_MOUNT_RESERVATION);
- ext2_msg(NULL, KERN_INFO, "reservations ON");
+ ext2_msg_fc(fc, KERN_INFO, "reservations ON");
} else {
ctx_clear_mount_opt(ctx, EXT2_MOUNT_RESERVATION);
- ext2_msg(NULL, KERN_INFO, "reservations OFF");
+ ext2_msg_fc(fc, KERN_INFO, "reservations OFF");
}
break;
case Opt_ignore:
--
2.48.0
next prev parent reply other threads:[~2025-02-23 20:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-23 19:57 [PATCH 0/2] ext2: convert to the new mount API Eric Sandeen
2025-02-23 19:57 ` [PATCH 1/2] " Eric Sandeen
2025-02-24 16:02 ` Jan Kara
2025-02-26 16:42 ` Eric Sandeen
2025-02-26 17:03 ` Jan Kara
2025-02-23 19:57 ` Eric Sandeen [this message]
2025-02-24 16:01 ` [PATCH 2/2] ext2: create ext2_msg_fc for use during parsing Jan Kara
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=20250223201014.7541-3-sandeen@redhat.com \
--to=sandeen@redhat.com \
--cc=jack@suse.com \
--cc=linux-ext4@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