ubi: Only read necessary size when reading the VID header
Subsystems (2)
PATCH 1/1 ubi: Only read necessary size when reading the VID header
Based on kernel commit 8a8e8d2fdbab ("ubi: Only read necessary size when reading the VID header") by Sascha Hauer <[email protected]>:
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.
--- drivers/mtd/ubi/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/io.c +1 -1
@@ -711,7 +711,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;
Signature · 7 lines
2.10.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 8 lines · Ulrich Ölmann
Based on kernel commit
8a8e8d2fdbab("ubi: Only read necessary size when reading the VID header") by Sascha Hauer <[email protected]>: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.
Quoted 5 lines
Since the VID header may be at offset
vid_hdr_shiftin 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 Ulrich Ölmann <[email protected]>
Applied, thanks
Sascha
Quoted 25 lines
--- drivers/mtd/ubi/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mtd/ubi/io.c +1
-1@@ -711,7 +711,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;Signature · 7 lines
2.10.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox