public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH] UBI: only read UBI_VID_HDR_SIZE when reading the vid_hdr
Date: Fri, 24 Jun 2016 09:39:57 +0200	[thread overview]
Message-ID: <20160624093957.528c48dc@bbrezillon> (raw)
In-Reply-To: <20160624061037.GH20657@pengutronix.de>

On Fri, 24 Jun 2016 08:10:37 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Thu, Jun 23, 2016 at 05:16:06PM +0200, Richard Weinberger wrote:
> > Am 23.06.2016 um 17:06 schrieb Sascha Hauer:  
> > >>>  	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);  
> > >>
> > >> Hmm, I fear this will break as soon ubi->vid_hdr_shift is non-zero.  
> > > 
> > > Ok, just tried and indeed it does break. Would it be an option to read
> > > UBI_VID_HDR_SIZE + ubi->vid_hdr_shift bytes instead?  
> > 
> > Well, you need to satisfy the trick UBI does.
> > Please read the huge comment on it on top of io.c.
> > 
> > Since in most cases ubi->vid_hdr_shift is 0 we could also do a fast path.
> > i.e.
> > if (ubi->vid_hdr_shift)
> > 	read_len = ubi->vid_hdr_alsize
> > else
> > 	read_len = UBI_VID_HDR_SIZE;  
> 
> Yes. I thought reading UBI_VID_HDR_SIZE + ubi->vid_hdr_shift has the
> advantage that even with vid_hdr_shift != 0 we can profit from reading
> subpages. I tested it with a vid hdr offset of 512 and it works ok.
> 
> > 
> > But first I have to review a view call sites. :-)  
> 
> Yes, please. It lowers the chance that I break the kernel ;)
> 
> > 
> > Can you tell a bit more on the NAND you're facing that speedup?
> > I find it surprising that you gain a full second.

Not so surprising to me. I tried the same trick on a 16k page NAND a
while a ago, and it drastically decreased the attach time (don't recall
the exact numbers).

> 
> It's a Micron Nand with a page size of 8192+448. On an i.MX6 we only
> have to read 512 bytes when reading the vid header.
> 
> Sascha
> 

  reply	other threads:[~2016-06-24  7:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 13:29 [PATCH] UBI: only read UBI_VID_HDR_SIZE when reading the vid_hdr Sascha Hauer
2016-06-23 14:38 ` Richard Weinberger
2016-06-23 15:06   ` Sascha Hauer
2016-06-23 15:16     ` Richard Weinberger
2016-06-24  6:10       ` Sascha Hauer
2016-06-24  7:39         ` Boris Brezillon [this message]
2016-06-25  8:39           ` [PATCH] ubi: Speedup ubi_io_read_vid_hdr() Richard Weinberger
2016-06-25  9:02             ` Richard Weinberger
2016-06-27  5:22             ` Sascha Hauer
2016-06-27  7:05               ` Richard Weinberger
2016-06-25  8:41           ` [PATCH] UBI: only read UBI_VID_HDR_SIZE when reading the vid_hdr Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160624093957.528c48dc@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox