All of lore.kernel.org
 help / color / mirror / Atom feed
From: Angelos Manousarides <amanous@inaccessnetworks.com>
To: Josh Boyer <jwboyer@gmail.com>
Cc: Linux MTD mailing list <linux-mtd@lists.infradead.org>
Subject: Re: MTD device with multiple regions & JFFS2
Date: Fri, 30 Jun 2006 16:56:47 +0300	[thread overview]
Message-ID: <20060630135646.GA12360@inaccessnetworks.com> (raw)
In-Reply-To: <625fc13d0606300613q770a7f8cq57d90eea42255df@mail.gmail.com>

On Fri, Jun 30, 2006 at 08:13:21AM -0500, Josh Boyer wrote:
> On 6/30/06, Angelos Manousarides <amanous@inaccessnetworks.com> wrote:
> >
> > The code in mtdconcat does transfer the region info to the resulting
> > device, I see a mtd device with 2 (or 4 regions). The partitioning code
> > however does not. "numeraseregions" is 0 and "erasesize" is only used.
> >
> > While I was trying to fix the code in mtdpart.c, I discovered that this
> > is futile. The JFFS2 code does not seem to support this as well. Only
> > the "erasesize" is used there also. Does that mean that I cannot have a
> > JFFS2 filesystem that spans across multiple block size flash space?
> 
> Were you trying to fix it for "correctness", or is there a real
> problem here?  JFFS2 is known to work on Intel P30 chips without
> requiring it to understand the multiple erasesizes.  The chip command
> set driver should handle this.

The code in mtdpart.c does not propagate erase region information to the
slave device. I have ckeched with the git repository online and it is
still the same. Here is the code I am talking about, it is the only reference
in regions in mtdpard.c:

    if (master->numeraseregions>1) {
      /* Deal with variable erase size stuff */
      int i;
      struct mtd_erase_region_info *regions = master->eraseregions;

      /* Find the first erase regions which is part of this partition. */
      for (i=0; i < master->numeraseregions && slave->offset >= regions[i].offset; i++)
        ;

      for (i--; i < master->numeraseregions && slave->offset + slave->mtd.size > regions[i].offset; i++) {
        if (slave->mtd.erasesize < regions[i].erasesize) {
          slave->mtd.erasesize = regions[i].erasesize;
        }
      }
    } else {
      /* Single erase size */
      slave->mtd.erasesize = master->erasesize;
    }

I have changed this to allocate slave->mtd.eraseregions and set
slave->mtd.numeraseregions properly.

If this is not needed, then definately I am missing something here.

> Btw, you forgot to mention what kernel you're running.  I'm assuming a
> fairly recent one since you didn't say you had to backport P30 support
> or anything like that.

I had to backport the P30 code, but the mtdpart and mtdconcat files do
not have any changes since them.

Now that I think of it, my first comment about the JFFS2 might be wrong.
The jffs2 layer calls mtd->erase(). Because normally all "small" sectors
are enclosed in "large" sector binaries, the erase() function will
probably handle the erase properly. The JFFS layer might be thinking it
is erasing a single block, but the mtd->erase will actually erase a few
small blocks. This is probably the reason that the erasesize in a
multi-region flash is set to the maximum block size. But this is just a
guess.

--
Angelos Manousaridis

  reply	other threads:[~2006-06-30 13:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-30 12:31 MTD device with multiple regions & JFFS2 Angelos Manousarides
2006-06-30 13:13 ` Josh Boyer
2006-06-30 13:56   ` Angelos Manousarides [this message]
2006-06-30 14:36     ` Josh Boyer
2006-07-04 12:22       ` Angelos Manousarides

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=20060630135646.GA12360@inaccessnetworks.com \
    --to=amanous@inaccessnetworks.com \
    --cc=jwboyer@gmail.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.