From: "Jörn Engel" <joern@logfs.org>
To: Alexey Korolev <akorolev@infradead.org>
Cc: dwmw2@infradead.org, tglx@linutronix.de, linux-mtd@lists.infradead.org
Subject: Re: [PATCH][RFC] NAND subpage read feature. Take 2.
Date: Thu, 1 May 2008 22:25:28 +0200 [thread overview]
Message-ID: <20080501202523.GA17828@logfs.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0804301301360.6788@pentafluge.infradead.org>
On Wed, 30 April 2008 13:13:24 +0100, Alexey Korolev wrote:
>
> This patch enables NAND subpage read functionality.
...and creates a peculiar conflict of interests in me. I've added full
caching of the complete mtd in logfs, which gave a huge speedup to some
of my testcases. However caching is done in page granularity, therefore
it would completely defeat this patch, which also gives a speedup.
But until I can figure out how to combine both benefits, this looks
rather promising and should clearly get in.
> /**
> + * nand_read_subpage - [REPLACABLE] software ecc based sub-page read function
> + * @mtd: mtd info structure
> + * @chip: nand chip info structure
> + * @dataofs offset of requested data within the page
> + * @readlen data length
> + * @buf: buffer to store read data
> + */
> +static int nand_read_subpage(struct mtd_info * mtd,struct nand_chip *chip, uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi)
^ ^^
A linebreak would help. The indicated space should move five bytes to
the right. And there are a few similar stylistic things below. If you
feed this through checkpatch.pl, you should find them all.
buf and bufpoi should be the same name (I personally would prefer buf).
And you should document that the buffer has to be bigger than readlen.
There is just a single caller, but such a counter-intuitive detail can
easily cause bugs some years from now.
> +{
> + int start_step, end_step, num_steps;
> + uint32_t *eccpos = chip->ecc.layout->eccpos;
> + uint8_t *p;
> + int data_col_addr, i, gaps = 0;
> + int datafrag_len, eccfrag_len, aligned_len, aligned_pos;
> + int busw = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1;
> +
> + /* Column address wihin the page aligned to ECC size (256bytes). */
within
> + start_step = data_offs / chip->ecc.size;
> + end_step = (data_offs + readlen - 1) / chip->ecc.size;
Divisions are fairly expensive computations. Can they be replaced by
shifts?
Rest looks good to me, apart from some checkpatch-type details.
Although I am tired and could have missed something.
Jörn
--
Joern's library part 9:
http://www.scl.ameslab.gov/Publications/Gus/TwelveWays.html
next prev parent reply other threads:[~2008-05-01 20:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 12:13 [PATCH][RFC] NAND subpage read feature. Take 2 Alexey Korolev
2008-05-01 4:40 ` Hamish Moffatt
2008-05-01 5:34 ` MTD PARTITION Aneesh
2008-05-14 17:13 ` [PATCH][RFC] NAND subpage read feature. Take 2 Alexey Korolev
2008-05-01 20:25 ` Jörn Engel [this message]
2008-05-04 8:46 ` Alexander Belyakov
2008-05-05 7:37 ` Jörn Engel
2008-05-05 12:10 ` Alexander Belyakov
2008-05-05 15:39 ` Jörn Engel
2008-05-06 9:29 ` Alexander Belyakov
2008-05-08 15:30 ` Jörn Engel
2008-05-08 15:33 ` Artem Bityutskiy
2008-05-08 15:38 ` Jörn Engel
2008-05-06 0:15 ` Hamish Moffatt
2008-05-06 6:15 ` Jörn Engel
2008-05-06 9:42 ` Hamish Moffatt
2008-05-06 10:47 ` Jörn Engel
2008-05-14 17:34 ` Alexey Korolev
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=20080501202523.GA17828@logfs.org \
--to=joern@logfs.org \
--cc=akorolev@infradead.org \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=tglx@linutronix.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