public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [RFC][PATCH][MTD][OneNAND] Fix OneNAND byte access
Date: Fri, 16 May 2008 10:25:49 +0300	[thread overview]
Message-ID: <482D36FD.6050506@nokia.com> (raw)
In-Reply-To: <20080516044508.GA28048@party>

Kyungmin Park wrote:
> Some upper layer try to read unaligned offset access
> So it adjusts the buffer, offset, and count variables
> 
> / # mount -t ubifs ubi0 /mnt
> UBIFS: recovery needed
> onenand_read_bufferram[528] 0 11	<- Unaligned count
> onenand_read_bufferram[514] 91 12	<- Unaligned offset
> onenand_read_bufferram[528] 92 11
> onenand_read_bufferram[528] 74 17
> onenand_read_bufferram[514] 103 17	<- Unaligned offset
> onenand_read_bufferram[514] 11 17
> onenand_read_bufferram[514] 137 17
> onenand_read_bufferram[528] 120 17
> onenand_read_bufferram[528] 40 17
> onenand_read_bufferram[514] 57 17
> onenand_read_bufferram[528] 632 61
> onenand_read_bufferram[528] 360 61
> onenand_read_bufferram[528] 80 61
> 
> It's only optimization at driver level
> 
> I think it's the best that it handles at UBIFS itself
> e.g., Now it passed down from name handling
> If the size of name is odd how about pad it even?

It would be a lot of work to change UBIFS.

It is really a driver problem.  For example OMAP2
does not have the problem, so it should be fixed at
the driver level.

> 
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
> index 5d7965f..49194b6 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -509,9 +509,23 @@ static int onenand_read_bufferram(struct mtd_info *mtd, int area,
>  
>  	bufferram += onenand_bufferram_offset(mtd, area);
>  
> +	if (ONENAND_CHECK_BYTE_ACCESS(offset)) {
> +		unsigned short word;
> +		printk("%s[%d] %d %zd\n", __func__, __LINE__, offset, count);
> +
> +		/* Align with word(16-bit) size */
> +		/* Read word and save byte */
> +		word = this->read_word(bufferram + offset - 1);
> +		buffer[0] = (word & 0xff00) >> 8;
> +		buffer++;
> +		offset++;
> +		count--;
> +	}
> +
>  	if (ONENAND_CHECK_BYTE_ACCESS(count)) {
>  		unsigned short word;
>  
> +		printk("%s[%d] %d %zd\n", __func__, __LINE__, offset, count);
>  		/* Align with word(16-bit) size */
>  		count--;
>  
> 

I presume you will remove the printks.

  reply	other threads:[~2008-05-16  7:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16  4:45 [RFC][PATCH][MTD][OneNAND] Fix OneNAND byte access Kyungmin Park
2008-05-16  7:25 ` Adrian Hunter [this message]
2008-05-16  7:52   ` Kyungmin Park

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=482D36FD.6050506@nokia.com \
    --to=ext-adrian.hunter@nokia.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mtd@lists.infradead.org \
    /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