Commit 719bb840 authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: print less

UBI currently prints a lot of information when it mounts a volume, which
bothers some people. Make it less chatty - print only important information
by default.

Get rid of 'dbg_msg()' macro completely.
Reported-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent e28453bb
...@@ -794,8 +794,8 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr, ...@@ -794,8 +794,8 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
pnum); pnum);
ubi_err("this may be a non-UBI PEB or a severe VID header corruption which requires manual inspection"); ubi_err("this may be a non-UBI PEB or a severe VID header corruption which requires manual inspection");
ubi_dump_vid_hdr(vid_hdr); ubi_dump_vid_hdr(vid_hdr);
dbg_msg("hexdump of PEB %d offset %d, length %d", pr_err("hexdump of PEB %d offset %d, length %d",
pnum, ubi->leb_start, ubi->leb_size); pnum, ubi->leb_start, ubi->leb_size);
ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1,
ubi->peb_buf, ubi->leb_size, 1); ubi->peb_buf, ubi->leb_size, 1);
err = 1; err = 1;
...@@ -1170,7 +1170,7 @@ static struct ubi_attach_info *scan_all(struct ubi_device *ubi) ...@@ -1170,7 +1170,7 @@ static struct ubi_attach_info *scan_all(struct ubi_device *ubi)
goto out_vidh; goto out_vidh;
} }
dbg_msg("scanning is finished"); ubi_msg("scanning is finished");
/* Calculate mean erase counter */ /* Calculate mean erase counter */
if (ai->ec_count) if (ai->ec_count)
...@@ -1242,7 +1242,7 @@ int ubi_attach(struct ubi_device *ubi) ...@@ -1242,7 +1242,7 @@ int ubi_attach(struct ubi_device *ubi)
ubi->corr_peb_count = ai->corr_peb_count; ubi->corr_peb_count = ai->corr_peb_count;
ubi->max_ec = ai->max_ec; ubi->max_ec = ai->max_ec;
ubi->mean_ec = ai->mean_ec; ubi->mean_ec = ai->mean_ec;
ubi_msg("max. sequence number: %llu", ai->max_sqnum); dbg_gen("max. sequence number: %llu", ai->max_sqnum);
err = ubi_read_volume_table(ubi, ai); err = ubi_read_volume_table(ubi, ai);
if (err) if (err)
......
...@@ -619,6 +619,9 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024) ...@@ -619,6 +619,9 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
*/ */
static int io_init(struct ubi_device *ubi, int max_beb_per1024) static int io_init(struct ubi_device *ubi, int max_beb_per1024)
{ {
dbg_gen("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb));
dbg_gen("sizeof(struct ubi_wl_entry) %zu", sizeof(struct ubi_wl_entry));
if (ubi->mtd->numeraseregions != 0) { if (ubi->mtd->numeraseregions != 0) {
/* /*
* Some flashes have several erase regions. Different regions * Some flashes have several erase regions. Different regions
...@@ -690,11 +693,11 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) ...@@ -690,11 +693,11 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024)
ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size); ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size);
ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size); ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size);
dbg_msg("min_io_size %d", ubi->min_io_size); dbg_gen("min_io_size %d", ubi->min_io_size);
dbg_msg("max_write_size %d", ubi->max_write_size); dbg_gen("max_write_size %d", ubi->max_write_size);
dbg_msg("hdrs_min_io_size %d", ubi->hdrs_min_io_size); dbg_gen("hdrs_min_io_size %d", ubi->hdrs_min_io_size);
dbg_msg("ec_hdr_alsize %d", ubi->ec_hdr_alsize); dbg_gen("ec_hdr_alsize %d", ubi->ec_hdr_alsize);
dbg_msg("vid_hdr_alsize %d", ubi->vid_hdr_alsize); dbg_gen("vid_hdr_alsize %d", ubi->vid_hdr_alsize);
if (ubi->vid_hdr_offset == 0) if (ubi->vid_hdr_offset == 0)
/* Default offset */ /* Default offset */
...@@ -711,10 +714,10 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) ...@@ -711,10 +714,10 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024)
ubi->leb_start = ubi->vid_hdr_offset + UBI_VID_HDR_SIZE; ubi->leb_start = ubi->vid_hdr_offset + UBI_VID_HDR_SIZE;
ubi->leb_start = ALIGN(ubi->leb_start, ubi->min_io_size); ubi->leb_start = ALIGN(ubi->leb_start, ubi->min_io_size);
dbg_msg("vid_hdr_offset %d", ubi->vid_hdr_offset); dbg_gen("vid_hdr_offset %d", ubi->vid_hdr_offset);
dbg_msg("vid_hdr_aloffset %d", ubi->vid_hdr_aloffset); dbg_gen("vid_hdr_aloffset %d", ubi->vid_hdr_aloffset);
dbg_msg("vid_hdr_shift %d", ubi->vid_hdr_shift); dbg_gen("vid_hdr_shift %d", ubi->vid_hdr_shift);
dbg_msg("leb_start %d", ubi->leb_start); dbg_gen("leb_start %d", ubi->leb_start);
/* The shift must be aligned to 32-bit boundary */ /* The shift must be aligned to 32-bit boundary */
if (ubi->vid_hdr_shift % 4) { if (ubi->vid_hdr_shift % 4) {
...@@ -740,7 +743,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) ...@@ -740,7 +743,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024)
ubi->max_erroneous = ubi->peb_count / 10; ubi->max_erroneous = ubi->peb_count / 10;
if (ubi->max_erroneous < 16) if (ubi->max_erroneous < 16)
ubi->max_erroneous = 16; ubi->max_erroneous = 16;
dbg_msg("max_erroneous %d", ubi->max_erroneous); dbg_gen("max_erroneous %d", ubi->max_erroneous);
/* /*
* It may happen that EC and VID headers are situated in one minimal * It may happen that EC and VID headers are situated in one minimal
...@@ -760,17 +763,6 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) ...@@ -760,17 +763,6 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024)
ubi->ro_mode = 1; ubi->ro_mode = 1;
} }
ubi_msg("physical eraseblock size: %d bytes (%d KiB)",
ubi->peb_size, ubi->peb_size >> 10);
ubi_msg("logical eraseblock size: %d bytes", ubi->leb_size);
ubi_msg("smallest flash I/O unit: %d", ubi->min_io_size);
if (ubi->hdrs_min_io_size != ubi->min_io_size)
ubi_msg("sub-page size: %d",
ubi->hdrs_min_io_size);
ubi_msg("VID header offset: %d (aligned %d)",
ubi->vid_hdr_offset, ubi->vid_hdr_aloffset);
ubi_msg("data offset: %d", ubi->leb_start);
/* /*
* Note, ideally, we have to initialize @ubi->bad_peb_count here. But * Note, ideally, we have to initialize @ubi->bad_peb_count here. But
* unfortunately, MTD does not provide this information. We should loop * unfortunately, MTD does not provide this information. We should loop
...@@ -932,8 +924,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, ...@@ -932,8 +924,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
spin_lock_init(&ubi->volumes_lock); spin_lock_init(&ubi->volumes_lock);
ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num); ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num);
dbg_msg("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb));
dbg_msg("sizeof(struct ubi_wl_entry) %zu", sizeof(struct ubi_wl_entry));
err = io_init(ubi, max_beb_per1024); err = io_init(ubi, max_beb_per1024);
if (err) if (err)
...@@ -976,23 +966,24 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, ...@@ -976,23 +966,24 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
goto out_debugfs; goto out_debugfs;
} }
ubi_msg("attached mtd%d to ubi%d", mtd->index, ubi_num); ubi_msg("attached mtd%d (name \"%s\", size %llu MiB) to ubi%d",
ubi_msg("MTD device name: \"%s\"", mtd->name); mtd->index, mtd->name, ubi->flash_size >> 20, ubi_num);
ubi_msg("MTD device size: %llu MiB", ubi->flash_size >> 20); ubi_msg("PEB size: %d bytes (%d KiB), LEB size: %d bytes",
ubi_msg("number of good PEBs: %d", ubi->good_peb_count); ubi->peb_size, ubi->peb_size >> 10, ubi->leb_size);
ubi_msg("number of bad PEBs: %d", ubi->bad_peb_count); ubi_msg("min./max. I/O unit sizes: %d/%d, sub-page size %d",
ubi_msg("number of corrupted PEBs: %d", ubi->corr_peb_count); ubi->min_io_size, ubi->max_write_size, ubi->hdrs_min_io_size);
ubi_msg("max. allowed volumes: %d", ubi->vtbl_slots); ubi_msg("VID header offset: %d (aligned %d), data offset: %d",
ubi_msg("wear-leveling threshold: %d", CONFIG_MTD_UBI_WL_THRESHOLD); ubi->vid_hdr_offset, ubi->vid_hdr_aloffset, ubi->leb_start);
ubi_msg("number of internal volumes: %d", UBI_INT_VOL_COUNT); ubi_msg("good PEBs: %d, bad PEBs: %d, corrupted PEBs: %d",
ubi_msg("number of user volumes: %d", ubi->good_peb_count, ubi->bad_peb_count, ubi->corr_peb_count);
ubi->vol_count - UBI_INT_VOL_COUNT); ubi_msg("user volume: %d, internal volumes: %d, max. volumes count: %d",
ubi_msg("available PEBs: %d", ubi->avail_pebs); ubi->vol_count - UBI_INT_VOL_COUNT, UBI_INT_VOL_COUNT,
ubi_msg("total number of reserved PEBs: %d", ubi->rsvd_pebs); ubi->vtbl_slots);
ubi_msg("number of PEBs reserved for bad PEB handling: %d", ubi_msg("max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u",
ubi->beb_rsvd_pebs); ubi->max_ec, ubi->mean_ec, CONFIG_MTD_UBI_WL_THRESHOLD,
ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); ubi->image_seq);
ubi_msg("image sequence number: %u", ubi->image_seq); ubi_msg("available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d",
ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs);
/* /*
* The below lock makes sure we do not race with 'ubi_thread()' which * The below lock makes sure we do not race with 'ubi_thread()' which
...@@ -1069,7 +1060,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) ...@@ -1069,7 +1060,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
ubi_assert(ubi_num == ubi->ubi_num); ubi_assert(ubi_num == ubi->ubi_num);
ubi_notify_all(ubi, UBI_VOLUME_REMOVED, NULL); ubi_notify_all(ubi, UBI_VOLUME_REMOVED, NULL);
dbg_msg("detaching mtd%d from ubi%d", ubi->mtd->index, ubi_num); ubi_msg("detaching mtd%d from ubi%d", ubi->mtd->index, ubi_num);
/* /*
* Before freeing anything, we have to stop the background thread to * Before freeing anything, we have to stop the background thread to
......
...@@ -754,7 +754,7 @@ static int rename_volumes(struct ubi_device *ubi, ...@@ -754,7 +754,7 @@ static int rename_volumes(struct ubi_device *ubi,
re->new_name_len = name_len; re->new_name_len = name_len;
memcpy(re->new_name, name, name_len); memcpy(re->new_name, name, name_len);
list_add_tail(&re->list, &rename_list); list_add_tail(&re->list, &rename_list);
dbg_msg("will rename volume %d from \"%s\" to \"%s\"", dbg_gen("will rename volume %d from \"%s\" to \"%s\"",
vol_id, re->desc->vol->name, name); vol_id, re->desc->vol->name, name);
} }
...@@ -812,7 +812,7 @@ static int rename_volumes(struct ubi_device *ubi, ...@@ -812,7 +812,7 @@ static int rename_volumes(struct ubi_device *ubi,
re1->remove = 1; re1->remove = 1;
re1->desc = desc; re1->desc = desc;
list_add(&re1->list, &rename_list); list_add(&re1->list, &rename_list);
dbg_msg("will remove volume %d, name \"%s\"", dbg_gen("will remove volume %d, name \"%s\"",
re1->desc->vol->vol_id, re1->desc->vol->name); re1->desc->vol->vol_id, re1->desc->vol->name);
} }
...@@ -943,7 +943,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, ...@@ -943,7 +943,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
{ {
struct ubi_rnvol_req *req; struct ubi_rnvol_req *req;
dbg_msg("re-name volumes"); dbg_gen("re-name volumes");
req = kmalloc(sizeof(struct ubi_rnvol_req), GFP_KERNEL); req = kmalloc(sizeof(struct ubi_rnvol_req), GFP_KERNEL);
if (!req) { if (!req) {
err = -ENOMEM; err = -ENOMEM;
......
...@@ -42,11 +42,6 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); ...@@ -42,11 +42,6 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid, \ pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid, \
##__VA_ARGS__) ##__VA_ARGS__)
/* Just a debugging messages not related to any specific UBI subsystem */
#define dbg_msg(fmt, ...) \
pr_err("UBI DBG (pid %d): %s: " fmt "\n", \
current->pid, __func__, ##__VA_ARGS__)
/* General debugging messages */ /* General debugging messages */
#define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__) #define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__)
/* Messages from the eraseblock association sub-system */ /* Messages from the eraseblock association sub-system */
......
...@@ -177,7 +177,7 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, ...@@ -177,7 +177,7 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
* enabled. A corresponding message will be printed * enabled. A corresponding message will be printed
* later, when it is has been scrubbed. * later, when it is has been scrubbed.
*/ */
dbg_msg("fixable bit-flip detected at PEB %d", pnum); ubi_msg("fixable bit-flip detected at PEB %d", pnum);
ubi_assert(len == read); ubi_assert(len == read);
return UBI_IO_BITFLIPS; return UBI_IO_BITFLIPS;
} }
......
...@@ -304,7 +304,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -304,7 +304,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *ai,
struct ubi_vid_hdr *vid_hdr; struct ubi_vid_hdr *vid_hdr;
struct ubi_ainf_peb *new_aeb; struct ubi_ainf_peb *new_aeb;
ubi_msg("create volume table (copy #%d)", copy + 1); dbg_gen("create volume table (copy #%d)", copy + 1);
vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL); vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL);
if (!vid_hdr) if (!vid_hdr)
......
...@@ -1201,7 +1201,7 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum) ...@@ -1201,7 +1201,7 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum)
{ {
struct ubi_wl_entry *e; struct ubi_wl_entry *e;
dbg_msg("schedule PEB %d for scrubbing", pnum); ubi_msg("schedule PEB %d for scrubbing", pnum);
retry: retry:
spin_lock(&ubi->wl_lock); spin_lock(&ubi->wl_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment