mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 04:47:05 +00:00
bcachefs: add a quieter bch2_read_super
If we're looking for a bcachefs supers iteratively we don't want to see this error. This function replaces KERN_ERR with KERN_INFO for when we don't find a bcachefs superblock but preserves other errors. Signed-off-by: Daniel Hill <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
25f64e997e
commit
2b161cc7cb
2 changed files with 25 additions and 3 deletions
|
@ -692,12 +692,13 @@ static int read_one_super(struct bch_sb_handle *sb, u64 offset, struct printbuf
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bch2_read_super(const char *path, struct bch_opts *opts,
|
||||
struct bch_sb_handle *sb)
|
||||
static int __bch2_read_super(const char *path, struct bch_opts *opts,
|
||||
struct bch_sb_handle *sb, bool ignore_notbchfs_msg)
|
||||
{
|
||||
u64 offset = opt_get(*opts, sb);
|
||||
struct bch_sb_layout layout;
|
||||
struct printbuf err = PRINTBUF;
|
||||
struct printbuf err2 = PRINTBUF;
|
||||
__le64 *i;
|
||||
int ret;
|
||||
#ifndef __KERNEL__
|
||||
|
@ -760,8 +761,14 @@ int bch2_read_super(const char *path, struct bch_opts *opts,
|
|||
if (opt_defined(*opts, sb))
|
||||
goto err;
|
||||
|
||||
printk(KERN_ERR "bcachefs (%s): error reading default superblock: %s\n",
|
||||
prt_printf(&err2, "bcachefs (%s): error reading default superblock: %s\n",
|
||||
path, err.buf);
|
||||
if (ret == -BCH_ERR_invalid_sb_magic && ignore_notbchfs_msg)
|
||||
printk(KERN_INFO "%s", err2.buf);
|
||||
else
|
||||
printk(KERN_ERR "%s", err2.buf);
|
||||
|
||||
printbuf_exit(&err2);
|
||||
printbuf_reset(&err);
|
||||
|
||||
/*
|
||||
|
@ -837,6 +844,20 @@ int bch2_read_super(const char *path, struct bch_opts *opts,
|
|||
goto out;
|
||||
}
|
||||
|
||||
int bch2_read_super(const char *path, struct bch_opts *opts,
|
||||
struct bch_sb_handle *sb)
|
||||
{
|
||||
return __bch2_read_super(path, opts, sb, false);
|
||||
}
|
||||
|
||||
/* provide a silenced version for mount.bcachefs */
|
||||
|
||||
int bch2_read_super_silent(const char *path, struct bch_opts *opts,
|
||||
struct bch_sb_handle *sb)
|
||||
{
|
||||
return __bch2_read_super(path, opts, sb, true);
|
||||
}
|
||||
|
||||
/* write superblock: */
|
||||
|
||||
static void write_super_endio(struct bio *bio)
|
||||
|
|
|
@ -84,6 +84,7 @@ void bch2_free_super(struct bch_sb_handle *);
|
|||
int bch2_sb_realloc(struct bch_sb_handle *, unsigned);
|
||||
|
||||
int bch2_read_super(const char *, struct bch_opts *, struct bch_sb_handle *);
|
||||
int bch2_read_super_silent(const char *, struct bch_opts *, struct bch_sb_handle *);
|
||||
int bch2_write_super(struct bch_fs *);
|
||||
void __bch2_check_set_feature(struct bch_fs *, unsigned);
|
||||
|
||||
|
|
Loading…
Reference in a new issue