stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] MTD: UBI: speed up init by moving status messages to debugfs
@ 2016-07-25  9:46 Rajeev Kumar
  2016-07-25  9:46 ` [PATCH 2/2] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1 Rajeev Kumar
  2016-07-25 10:31 ` [PATCH 1/2] MTD: UBI: speed up init by moving status messages to debugfs Richard Weinberger
  0 siblings, 2 replies; 15+ messages in thread
From: Rajeev Kumar @ 2016-07-25  9:46 UTC (permalink / raw)
  To: dwmw2, computersforpeace
  Cc: dedekind1, richard, linux-mtd, stable, rajeev_kumar

This patch simply moves the verbose status messages associated with
UBI's fastmap feature to debugfs, thereby decreasing UBI
initialization time from 97 mS to 16 mS. Note that the first time
fastmap is invoked, building the fastmap took 146 mS. In order to
reproduce the test conditions, build with CONFIG_MTD_UBI_FASTMAP=y and
CONFIG_DYNAMIC_DEBUG=y and append the following to bootargs:

initcall_debug ubi.mtd=0 ubi.fm_autoconvert=1

ubi.mtd=0 is needed at every boot if you want ubi to be
autoloaded. ubi.fm_autoconvert switch is needed only once, when
fastmap is created.

How to restore the verbose output for testing:
-----------------------------------------------
root:~# ubidetach -p /dev/mtd0
root:~# mount -t debugfs none /mnt/dyndbg
root:~# echo 'file build.c +p' > /mnt/dyndbg/dynamic_debug/control
root:~# echo 'file fastmap.c +p' > /mnt/dyndbg/dynamic_debug/control
root:~# ubiattach -p /dev/mtd0
root:~# mount -t ubifs /dev/ubi0_0 /mnt/card
-----------------------------------------------
This patch is tested against 3.14 kernel and only build test is performed
against current upstream master branch.

Signed-off-by: Rajeev Kumar <rajeev_kumar@mentor.com>
---
 drivers/mtd/ubi/build.c   |   20 ++++++++++----------
 drivers/mtd/ubi/fastmap.c |    6 +++---
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index ef36182..59229c4 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -949,8 +949,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
 		ubi->fm_disabled = 1;
 	}
 
-	ubi_msg(ubi, "default fastmap pool size: %d", ubi->fm_pool.max_size);
-	ubi_msg(ubi, "default fastmap WL pool size: %d",
+	dbg_gen("default fastmap pool size: %d", ubi->fm_pool.max_size);
+	dbg_gen("default fastmap WL pool size: %d",
 		ubi->fm_wl_pool.max_size);
 #else
 	ubi->fm_disabled = 1;
@@ -1008,23 +1008,23 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
 		goto out_debugfs;
 	}
 
-	ubi_msg(ubi, "attached mtd%d (name \"%s\", size %llu MiB)",
+	dbg_gen("attached mtd%d (name \"%s\", size %llu MiB)",
 		mtd->index, mtd->name, ubi->flash_size >> 20);
-	ubi_msg(ubi, "PEB size: %d bytes (%d KiB), LEB size: %d bytes",
+	dbg_gen("PEB size: %d bytes (%d KiB), LEB size: %d bytes",
 		ubi->peb_size, ubi->peb_size >> 10, ubi->leb_size);
-	ubi_msg(ubi, "min./max. I/O unit sizes: %d/%d, sub-page size %d",
+	dbg_gen("min./max. I/O unit sizes: %d/%d, sub-page size %d",
 		ubi->min_io_size, ubi->max_write_size, ubi->hdrs_min_io_size);
-	ubi_msg(ubi, "VID header offset: %d (aligned %d), data offset: %d",
+	dbg_gen("VID header offset: %d (aligned %d), data offset: %d",
 		ubi->vid_hdr_offset, ubi->vid_hdr_aloffset, ubi->leb_start);
-	ubi_msg(ubi, "good PEBs: %d, bad PEBs: %d, corrupted PEBs: %d",
+	dbg_gen("good PEBs: %d, bad PEBs: %d, corrupted PEBs: %d",
 		ubi->good_peb_count, ubi->bad_peb_count, ubi->corr_peb_count);
-	ubi_msg(ubi, "user volume: %d, internal volumes: %d, max. volumes count: %d",
+	dbg_gen("user volume: %d, internal volumes: %d, max. volumes count: %d",
 		ubi->vol_count - UBI_INT_VOL_COUNT, UBI_INT_VOL_COUNT,
 		ubi->vtbl_slots);
-	ubi_msg(ubi, "max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u",
+	dbg_gen("max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u",
 		ubi->max_ec, ubi->mean_ec, CONFIG_MTD_UBI_WL_THRESHOLD,
 		ubi->image_seq);
-	ubi_msg(ubi, "available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d",
+	dbg_gen("available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d",
 		ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs);
 
 	/*
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 990898b..285a65a 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1053,9 +1053,9 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
 	ubi->fm = fm;
 	ubi->fm_pool.max_size = ubi->fm->max_pool_size;
 	ubi->fm_wl_pool.max_size = ubi->fm->max_wl_pool_size;
-	ubi_msg(ubi, "attached by fastmap");
-	ubi_msg(ubi, "fastmap pool size: %d", ubi->fm_pool.max_size);
-	ubi_msg(ubi, "fastmap WL pool size: %d",
+	dbg_bld("attached by fastmap");
+	dbg_bld("fastmap pool size: %d", ubi->fm_pool.max_size);
+	dbg_bld("fastmap WL pool size: %d",
 		ubi->fm_wl_pool.max_size);
 	ubi->fm_disabled = 0;
 	ubi->fast_attach = 1;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-10-26 12:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-25  9:46 [PATCH 1/2] MTD: UBI: speed up init by moving status messages to debugfs Rajeev Kumar
2016-07-25  9:46 ` [PATCH 2/2] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1 Rajeev Kumar
2016-07-25 10:31   ` Richard Weinberger
2016-07-25 11:16     ` Rajeev Kumar
2016-07-25 11:20       ` Richard Weinberger
2016-07-29 18:24     ` Brian Norris
2016-08-04  6:30       ` Artem Bityutskiy
2016-09-23 11:20         ` Chugh, Sanjeev
2016-09-23 11:37           ` Chugh, Sanjeev
2016-10-26 12:26           ` Chugh, Sanjeev
2016-07-25 10:31 ` [PATCH 1/2] MTD: UBI: speed up init by moving status messages to debugfs Richard Weinberger
2016-07-25 11:23   ` Rajeev Kumar
2016-07-25 11:32     ` Richard Weinberger
2016-07-25 16:47       ` Greg KH
2016-07-25 20:39         ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).