9
0
Fork 0

fs: ubifs: rework logging

By default UBIFS is very verbose. Decrease the verbosity, turn
printf messages into ubifs_ messages and add device parameters
for the values which are not printed anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-02-28 10:49:13 +01:00
parent f957d0a09c
commit 6dac289d0c
3 changed files with 27 additions and 16 deletions

View File

@ -257,12 +257,12 @@ static int init_constants_early(struct ubifs_info *c)
} }
if (c->di.ro_mode) { if (c->di.ro_mode) {
ubifs_msg("read-only UBI device"); dbg_msg("read-only UBI device");
c->ro_media = 1; c->ro_media = 1;
} }
if (c->vi.vol_type == UBI_STATIC_VOLUME) { if (c->vi.vol_type == UBI_STATIC_VOLUME) {
ubifs_msg("static UBI volume - read-only mode"); dbg_msg("static UBI volume - read-only mode");
c->ro_media = 1; c->ro_media = 1;
} }
@ -540,6 +540,7 @@ static int mount_ubifs(struct ubifs_info *c)
int err, mounted_read_only = ubifs_readonly(c); int err, mounted_read_only = ubifs_readonly(c);
long long x; long long x;
size_t sz; size_t sz;
char str[128];
err = init_constants_early(c); err = init_constants_early(c);
if (err) if (err)
@ -676,18 +677,19 @@ static int mount_ubifs(struct ubifs_info *c)
ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"", ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"",
c->vi.ubi_num, c->vi.vol_id, c->vi.name); c->vi.ubi_num, c->vi.vol_id, c->vi.name);
if (mounted_read_only) if (mounted_read_only)
ubifs_msg("mounted read-only"); dbg_msg("mounted read-only");
x = (long long)c->main_lebs * c->leb_size; x = (long long)c->main_lebs * c->leb_size;
ubifs_msg("file system size: %lld bytes (%lld KiB, %lld MiB, %d " c->fs_size_mb = x >> 20;
dbg_msg("file system size: %lld bytes (%lld KiB, %lld MiB, %d "
"LEBs)", x, x >> 10, x >> 20, c->main_lebs); "LEBs)", x, x >> 10, x >> 20, c->main_lebs);
x = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; x = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes;
ubifs_msg("journal size: %lld bytes (%lld KiB, %lld MiB, %d " dbg_msg("journal size: %lld bytes (%lld KiB, %lld MiB, %d "
"LEBs)", x, x >> 10, x >> 20, c->log_lebs + c->max_bud_cnt); "LEBs)", x, x >> 10, x >> 20, c->log_lebs + c->max_bud_cnt);
ubifs_msg("media format: w%d/r%d (latest is w%d/r%d)", dbg_msg("media format: w%d/r%d (latest is w%d/r%d)",
c->fmt_version, c->ro_compat_version, c->fmt_version, c->ro_compat_version,
UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION);
ubifs_msg("default compressor: %s", ubifs_compr_name(c->default_compr)); dbg_msg("default compressor: %s", ubifs_compr_name(c->default_compr));
ubifs_msg("reserved for root: %llu bytes (%llu KiB)", dbg_msg("reserved for root: %llu bytes (%llu KiB)",
c->report_rp_size, c->report_rp_size >> 10); c->report_rp_size, c->report_rp_size >> 10);
dbg_msg("compiled on: " __DATE__ " at " __TIME__); dbg_msg("compiled on: " __DATE__ " at " __TIME__);
@ -696,6 +698,14 @@ static int mount_ubifs(struct ubifs_info *c)
c->leb_size, c->leb_size >> 10); c->leb_size, c->leb_size >> 10);
dbg_msg("data journal heads: %d", dbg_msg("data journal heads: %d",
c->jhead_cnt - NONDATA_JHEADS_CNT); c->jhead_cnt - NONDATA_JHEADS_CNT);
dev_add_param_int_ro(c->dev, "filesystem_size_mb", c->fs_size_mb, "%d");
dev_add_param_fixed(c->dev, "default_compressor", ubifs_compr_name(c->default_compr));
sprintf(str, "w%d/r%d", c->fmt_version, c->ro_compat_version);
dev_add_param_fixed(c->dev, "media_format", str);
sprintf(str, "w%d/r%d", UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION);
dev_add_param_fixed(c->dev, "media_format_latest", str);
dbg_msg("UUID: %02X%02X%02X%02X-%02X%02X" dbg_msg("UUID: %02X%02X%02X%02X-%02X%02X"
"-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", "-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
c->uuid[0], c->uuid[1], c->uuid[2], c->uuid[3], c->uuid[0], c->uuid[1], c->uuid[2], c->uuid[3],
@ -804,7 +814,7 @@ void ubifs_umount(struct ubifs_info *c)
ubifs_debugging_exit(c); ubifs_debugging_exit(c);
} }
struct super_block *ubifs_get_super(struct ubi_volume_desc *ubi, int silent) struct super_block *ubifs_get_super(struct device_d *dev, struct ubi_volume_desc *ubi, int silent)
{ {
struct super_block *sb; struct super_block *sb;
struct ubifs_info *c; struct ubifs_info *c;
@ -814,6 +824,8 @@ struct super_block *ubifs_get_super(struct ubi_volume_desc *ubi, int silent)
sb = xzalloc(sizeof(*sb)); sb = xzalloc(sizeof(*sb));
c = xzalloc(sizeof(struct ubifs_info)); c = xzalloc(sizeof(struct ubifs_info));
c->dev = dev;
spin_lock_init(&c->cnt_lock); spin_lock_init(&c->cnt_lock);
spin_lock_init(&c->cs_lock); spin_lock_init(&c->cs_lock);
spin_lock_init(&c->buds_lock); spin_lock_init(&c->buds_lock);

View File

@ -610,7 +610,7 @@ static int ubifs_probe(struct device_d *dev)
goto err_free; goto err_free;
} }
priv->sb = ubifs_get_super(priv->ubi, 0); priv->sb = ubifs_get_super(dev, priv->ubi, 0);
if (IS_ERR(priv->sb)) { if (IS_ERR(priv->sb)) {
ret = PTR_ERR(priv->sb); ret = PTR_ERR(priv->sb);
goto err; goto err;

View File

@ -470,12 +470,8 @@ static inline ino_t parent_ino(struct dentry *dentry)
#define UBIFS_VERSION 1 #define UBIFS_VERSION 1
/* Normal UBIFS messages */ /* Normal UBIFS messages */
#ifdef CONFIG_UBIFS_SILENCE_MSG
#define ubifs_msg(fmt, ...)
#else
#define ubifs_msg(fmt, ...) \ #define ubifs_msg(fmt, ...) \
pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__) pr_info("UBIFS: " fmt "\n", ##__VA_ARGS__)
#endif
/* UBIFS error messages */ /* UBIFS error messages */
#define ubifs_err(fmt, ...) \ #define ubifs_err(fmt, ...) \
pr_err("UBIFS error (pid %d): %s: " fmt "\n", 0, \ pr_err("UBIFS error (pid %d): %s: " fmt "\n", 0, \
@ -1824,6 +1820,9 @@ struct ubifs_info {
int always_chk_crc; int always_chk_crc;
struct ubifs_mount_opts mount_opts; struct ubifs_mount_opts mount_opts;
unsigned int fs_size_mb;
struct device_d *dev;
#ifdef CONFIG_UBIFS_FS_DEBUG #ifdef CONFIG_UBIFS_FS_DEBUG
struct ubifs_debug_info *dbg; struct ubifs_debug_info *dbg;
#endif #endif
@ -2140,7 +2139,7 @@ long ubifs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
#include "misc.h" #include "misc.h"
#include "key.h" #include "key.h"
struct super_block *ubifs_get_super(struct ubi_volume_desc *ubi, int silent); struct super_block *ubifs_get_super(struct device_d *dev, struct ubi_volume_desc *ubi, int silent);
void ubifs_umount(struct ubifs_info *); void ubifs_umount(struct ubifs_info *);
static inline int ubifs_readonly(struct ubifs_info *c) static inline int ubifs_readonly(struct ubifs_info *c)