public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] jffs2: Move erasing from write_super to GC.
Date: Fri, 14 May 2010 11:35:04 +0100	[thread overview]
Message-ID: <1273833304.9999.1994.camel@macbook.infradead.org> (raw)
In-Reply-To: <OFA2F265F6.2B404027-ONC1257723.003646C0-C1257723.0037EF5F@transmode.se>

On Fri, 2010-05-14 at 12:10 +0200, Joakim Tjernlund wrote:
>  The only callers of jffs2_erase_pending_blocks() now call it with a
> > 'count' argument of 1. So perhaps it's now misnamed and the 's' and the
> > extra argument should be dropped?
> 
> I didn't want to change to much and who knows, maybe someone wants
> to erase more than one block in the future. Removing the
> count could be an add on patch once this patch has proven itself.

Yeah, that makes some sense.

> > I don't much like the calculation you've added to the end of that
> > function either, which really ought to be under locks (even though right
> > now I suspect it doesn't hurt). Why recalculate that at all, though --
> 
> Why does a simple list test need locks?

Because it's not just about the test itself. It's also about the memory
barriers. Some other CPU could have changed the list (under locks) but
unless you have the memory barrier which is implicit in the spinlock,
you might see old data.

> > why not keep a 'ret' variable which defaults to 0 but is set to 1 just
> > before the 'goto done' which is the only way out of the function where
> > the return value should be non-zero anyway?
> 
> That would not be the same, would it? One wants to know if the lists
> are empty AFTER erasing count blocks.

Hm, does one? There's precisely one place we use this return value, in
the GC thread. Can you explain the logic of what you were doing there?
It looks like you really wanted it to return a flag saying whether it
actually _did_ anything or not. And if it did, that's your work for this
GC wakeup and you don't call jffs2_garbage_collect_pass(). Why are you
returning a value which tells whether there's more work to do? 

>  I guess I could move the list empty
> check before goto done, but that would not really change anything.

Ah, yes. Instead of setting ret=1 at the 'goto done', you'd actually do
the test somewhere there too, before dropping the locks. Assuming that
this really is the return value you need to return, rather than a simple
'work_done' flag.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

  reply	other threads:[~2010-05-14 10:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-20 10:03 [PATCH] jffs2: Move erasing from write_super to GC Joakim Tjernlund
2010-03-30 12:57 ` Artem Bityutskiy
2010-03-30 13:04   ` Joakim Tjernlund
2010-05-13 17:16 ` David Woodhouse
2010-05-14 10:10   ` Joakim Tjernlund
2010-05-14 10:35     ` David Woodhouse [this message]
2010-05-14 11:07       ` Joakim Tjernlund
2010-05-14 12:12         ` Joakim Tjernlund
2010-05-17 15:35           ` Joakim Tjernlund
2010-05-18 15:46           ` David Woodhouse
2010-05-18 18:19             ` Joakim Tjernlund
2010-05-18 18:37           ` David Woodhouse
2010-05-18 18:59             ` David Woodhouse
2010-05-18 22:44               ` Joakim Tjernlund
2010-05-18 23:42                 ` David Woodhouse
2010-05-19  9:47                   ` Joakim Tjernlund
2010-05-19 10:05                     ` David Woodhouse
2010-05-19 10:36                       ` Joakim Tjernlund
2010-05-19 16:49                     ` David Woodhouse
2010-05-19 20:06                       ` Joakim Tjernlund
2010-05-19 21:24                         ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2010-02-26  9:19 Joakim Tjernlund
2010-02-15  7:40 Joakim Tjernlund

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=1273833304.9999.1994.camel@macbook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=joakim.tjernlund@transmode.se \
    --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