Loading fs/bcachefs/fs.c +5 −21 Original line number Diff line number Diff line Loading @@ -1930,30 +1930,14 @@ static int bch2_show_devname(struct seq_file *seq, struct dentry *root) static int bch2_show_options(struct seq_file *seq, struct dentry *root) { struct bch_fs *c = root->d_sb->s_fs_info; enum bch_opt_id i; struct printbuf buf = PRINTBUF; int ret = 0; for (i = 0; i < bch2_opts_nr; i++) { const struct bch_option *opt = &bch2_opt_table[i]; u64 v = bch2_opt_get_by_id(&c->opts, i); if ((opt->flags & OPT_HIDDEN) || !(opt->flags & OPT_MOUNT)) continue; if (v == bch2_opt_get_by_id(&bch2_opts_default, i)) continue; printbuf_reset(&buf); bch2_opt_to_text(&buf, c, c->disk_sb.sb, opt, v, OPT_SHOW_MOUNT_STYLE); seq_putc(seq, ','); bch2_opts_to_text(&buf, c->opts, c, c->disk_sb.sb, OPT_MOUNT, OPT_HIDDEN, OPT_SHOW_MOUNT_STYLE); printbuf_nul_terminate(&buf); seq_puts(seq, buf.buf); } if (buf.allocation_failure) ret = -ENOMEM; int ret = buf.allocation_failure ? -ENOMEM : 0; printbuf_exit(&buf); return ret; } Loading fs/bcachefs/opts.c +26 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,32 @@ void bch2_opt_to_text(struct printbuf *out, } } void bch2_opts_to_text(struct printbuf *out, struct bch_opts opts, struct bch_fs *c, struct bch_sb *sb, unsigned show_mask, unsigned hide_mask, unsigned flags) { bool first = true; for (enum bch_opt_id i = 0; i < bch2_opts_nr; i++) { const struct bch_option *opt = &bch2_opt_table[i]; if ((opt->flags & hide_mask) || !(opt->flags & show_mask)) continue; u64 v = bch2_opt_get_by_id(&opts, i); if (v == bch2_opt_get_by_id(&bch2_opts_default, i)) continue; if (!first) prt_char(out, ','); first = false; bch2_opt_to_text(out, c, sb, opt, v, flags); } } int bch2_opt_check_may_set(struct bch_fs *c, int id, u64 v) { int ret = 0; Loading fs/bcachefs/opts.h +4 −0 Original line number Diff line number Diff line Loading @@ -605,6 +605,10 @@ int bch2_opt_parse(struct bch_fs *, const struct bch_option *, void bch2_opt_to_text(struct printbuf *, struct bch_fs *, struct bch_sb *, const struct bch_option *, u64, unsigned); void bch2_opts_to_text(struct printbuf *, struct bch_opts, struct bch_fs *, struct bch_sb *, unsigned, unsigned, unsigned); int bch2_opt_check_may_set(struct bch_fs *, int, u64); int bch2_opts_check_may_set(struct bch_fs *); Loading Loading
fs/bcachefs/fs.c +5 −21 Original line number Diff line number Diff line Loading @@ -1930,30 +1930,14 @@ static int bch2_show_devname(struct seq_file *seq, struct dentry *root) static int bch2_show_options(struct seq_file *seq, struct dentry *root) { struct bch_fs *c = root->d_sb->s_fs_info; enum bch_opt_id i; struct printbuf buf = PRINTBUF; int ret = 0; for (i = 0; i < bch2_opts_nr; i++) { const struct bch_option *opt = &bch2_opt_table[i]; u64 v = bch2_opt_get_by_id(&c->opts, i); if ((opt->flags & OPT_HIDDEN) || !(opt->flags & OPT_MOUNT)) continue; if (v == bch2_opt_get_by_id(&bch2_opts_default, i)) continue; printbuf_reset(&buf); bch2_opt_to_text(&buf, c, c->disk_sb.sb, opt, v, OPT_SHOW_MOUNT_STYLE); seq_putc(seq, ','); bch2_opts_to_text(&buf, c->opts, c, c->disk_sb.sb, OPT_MOUNT, OPT_HIDDEN, OPT_SHOW_MOUNT_STYLE); printbuf_nul_terminate(&buf); seq_puts(seq, buf.buf); } if (buf.allocation_failure) ret = -ENOMEM; int ret = buf.allocation_failure ? -ENOMEM : 0; printbuf_exit(&buf); return ret; } Loading
fs/bcachefs/opts.c +26 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,32 @@ void bch2_opt_to_text(struct printbuf *out, } } void bch2_opts_to_text(struct printbuf *out, struct bch_opts opts, struct bch_fs *c, struct bch_sb *sb, unsigned show_mask, unsigned hide_mask, unsigned flags) { bool first = true; for (enum bch_opt_id i = 0; i < bch2_opts_nr; i++) { const struct bch_option *opt = &bch2_opt_table[i]; if ((opt->flags & hide_mask) || !(opt->flags & show_mask)) continue; u64 v = bch2_opt_get_by_id(&opts, i); if (v == bch2_opt_get_by_id(&bch2_opts_default, i)) continue; if (!first) prt_char(out, ','); first = false; bch2_opt_to_text(out, c, sb, opt, v, flags); } } int bch2_opt_check_may_set(struct bch_fs *c, int id, u64 v) { int ret = 0; Loading
fs/bcachefs/opts.h +4 −0 Original line number Diff line number Diff line Loading @@ -605,6 +605,10 @@ int bch2_opt_parse(struct bch_fs *, const struct bch_option *, void bch2_opt_to_text(struct printbuf *, struct bch_fs *, struct bch_sb *, const struct bch_option *, u64, unsigned); void bch2_opts_to_text(struct printbuf *, struct bch_opts, struct bch_fs *, struct bch_sb *, unsigned, unsigned, unsigned); int bch2_opt_check_may_set(struct bch_fs *, int, u64); int bch2_opts_check_may_set(struct bch_fs *); Loading