public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Steve Tsai" <startec@ms11.hinet.net>
To: "'Thomas Gleixner'" <tglx@linutronix.de>
Cc: "Linux MTD mailing list" <linux-mtd@lists.infradead.org>
Subject: RE: NAND Configuration
Date: Thu, 8 Aug 2002 17:37:40 +0800	[thread overview]
Message-ID: <002c01c23ebf$40a81c70$5501a8c0@synso.com.tw> (raw)
In-Reply-To: <1028797894.9586.8.camel@thomas.tec.linutronix.de>

Maybe I found the problem here. I find jffs2 will write to the page that
was used. The proble is that jffs2_wbuf_process make
jffs2_do_reserve_space caculate wrong ofs.

In jffs2_wbuf_process, when free_size is smaller than (c->wbuf_pagesize
- c->wbuf_len), jffs2_flush_wbuf(c, 1) was called, but free_size will
not be assigned right value. In the case, the block can not be used
anymore because the last page in the block was used here, but
jffs2_do_reserve_space does not know. 
jffs2_do_reserve_space will use the block, if minsize > jeb->free_size
and it maybe happen here. 



jffs2_wbuf_process
==============
if(!c->nextblock || (c->nextblock->free_size < (c->wbuf_pagesize -
c->wbuf_len)))
	jffs2_flush_wbuf(c, 1); /* pad only */   <========== should take
care free_size here
else			
	jffs2_flush_wbuf(c, 2); /* pad and adjust nextblock */



static int jffs2_do_reserve_space(struct jffs2_sb_info *c,  uint32_t
minsize, uint32_t *ofs, uint32_t *len)
{
	struct jffs2_eraseblock *jeb = c->nextblock;
	
 restart:
	if (jeb && minsize > jeb->free_size) {          <====== if
minisize > free_size, the block will be used
		/* Skip the end of this block and file it as having some
dirty space */
		/* If there's a pending write to it, flush now */
		if (c->wbuf_len) {


I add the following codes and I am still testing it. 

		if(!c->nextblock || (c->nextblock->free_size <
(c->wbuf_pagesize - c->wbuf_len))){
			jffs2_flush_wbuf(c, 1); /* pad only */
			c->dirty_size += c->nextblock->free_size;
			c->free_size  -= c->nextblock->free_size;
			c->nextblock->dirty_size +=
c->nextblock->free_size;
			c->nextblock->free_size = 0;
		}	
		else			
			jffs2_flush_wbuf(c, 2); /* pad and adjust
nextblock */


Steve Tsai



> 
> Can you please do the following ?
> 
> Update to latest CVS code.
> Erase the partition, you can use erase(all) /dev/mtdX
> echo 9 >/proc/sys/kernel/printk
> Start log
> mount
> do your mkdir, cp ...
> 
> if this happens again, please send a dump of the concerned 
> page and the logfile 
> 

  reply	other threads:[~2002-08-08  9:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-06  7:25 NAND Configuration Steve Tsai
2002-08-06  9:07 ` Thomas Gleixner
2002-08-06 10:40   ` Steve Tsai
2002-08-06 12:16     ` Thomas Gleixner
2002-08-07  9:08       ` Steve Tsai
2002-08-07 10:05         ` David Woodhouse
2002-08-07 10:19           ` Steve Tsai
2002-08-07 10:49             ` Thomas Gleixner
2002-08-07 21:11               ` Alice Hennessy
2002-08-08  8:59                 ` Thomas Gleixner
2002-08-08  9:14                 ` David Woodhouse
2002-08-08  9:28                   ` Thomas Gleixner
2002-08-08  2:47               ` Steve Tsai
2002-08-08  5:23               ` Steve Tsai
2002-08-08  9:11                 ` Thomas Gleixner
2002-08-08  9:37                   ` Steve Tsai [this message]
2002-08-08 11:05                     ` David Woodhouse
2002-08-09  6:53                       ` Steve Tsai
2002-08-09  8:09                         ` Thomas Gleixner
2002-08-10  7:54                           ` Steve Tsai
2002-08-10  8:41                             ` Thomas Gleixner
2002-08-12  6:30                               ` Steve Tsai
2002-08-06  9:45 ` Thomas Gleixner
2002-08-06 10:25   ` Steve Tsai
2002-08-06 12:28     ` Thomas Gleixner
2002-08-06 12:32       ` David Woodhouse
2002-08-06 12:40         ` Thomas Gleixner
2002-08-07 10:45       ` Steve Tsai

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='002c01c23ebf$40a81c70$5501a8c0@synso.com.tw' \
    --to=startec@ms11.hinet.net \
    --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