public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Ferenc Havasi <havasi@inf.u-szeged.hu>
Cc: "Artem B. Bityuckiy" <dedekind@yandex.ru>, linux-mtd@lists.infradead.org
Subject: Re: [PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block
Date: Mon, 1 Aug 2005 16:18:42 +0200	[thread overview]
Message-ID: <20050801141841.GD32464@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <42EE2B78.70500@inf.u-szeged.hu>

On Mon, 1 August 2005 16:02:32 +0200, Ferenc Havasi wrote:
> Jörn Engel wrote:
> 
> >> 	D1(printk(KERN_DEBUG "Going to GC REF_PRISTINE node at 0x%08x\n", ref_offset(raw)));
> >> 
> >>@@ -513,8 +514,9 @@ static int jffs2_garbage_collect_pristin
> >> 	/* Ask for a small amount of space (or the totlen if smaller) because we
> >> 	   don't want to force wastage of the end of a block if splitting would
> >> 	   work. */
> >>-	ret = jffs2_reserve_space_gc(c, min_t(uint32_t, sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN, 
> >>-					      rawlen), &phys_ofs, &alloclen);
> >>+	ret = jffs2_reserve_space_gc(c, min_t(uint32_t, sizeof(struct jffs2_raw_inode) +
> >>+				JFFS2_MIN_DATA_LEN, rawlen), &phys_ofs, &alloclen, rawlen);
> >>+				/* this is not optimal yet */
> >
> >Can you add some more explanation to the comment?
> >
> OK, we will.
> 
> The reason of "this is not optimal" is the following: for
> jffs2_reserve_space_gc() we have to specify an argument called sumsize.
> It is the summary size of the requested node. It needs it, because it is
> necessary to fit not only the node but also its summary representation
> into the erase block. In all other cases we know exactly the summary
> size of all nodes except in this case, so we made an upper-estimation here.

Makes sense.

> >> 	if (ret)
> >> 		return ret;
> >> 
> >>@@ -594,7 +596,10 @@ static int jffs2_garbage_collect_pristin
> >> 	nraw->__totlen = rawlen;
> >> 	nraw->next_phys = NULL;
> >> 
> >>-	ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node);
> >>+	vecs[0].iov_base = (unsigned char *) node;
> >>+	vecs[0].iov_len = rawlen;
> >>+
> >>+	ret = jffs2_flash_writev(c, vecs, 1, phys_ofs, &retlen, 0);
> >
> >Why this change?  If it's required, it might make sense to split it
> >out into a preparatory patch.  But my gut feeling is that dropping
> >this part would be better.
> >
> Jffs2_flash_write() simply write directly the data onto the flash, and
> does not collect the summary information. Jffs2_flash_writev() does.

Then why can't you just re-implement jffs2_flash_write() using
Jffs2_flash_writev()?  That way, you keep the strange one-element
array logic confined in a small and simple function.  Here, we have an
already large and complicated one getting larger and more complicated.

Ok, maybe I'm missing something, so please tell me.

