linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] UBI: only read necessary size when reading the VID header
@ 2016-06-28 11:51 Sascha Hauer
  2016-06-28 12:05 ` Richard Weinberger
  2016-06-28 13:00 ` Artem Bityutskiy
  0 siblings, 2 replies; 14+ messages in thread
From: Sascha Hauer @ 2016-06-28 11:51 UTC (permalink / raw)
  To: linux-mtd; +Cc: boris.brezillon, Richard Weinberger, dedekind1, Sascha Hauer

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 if the NAND driver supports it.

Since the VID header may be at offset vid_hdr_shift in the page and
we can only read from the beginning of a page we have to add that
offset to the read size.

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

change since v1:
- properly handle vid_hdr_shift != 0

 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..ff8cafe 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_shift + UBI_VID_HDR_SIZE);
 	if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
 		return read_err;
 
-- 
2.8.1

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

end of thread, other threads:[~2016-07-04 22:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 11:51 [PATCH v2] UBI: only read necessary size when reading the VID header Sascha Hauer
2016-06-28 12:05 ` Richard Weinberger
2016-06-28 13:00 ` Artem Bityutskiy
2016-06-28 13:32   ` Richard Weinberger
2016-06-28 14:05   ` Sascha Hauer
2016-06-28 14:54     ` Artem Bityutskiy
2016-06-28 17:46       ` Brian Norris
2016-07-04 13:52         ` Boris Brezillon
2016-06-28 17:49     ` Brian Norris
2016-06-29  3:51       ` Artem Bityutskiy
2016-06-28 17:43   ` Brian Norris
2016-06-29  3:49     ` Artem Bityutskiy
2016-07-04  9:38       ` Boris Brezillon
2016-07-04 22:24         ` 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).