All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Menzebach <pm-mtd@mw-itcon.de>
To: Peter Menzebach <pm@mw-itcon.de>
Cc: "Artem B. Bityutskiy" <dedekind@yandex.ru>,
	linux-mtd@lists.infradead.org
Subject: Re: data  loss on jffs2 filesystem on dataflash
Date: Thu, 22 Sep 2005 19:09:40 +0200	[thread overview]
Message-ID: <4332E554.4020202@mw-itcon.de> (raw)
In-Reply-To: <4332D852.3060105@mw-itcon.de>

Peter Menzebach wrote:
forget the last patch, I made up my mind. If I do not find a good sector 
size, I should resize the size of flash for jffs2. See below.

The question is, if the call for jffs2_flash_setup should be moved 
before the size checks in jffs2_do_fill_super?

Best regards
Peter


--- /arm/src/mtd/fs/jffs2/wbuf.c	2005-09-22 13:33:42.000000000 +0200
+++ wbuf.c	2005-09-22 18:52:17.000000000 +0200
@@ -1200,18 +1193,37 @@
  }

  int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
+	int min_sector_size;
  	c->cleanmarker_size = 0;		/* No cleanmarkers needed */
  	
  	/* Initialize write buffer */
  	init_rwsem(&c->wbuf_sem);
-	c->wbuf_pagesize = c->sector_size;
+	c->wbuf_pagesize = c->mtd->erasesize;
+
+	min_sector_size = ((JFFS2_MIN_SECTOR_SIZE + c->mtd->erasesize - 1) / 
c->mtd->erasesize) * c->mtd->erasesize;
+
+	c->sector_size = min_sector_size;
+
+	c->flash_size = c->mtd->size;
+	
+	while ((c->sector_size < (2 * min_sector_size)) && (c->flash_size % 
c->sector_size != 0)) {
+		c->sector_size+=c->mtd->erasesize;
+	}
+
+	if ((c->flash_size % c->sector_size) != 0) {
+		c->sector_size = min_sector_size;
+		c->flash_size = (c->flash_size / min_sector_size) * min_sector_size;
+		printk(KERN_INFO "JFFS2 flash size and erase size adjusted size %dKiB 
erasesize %dB\n", c->flash_size/1024, c->sector_size);
+	};
+	
+	
  	c->wbuf_ofs = 0xFFFFFFFF;

  	c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
  	if (!c->wbuf)
  		return -ENOMEM;

-	printk(KERN_INFO "JFFS2 write-buffering enabled (%i)\n", 
c->wbuf_pagesize);
+	printk(KERN_INFO "JFFS2 write-buffering enabled (%i) erasesize 
(%i)\n", c->wbuf_pagesize, c->sector_size);

  	return 0;
  }

-- 
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1

      reply	other threads:[~2005-09-22 17:09 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-14 12:09 data loss on jffs2 filesystem on dataflash Peter Menzebach
2005-09-14 12:30 ` Artem B. Bityuckiy
2005-09-14 13:43   ` Peter Menzebach
2005-09-15  7:48     ` Artem B. Bityuckiy
2005-09-15  7:39   ` Peter Menzebach
2005-09-15  7:49     ` Artem B. Bityuckiy
2005-09-15  7:53     ` Artem B. Bityuckiy
     [not found]       ` <43292AC6.40809@mw-itcon.de>
     [not found]         ` <43292E16.70401@yandex.ru>
     [not found]           ` <43292F91.9010302@mw-itcon.de>
2005-09-20 10:18             ` Artem B. Bityutskiy
     [not found]               ` <432FEF55.5090700@mw-itcon.de>
2005-09-20 11:21                 ` Artem B. Bityutskiy
2005-09-20 12:55                 ` Artem B. Bityutskiy
2005-09-20 13:18                   ` Artem B. Bityutskiy
2005-09-20 13:38                     ` Peter Menzebach
2005-09-20 14:18                       ` Artem B. Bityutskiy
2005-09-20 15:01                         ` Peter Menzebach
2005-09-20 15:11                           ` Andrew Victor
2005-09-20 15:22                             ` Jörn Engel
2005-09-20 16:31                             ` Artem B. Bityutskiy
2005-09-21  7:21                               ` Andrew Victor
2005-09-21  9:25                                 ` Artem B. Bityutskiy
2005-09-21 10:27                                   ` Peter Menzebach
2005-09-21 13:36                                     ` Artem B. Bityutskiy
2005-09-21 13:41                                       ` Artem B. Bityutskiy
2005-09-21 15:44                                       ` Peter Menzebach
2005-09-21 15:59                                         ` Artem B. Bityutskiy
2005-09-21 16:10                                           ` Peter Menzebach
2005-09-21 16:19                                             ` Artem B. Bityutskiy
2005-09-21 17:10                                               ` Peter Menzebach
2005-09-22 10:38                                                 ` Peter Menzebach
2005-09-22 10:51                                                   ` Artem B. Bityutskiy
2005-09-20 15:11                           ` Artem B. Bityutskiy
2005-09-20 15:45                             ` Peter Menzebach
2005-09-20 13:32                   ` Jörn Engel
2005-09-20 14:11                     ` Artem B. Bityutskiy
2005-09-20 14:36                       ` Jörn Engel
2005-09-20 14:48                         ` Artem B. Bityutskiy
2005-09-21 19:07                     ` Pavel Machek
2005-09-22 10:48                       ` Artem B. Bityutskiy
2005-09-22 16:46                         ` Valdis.Kletnieks
2005-09-22 17:03                           ` Artem B. Bityutskiy
2005-09-22 17:22                             ` linux-os (Dick Johnson)
2005-09-22 18:43                               ` jscottkasten
2005-09-23  8:51                           ` Jörn Engel
2005-09-22 11:34                       ` Jörn Engel
2005-09-22 11:54                         ` Jörn Engel
2005-09-20 13:16                 ` Artem B. Bityutskiy
2005-09-15  8:02     ` Artem B. Bityuckiy
     [not found]       ` <43292E94.4020702@mw-itcon.de>
2005-09-15  8:26         ` Artem B. Bityuckiy
2005-09-15  8:33           ` Peter Menzebach
2005-09-15  8:47         ` Artem B. Bityuckiy
2005-09-15  9:14           ` Peter Menzebach
2005-09-15  9:25             ` Artem B. Bityuckiy
2005-09-21 13:55           ` Peter Menzebach
2005-09-21 13:59             ` Artem B. Bityutskiy
2005-09-15 10:32         ` Artem B. Bityuckiy
2005-09-22 12:30 ` Peter Menzebach
2005-09-22 12:44   ` Artem B. Bityutskiy
2005-09-22 13:31     ` Peter Menzebach
2005-09-22 14:06       ` Artem B. Bityutskiy
2005-09-22 14:32         ` Andrew Victor
2005-09-22 14:45           ` Artem B. Bityutskiy
2005-09-22 14:59           ` Peter Menzebach
2005-09-22 16:14           ` Peter Menzebach
2005-09-22 17:09             ` Peter Menzebach [this message]

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=4332E554.4020202@mw-itcon.de \
    --to=pm-mtd@mw-itcon.de \
    --cc=dedekind@yandex.ru \
    --cc=linux-mtd@lists.infradead.org \
    --cc=pm@mw-itcon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.