[PATCH 1/2] jffs2: Move erasing from write_super to GC.

Joakim Tjernlund joakim.tjernlund at transmode.se
Thu Feb 18 08:12:36 EST 2010


Artem Bityutskiy <dedekind1 at gmail.com> wrote on 2010/02/18 13:22:44:
>
> On Thu, 2010-02-18 at 13:17 +0100, Joakim Tjernlund wrote:
> > Artem Bityutskiy <dedekind1 at gmail.com> wrote on 2010/02/18 12:06:06:
> > >
> > > On Wed, 2010-02-17 at 09:16 +0100, Joakim Tjernlund wrote:
> > > > diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
> > > > index b47679b..1ca2559 100644
> > > > --- a/fs/jffs2/erase.c
> > > > +++ b/fs/jffs2/erase.c
> > > > @@ -114,6 +114,11 @@ void jffs2_erase_pending_blocks(struct jffs2_sb_info
> > > *c, int count)
> > > >     while (!list_empty(&c->erase_complete_list) ||
> > > >            !list_empty(&c->erase_pending_list)) {
> > > >
> > > > +      if (signal_pending(current)) {
> > > > +         spin_unlock(&c->erase_completion_lock);
> > > > +         mutex_unlock(&c->erase_free_sem);
> > > > +         goto done;
> > > > +      }
> > >
> > > Err, I thought you would remove signal checking from this function? It
> > > really does not belong here.
> >
> > Slight misunderstanding, it needs to be there otherwise my patches won't do any good.
> > Removing signal from this function basically means that we should remove count
> > and only erase one block per invocation. Basically the while !empty loop needs to move
> > into the GC task instead. This is a somewhat bigger surgery but doable.
>
> Right. You can move the signal check to the BGT, and do 1-3 erases at a
> time by passing cnt = 1-3. I think it is cleaner.

Doing this warrants a return value from jffs2_erase_pending_blocks() as
testing for empty lists will be clumsy in both GC and erase.c
All in all this will bring some more churn in the code so I really
don't won't to do all that for nothing, that is, David are you happy
with this too?

Question, is it really necessary to take erase_free_sem lock before
testing for list_empty?

 Jocke




More information about the linux-mtd mailing list