public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Øyvind Harboe" <oyvind.harboe@zylin.com>
To: linux-mtd@lists.infradead.org
Subject: Re: PATCH: allow JFFS2 to write to really small disks
Date: Fri, 02 Sep 2005 14:44:47 +0200	[thread overview]
Message-ID: <1125665087.32593.41.camel@localhost.localdomain> (raw)
In-Reply-To: <20050901125707.GA1623@wohnheim.fh-wedel.de>

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

How about this patch?

It adds a mount option to allow Write Once Read Many if the disk is too
small to support read/write many times.

W.r.t. eCos, I expect the WORM capability to be enabled via a CDL
option.


-- 
Øyvind Harboe
http://www.zylin.com

[-- Attachment #2: jffs2worm.txt --]
[-- Type: text/x-patch, Size: 1879 bytes --]

Index: fs/jffs2/build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.77
diff -u -r1.77 build.c
--- fs/jffs2/build.c	31 Aug 2005 13:51:00 -0000	1.77
+++ fs/jffs2/build.c	2 Sep 2005 12:42:49 -0000
@@ -279,6 +279,18 @@
 
 	c->resv_blocks_write = c->resv_blocks_deletion + (size / c->sector_size);
 
+	/* It is possible to mount a JFFS2 in a mode where it allows
+	   Write Once Read Many operation if the flash disk is too small
+	   to support read/write many times.
+	   
+	   If the flash disk is smaller than resv_blocks_write, then we 
+	   allow writing to the disk anyway. The flash disk is then most likely
+       being used as write once - read many medimum, e.g. in-system configuration of 
+	   static parameters(e.g. MAC address of device in stored in "ROM"). */
+	if ((c->flags & JFFS2_SB_FLAG_ALLOW_WORM)!=0)&& (c->resv_blocks_write * c->sector_size > c->flash_size)) {
+		c->resv_blocks_write = 0; 
+	}
+
 	/* When do we let the GC thread run in the background */
 
 	c->resv_blocks_gctrigger = c->resv_blocks_write + 1;
Index: include/linux/jffs2_fs_sb.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/jffs2_fs_sb.h,v
retrieving revision 1.52
diff -u -r1.52 jffs2_fs_sb.h
--- include/linux/jffs2_fs_sb.h	19 May 2005 16:12:17 -0000	1.52
+++ include/linux/jffs2_fs_sb.h	2 Sep 2005 12:42:49 -0000
@@ -16,6 +16,9 @@
 #define JFFS2_SB_FLAG_RO 1
 #define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
 #define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
+#define JFFS2_SB_FLAG_ALLOW_WORM 8 /* allow write once read many if the
+                                      disk is too small to support read/write
+                                      many times*/
 
 struct jffs2_inodirty;
 

  parent reply	other threads:[~2005-09-02 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-31  9:28 PATCH: allow JFFS2 to write to really small disks Øyvind Harboe
2005-09-01 10:05 ` Jörn Engel
2005-09-01 11:12   ` Øyvind Harboe
2005-09-01 11:44     ` Jörn Engel
2005-09-01 11:52       ` Øyvind Harboe
2005-09-01 12:00         ` Jörn Engel
2005-09-01 12:45           ` Øyvind Harboe
2005-09-01 12:57             ` Jörn Engel
2005-09-01 13:00               ` Josh Boyer
2005-09-01 13:06               ` Øyvind Harboe
2005-09-02 12:44               ` Øyvind Harboe [this message]
2005-09-04  9:00                 ` Jörn Engel
2005-09-05 10:05                   ` oyvind.harboe
2005-09-05 10:27                     ` Jörn Engel

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=1125665087.32593.41.camel@localhost.localdomain \
    --to=oyvind.harboe@zylin.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