public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/2] jffs:2 Move erasing from write_super to GC.
Date: Tue, 16 Feb 2010 10:57:52 +0200	[thread overview]
Message-ID: <1266310672.11659.197.camel@localhost> (raw)
In-Reply-To: <1266249781-27970-1-git-send-email-Joakim.Tjernlund@transmode.se>

On Mon, 2010-02-15 at 17:03 +0100, Joakim Tjernlund wrote:
> Erasing blocks is a form of GC and therefor it should live in the
> GC task. By moving it there two problems will be solved:
> 1) umounting will not hang until all pending blocks has
>    been erased.
> 2) Erasing can be paused by sending a SIGSTOP to the GC thread which
>    allowes for time critical tasks work in peace.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  fs/jffs2/background.c |    1 +
>  fs/jffs2/erase.c      |    5 +++++
>  fs/jffs2/nodemgmt.c   |    4 ++++
>  fs/jffs2/super.c      |    1 -
>  4 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
> index 3ff50da..a8e0140 100644
> --- a/fs/jffs2/background.c
> +++ b/fs/jffs2/background.c
> @@ -146,6 +146,7 @@ static int jffs2_garbage_collect_thread(void *_c)
>  		disallow_signal(SIGHUP);
>  
>  		D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): pass\n"));
> +		jffs2_erase_pending_blocks(c, 0);
>  		if (jffs2_garbage_collect_pass(c) == -ENOSPC) {
>  			printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n");
>  			goto die;
> 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;
> +		}

I think this is not very good split of functionality.
'jffs2_erase_pending_blocks()' should be stupid, it should just erase as
many EBs as it was asked to. It should have zero knowledge about
signals.

I think you should remove the signals checking from here and move that
to the GC thread.

Also, I think you should call it with count = 1, so that you would erase
only one EB at one iteration. This way you will let the GC thread do
other things with less latency as well.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  parent reply	other threads:[~2010-02-16  8:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 16:03 [PATCH 1/2] jffs:2 Move erasing from write_super to GC Joakim Tjernlund
2010-02-15 16:03 ` [PATCH 2/2] s/jffs2_erase_pending_trigger/jffs2_garbage_collect_trigger/ Joakim Tjernlund
2010-02-16  8:59   ` Artem Bityutskiy
2010-02-16  9:32     ` Joakim Tjernlund
2010-02-16 14:27     ` Joakim Tjernlund
2010-02-17  7:18       ` Artem Bityutskiy
2010-02-17  7:35         ` Joakim Tjernlund
2010-02-17  7:48           ` Artem Bityutskiy
2010-02-17  7:55             ` Joakim Tjernlund
2010-02-17  8:07               ` Artem Bityutskiy
2010-02-17  8:19                 ` Joakim Tjernlund
2010-02-16  8:57 ` Artem Bityutskiy [this message]
2010-02-16  9:18   ` [PATCH 1/2] jffs:2 Move erasing from write_super to GC Joakim Tjernlund
2010-02-16  9:45     ` Artem Bityutskiy
2010-02-16 11:49       ` Joakim Tjernlund
2010-02-16 11:59         ` Artem Bityutskiy

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=1266310672.11659.197.camel@localhost \
    --to=dedekind1@gmail.com \
    --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