All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Øyvind Harboe" <oyvind.harboe@zylin.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org, ecos-discuss@sources.redhat.com
Subject: Re: JFFS2 eats memory
Date: Wed, 14 Jul 2004 10:15:12 +0200	[thread overview]
Message-ID: <1089792912.7607.22.camel@famine> (raw)
In-Reply-To: <1089759689.8822.18.camel@imladris.demon.co.uk>

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

On Wed, 2004-07-14 at 01:01, David Woodhouse wrote:
> On Tue, 2004-07-13 at 15:41 +0200, Øyvind Harboe wrote:
> > After your walkthrough if the approach on IRC, I came up with this
> > patch, which seems to take care of the problem.
> 
> I can't work out what that's doing. Does it do something like this?

Yes.

- I made a small fix: update jeb->last_node
- Ran some tests and it appears to do the job nicely on my rocket.


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


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

Index: nodemgmt.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/nodemgmt.c,v
retrieving revision 1.6
diff -w -u -r1.6 nodemgmt.c
--- nodemgmt.c	11 Dec 2003 23:33:54 -0000	1.6
+++ nodemgmt.c	14 Jul 2004 08:12:21 -0000
@@ -549,6 +549,50 @@
 		printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen);
 		return;
 	}
+
+	/* Nodes which have been marked obsolete no longer need to be
+	   associated with any inode. Remove them from the per-inode list */
+	if (ref->next_in_ino) {
+		struct jffs2_inode_cache *ic;
+		struct jffs2_raw_node_ref **p;
+
+		ic = jffs2_raw_ref_to_ic(ref);
+		for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino))
+			;
+
+		*p = ref->next_in_ino;
+		ref->next_in_ino = NULL;
+	}
+
+	/* Merge with the next node in the physical list, if there is one
+	   and if it's also obsolete */
+	if (ref->next_phys && ref_obsolete(ref->next_phys)) {
+		struct jffs2_raw_node_ref *n = ref->next_phys;
+
+		ref->__totlen += n->__totlen;
+		/* we don't need to check jeb->last_node */
+		ref->next_phys = n->next_phys;
+		BUG_ON(n->next_in_ino);
+		jffs2_free_raw_node_ref(n);
+	}
+
+	/* Also merge with the previous node in the list, if there is one
+	   and it that one is obsolete */
+	if (ref != jeb->first_node) {
+		struct jffs2_raw_node_ref *p = jeb->first_node;
+
+		while (p->next_phys != ref)
+			p = p->next_phys;
+
+		if (ref_obsolete(p)) {
+			p->__totlen += ref->__totlen;
+			if (jeb->last_node == ref) {
+			  jeb->last_node = p;
+			}
+			p->next_phys = ref->next_phys;
+			jffs2_free_raw_node_ref(ref);
+		}
+	}
 }
 
 #if CONFIG_JFFS2_FS_DEBUG > 0

  reply	other threads:[~2004-07-14  8:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1089643331.3951.42.camel@famine>
     [not found] ` <1089711000.2899.96.camel@hades.cambridge.redhat.com>
     [not found]   ` <1089712151.5995.21.camel@famine>
     [not found]     ` <1089713133.2899.117.camel@hades.cambridge.redhat.com>
     [not found]       ` <1089726079.6288.5.camel@famine>
2004-07-13 23:01         ` JFFS2 eats memory David Woodhouse
2004-07-14  8:15           ` Øyvind Harboe [this message]
2004-07-19 14:18             ` Øyvind Harboe
2004-07-19 14:24               ` David Woodhouse
2004-07-19 15:15                 ` Øyvind Harboe
2004-07-20  1:10                   ` David Woodhouse
2004-07-20  6:41                     ` Øyvind Harboe
2004-07-20 13:45                       ` David Woodhouse
2004-07-20 15:28                         ` Øyvind Harboe
2004-07-20 15:54                           ` David Woodhouse
2004-07-20 18:52                             ` Øyvind Harboe
2004-07-20 22:08                               ` David Woodhouse
2004-07-21  6:25                                 ` Øyvind Harboe
2004-07-21 11:51                                   ` David Woodhouse
2004-07-21 12:03                                     ` Øyvind Harboe
2004-07-21 13:25                                       ` David Woodhouse
2004-07-20 13:37                     ` Øyvind Harboe
2008-04-08 15:16 Jürgen Lambrecht

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=1089792912.7607.22.camel@famine \
    --to=oyvind.harboe@zylin.com \
    --cc=dwmw2@infradead.org \
    --cc=ecos-discuss@sources.redhat.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 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.