[PATCH] UBI: only read UBI_VID_HDR_SIZE when reading the vid_hdr

Sascha Hauer s.hauer at pengutronix.de
Thu Jun 23 06:29:21 PDT 2016


When reading the vid hdr from the device UBI always reads a whole
page. Instead, read only the data we actually need and speed up
attachment of UBI devices by potentially making use of reading
subpages.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---

Please review carefully. It obviously works and speeds up UBI attachment
from 3s to 2s here in one case and I have not found places where this patch
makes problems, but there might be a reason I haven't seen why in case of
the ec header only the header is read while in case of the vid header the
whole page is read.

 drivers/mtd/ubi/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 10cf3b5..31918a0 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1019,7 +1019,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
 
 	p = (char *)vid_hdr - ubi->vid_hdr_shift;
 	read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
-			  ubi->vid_hdr_alsize);
+			  UBI_VID_HDR_SIZE);
 	if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
 		return read_err;
 
-- 
2.8.1




More information about the linux-mtd mailing list