> >>+#ifdef CONFIG_JFFS2_SUMMARY
> >>+
> >>+/* Called with alloc sem _and_ erase_completion_lock */
> >>+static int jffs2_do_reserve_space_sum(struct jffs2_sb_info *c,  uint32_t minsize, uint32_t *ofs, uint32_t *len, uint32_t sumsize)
> >>+{
> >>
> >[...]
> >  
> >
> >>+#else
> >>+
> >>+/* Called with alloc sem _and_ erase_completion_lock */
> >>+static int jffs2_do_reserve_space_normal(struct jffs2_sb_info *c,  uint32_t minsize, uint32_t *ofs, uint32_t *len, uint32_t sumsize)
> >>+{
> >
> >It doesn't take too much creativity to combine this and the above
> >#ifdef into a single one.  That will still be ugly, but it's a step in
> >the right direction.
> >
> In the previous version it was combined, but we afraid of that it is
> hard to see what exectly happen. But we can tranform it back.

Hmm.  Either way, I'm not happy yet.  What I'd like to see is a patch
containing three types of changes:
o condition new code in fs/jffs2/summary.c,
o unconditional changes in existing source files and
o no-too-ugly #ifdefs in headers.

Nothing else.  I guess the converged variant is a better basis to work
towards that goal, but I could be wrong.  This one clearly needs more
thinking.

Jörn

-- 
Simplicity is prerequisite for reliability.
-- Edsger W. Dijkstra

  reply	other threads:[~2005-08-01 14:18 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-21  7:22 [PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block 赵 豆豆
2005-07-22 11:02 ` Artem B. Bityuckiy
2005-07-22 11:59 ` Jörn Engel
2005-07-22 12:12   ` Artem B. Bityuckiy
2005-07-22 12:27     ` Jörn Engel
2005-07-26  7:36     ` Ferenc Havasi
2005-07-26  7:44       ` Jörn Engel
2005-07-26  7:57         ` Ferenc Havasi
2005-07-26  8:29           ` Steven Scholz
2005-07-26  9:36             ` Jörn Engel
2005-07-26 10:03               ` Ferenc Havasi
2005-07-26 10:12                 ` Artem B. Bityuckiy
2005-07-26 10:51                 ` Steven Scholz
2005-07-26 11:13                   ` Jörn Engel
2005-07-26 11:14                     ` Steven Scholz
2005-07-26 12:37                   ` Ferenc Havasi
2005-07-26  9:32           ` Jörn Engel
2005-07-26 10:03             ` Jörn Engel
2005-07-27 22:08               ` David Woodhouse
2005-07-28  9:01                 ` Jörn Engel
2005-08-01  9:50               ` Havasi Ferenc
2005-08-01  9:56                 ` Jörn Engel
2005-08-01 10:07                   ` Havasi Ferenc
2005-08-01 10:43                     ` Jörn Engel
2005-08-01 14:02                       ` Ferenc Havasi
2005-08-01 14:18                         ` Jörn Engel [this message]
2005-08-11 15:03                           ` Ferenc Havasi
2005-08-11 15:47                             ` Artem B. Bityuckiy
2005-08-11 16:59                               ` Ferenc Havasi
2005-08-11 16:06                                 ` Artem B. Bityuckiy
2005-08-15 11:24                                   ` Ferenc Havasi
2005-08-15 12:23                                     ` Artem B. Bityuckiy
2005-08-15 17:10                                       ` Ferenc Havasi
2005-08-16 13:19                                         ` Artem B. Bityuckiy
2005-08-11 17:24                             ` Jörn Engel
2005-08-15  9:48                             ` Jörn Engel
2005-08-15 10:20                               ` Artem B. Bityuckiy
2005-08-15 11:42                                 ` Ferenc Havasi
2005-08-15 11:56                                   ` Jörn Engel
2005-08-15 11:07                               ` Artem B. Bityuckiy
2005-08-15 11:48                                 ` Ferenc Havasi
2005-08-15 11:59                                   ` Jörn Engel
2005-08-15 12:28                                     ` Ferenc Havasi
2005-08-15 12:38                                       ` Artem B. Bityuckiy
2005-08-15 12:52                                         ` Jörn Engel
2005-08-15 13:34                                           ` Ferenc Havasi
2005-08-15 13:42                                             ` Artem B. Bityuckiy
2005-08-15 13:48                                               ` Jörn Engel
2005-08-15 14:00                                                 ` Artem B. Bityuckiy
2005-08-15 14:05                                                   ` Jörn Engel
2005-08-15 14:19                                                     ` Artem B. Bityuckiy
2005-08-15 14:32                                                       ` Jörn Engel
2005-08-15 15:22                                                         ` Artem B. Bityuckiy
2005-08-16  7:16                                                           ` Artem B. Bityuckiy
2005-08-16  7:25                                                             ` Artem B. Bityuckiy
2005-08-16  9:47                                                               ` Jörn Engel
2005-08-16  9:56                                                                 ` Artem B. Bityuckiy
2005-08-15 13:43                                             ` Jörn Engel
2005-08-15 13:46                                               ` Artem B. Bityuckiy
2005-08-16 11:34                                             ` Artem B. Bityuckiy
2005-08-15 13:27                                         ` Ferenc Havasi
2005-08-15 13:40                                           ` Artem B. Bityuckiy
2005-08-15 13:45                                             ` Jörn Engel
2005-08-15 13:50                                               ` Artem B. Bityuckiy
2005-08-15 12:35                                   ` Artem B. Bityuckiy
2005-08-15 13:22                                     ` Ferenc Havasi
2005-08-15 13:38                                       ` Artem B. Bityuckiy
2005-08-15 13:51                                         ` Jörn Engel
2005-08-15 14:01                                           ` Artem B. Bityuckiy
2005-08-16  8:22                                         ` JFFS2 eraseblock header Artem B. Bityuckiy
2005-08-16  8:25                                           ` Artem B. Bityuckiy
2005-08-16  9:13                                           ` Ferenc Havasi
2005-08-16  9:25                                             ` Artem B. Bityuckiy
2005-09-08 13:32                                           ` David Woodhouse
2005-09-08 13:35                                             ` Artem B. Bityuckiy
2005-09-08 18:43                                               ` Jörn Engel
2005-09-09 12:57                                                 ` Josh Boyer
2005-09-09 13:08                                                   ` Artem B. Bityuckiy
2005-09-09 22:20                                                     ` Jörn Engel
2005-08-15 11:53                                 ` [PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block Jörn Engel
2005-08-15 12:46                                   ` Artem B. Bityuckiy
2005-07-26  8:40       ` Jffs2 problem with Versatile PB926EJ-S Soma sundaram Veerappan
2005-07-26 16:17         ` Todd Poynor
     [not found] <BAY17-F15C6182BFC9EEA8E5AD337E8CA0@phx.gbl>
2005-07-25  9:14 ` [PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block Jörn Engel
2005-07-25  9:20 ` 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=20050801141841.GD32464@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=dedekind@yandex.ru \
    --cc=havasi@inf.u-szeged.hu \
    --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