* A couple of bugs in nand_write_ecc()
@ 2003-02-14 17:43 Alex Samoutin
2003-02-14 23:01 ` Thomas Gleixner
0 siblings, 1 reply; 5+ messages in thread
From: Alex Samoutin @ 2003-02-14 17:43 UTC (permalink / raw)
To: linux-mtd
I've found a couple of bugs in nand.c driver, or may be I just don't
understand how it should works. Please, take a look.
Function nand_write_ecc() mast write buffer to NAND with any length and
starting with any byte. But when the last byte
not finished at sector border nand_write_ecc() write extra bytes out of
buffer :
/*
* Check, if we have a full page write, then we can
* use the given buffer, else we have to copy
*/
if (!col && ((len - written) >= mtd->oobblock)) {
this->data_poi = (u_char*) &buf[written];
cnt = mtd->oobblock;
} else {
cnt = 0;
>>>>>>>>>>> for (i = col; i < len && i < mtd->oobblock;
i++) {
this->data_buf[i] = buf[written + i];
cnt++;
}
this->data_poi = this->data_buf;
}
Market line should be
for (i = col; i < (len-written) && i < mtd->oobblock; i++) {
Then we invoke nand_write_page() function
if (eccbuf) {
ret = nand_write_page (mtd, this, page, col, cnt
,&eccbuf[oob], oobsel);
oob += mtd->oobsize;
} else
ret = nand_write_page (mtd, this, page, col, cnt,
NULL, oobsel);
Where the "col" is offset form page start and "cnt" is leght of data. But
nand_write_page ()
defined as:
static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this,
int page, int col, int last, u_char *oob_buf, int
oobsel)
where "col" mean the same, but "last" is offset of last byte of data!
So, we have to use:
ret = nand_write_page (mtd, this, page, col, col+cnt, NULL, oobsel)
Am I right?
Alex.
^ permalink raw reply [flat|nested] 5+ messages in thread
* A couple of bugs in nand_write_ecc()
2003-02-14 17:43 A couple of bugs in nand_write_ecc() Alex Samoutin
@ 2003-02-14 23:01 ` Thomas Gleixner
2003-02-15 1:05 ` Alex Samoutin
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2003-02-14 23:01 UTC (permalink / raw)
To: linux-mtd
On Friday 14 February 2003 18:43, Alex Samoutin wrote:
> Am I right?
Not really.
But it's no more relevant. I removed the possiblibity to write not page
aligned data to NAND.
--
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx at linutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* A couple of bugs in nand_write_ecc()
2003-02-14 23:01 ` Thomas Gleixner
@ 2003-02-15 1:05 ` Alex Samoutin
2003-02-15 7:48 ` Thomas Gleixner
2003-02-15 11:30 ` Thomas Gleixner
0 siblings, 2 replies; 5+ messages in thread
From: Alex Samoutin @ 2003-02-15 1:05 UTC (permalink / raw)
To: linux-mtd
From: "Thomas Gleixner" <tglx@linutronix.de>
> But it's no more relevant. I removed the possiblibity to write not page
> aligned data to NAND.
Ok, But what I have to do with this,
JFFS2 still trying to write not sector alligned data:
debian:~# rm /mnt/nand/a*
nand_read_ecc: from = 0x0000c800, len = 16
nand_read_ecc: from = 0x0000c834, len = 16
nand_read_ecc: from = 0x0000c868, len = 16
nand_read_ecc: from = 0x0000c89c, len = 16
nand_read_ecc: from = 0x0000c8d8, len = 16
nand_read_ecc: from = 0x0000c910, len = 16
nand_read_ecc: from = 0x00198000, len = 1052
nand_write_ecc: to = 0x0000c940, len = 1052
nand_write_ecc: Attempt to write not page aligned data
nand_write_ecc()
nand_write()
part_write()
call satck jffs2_flash_write()
jffs2_garbage_collect_pristine()
jffs2_garbage_collect_live()
jffs2_garbage_collect_pass()
jffs2_garbage_collect_thread ()
Write of 1052 bytes at 0x0000c940 failed. returned -22, retlen 1052
nand_read_ecc: from = 0x00198000, len = 1052
nand_write_ecc: to = 0x0000cd5c, len = 1052
nand_write_ecc: Attempt to write not page aligned data
Write of 1052 bytes at 0x0000cd5c failed. returned -22, retlen 1052
nand_read_ecc: from = 0x0000d178, len = 16
jffs2_flash_writev(): Non-contiguous write to 0000d178
wbuf was previously 0000c800-0000c93f
kernel BUG at wbuf.c:282!
Oops: Exception in kernel mode, sig: 4
Call backtrace:
jffs2_flash_writev
jffs2_write_dirent
jffs2_do_unlink
jffs2_unlink
vfs_unlink
ret_from_syscall_1
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* A couple of bugs in nand_write_ecc()
2003-02-15 1:05 ` Alex Samoutin
@ 2003-02-15 7:48 ` Thomas Gleixner
2003-02-15 11:30 ` Thomas Gleixner
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2003-02-15 7:48 UTC (permalink / raw)
To: linux-mtd
On Saturday 15 February 2003 02:05, Alex Samoutin wrote:
> From: "Thomas Gleixner" <tglx@linutronix.de>
>
> Ok, But what I have to do with this,
> JFFS2 still trying to write not sector alligned data:
I know, will be fixed today
--
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx at linutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* A couple of bugs in nand_write_ecc()
2003-02-15 1:05 ` Alex Samoutin
2003-02-15 7:48 ` Thomas Gleixner
@ 2003-02-15 11:30 ` Thomas Gleixner
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2003-02-15 11:30 UTC (permalink / raw)
To: linux-mtd
On Saturday 15 February 2003 02:05, Alex Samoutin wrote:
> From: "Thomas Gleixner" <tglx@linutronix.de>
> Ok, But what I have to do with this,
> JFFS2 still trying to write not sector alligned data:
Fixed in CVS. cvs up.
Thanks for pointing it out.
--
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx at linutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-15 11:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-14 17:43 A couple of bugs in nand_write_ecc() Alex Samoutin
2003-02-14 23:01 ` Thomas Gleixner
2003-02-15 1:05 ` Alex Samoutin
2003-02-15 7:48 ` Thomas Gleixner
2003-02-15 11:30 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox