* [PATCH] jffs2: Do not assume erase will fail
@ 2010-10-07 16:29 Joakim Tjernlund
2010-10-12 8:48 ` Artem Bityutskiy
2010-10-25 0:11 ` David Woodhouse
0 siblings, 2 replies; 11+ messages in thread
From: Joakim Tjernlund @ 2010-10-07 16:29 UTC (permalink / raw)
To: linux-mtd; +Cc: Joakim Tjernlund
Test if it did and then abort.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
fs/jffs2/nodemgmt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index 694aa5b..49ee5de 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -260,9 +260,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
spin_lock(&c->erase_completion_lock);
/* An erase may have failed, decreasing the
- amount of free space available. So we must
- restart from the beginning */
- return -EAGAIN;
+ amount of free space available. */
+ if (list_empty(&c->free_list))
+ return -EAGAIN; /* restart from the beginning */
}
next = c->free_list.next;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-07 16:29 [PATCH] jffs2: Do not assume erase will fail Joakim Tjernlund
@ 2010-10-12 8:48 ` Artem Bityutskiy
2010-10-25 0:11 ` David Woodhouse
1 sibling, 0 replies; 11+ messages in thread
From: Artem Bityutskiy @ 2010-10-12 8:48 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linux-mtd
On Thu, 2010-10-07 at 18:29 +0200, Joakim Tjernlund wrote:
> Test if it did and then abort.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
> fs/jffs2/nodemgmt.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
Pushed to l2-mtd-2.6.git, thanks.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-07 16:29 [PATCH] jffs2: Do not assume erase will fail Joakim Tjernlund
2010-10-12 8:48 ` Artem Bityutskiy
@ 2010-10-25 0:11 ` David Woodhouse
2010-10-25 6:49 ` Joakim Tjernlund
2010-10-25 8:01 ` Artem Bityutskiy
1 sibling, 2 replies; 11+ messages in thread
From: David Woodhouse @ 2010-10-25 0:11 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linux-mtd
On Thu, 2010-10-07 at 18:29 +0200, Joakim Tjernlund wrote:
>
> Test if it did and then abort.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
> fs/jffs2/nodemgmt.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
> index 694aa5b..49ee5de 100644
> --- a/fs/jffs2/nodemgmt.c
> +++ b/fs/jffs2/nodemgmt.c
> @@ -260,9 +260,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
> spin_lock(&c->erase_completion_lock);
>
> /* An erase may have failed, decreasing the
> - amount of free space available. So we must
> - restart from the beginning */
> - return -EAGAIN;
> + amount of free space available. */
> + if (list_empty(&c->free_list))
> + return -EAGAIN; /* restart from the beginning */
Hm, but there could have been more than one erase pending (or in
progress). And if one fails and another succeeds then you could have a
non-empty free_list but you could *also* now have run short of
free/freeable space so that a userspace write should now receive
-ENOSPC.
Is this really a performance issue? It should just come straight back if
the conditions are still met, surely?
And if we're hitting this code path that often, we should look at
erasing more aggressively so that we *don't* have to erase stuff on
demand.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 0:11 ` David Woodhouse
@ 2010-10-25 6:49 ` Joakim Tjernlund
2010-10-25 9:50 ` David Woodhouse
2010-10-25 8:01 ` Artem Bityutskiy
1 sibling, 1 reply; 11+ messages in thread
From: Joakim Tjernlund @ 2010-10-25 6:49 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd
David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 02:11:25:
>
> On Thu, 2010-10-07 at 18:29 +0200, Joakim Tjernlund wrote:
> >
> > Test if it did and then abort.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > ---
> > fs/jffs2/nodemgmt.c | 6 +++---
> > 1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
> > index 694aa5b..49ee5de 100644
> > --- a/fs/jffs2/nodemgmt.c
> > +++ b/fs/jffs2/nodemgmt.c
> > @@ -260,9 +260,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
> > spin_lock(&c->erase_completion_lock);
> >
> > /* An erase may have failed, decreasing the
> > - amount of free space available. So we must
> > - restart from the beginning */
> > - return -EAGAIN;
> > + amount of free space available. */
> > + if (list_empty(&c->free_list))
> > + return -EAGAIN; /* restart from the beginning */
>
> Hm, but there could have been more than one erase pending (or in
> progress). And if one fails and another succeeds then you could have a
> non-empty free_list but you could *also* now have run short of
> free/freeable space so that a userspace write should now receive
> -ENOSPC.
I don't see how my patch changes that, if !list_empty(&c->free_list)
then you have at least one free block so you should not run into -ENOSPC
>
> Is this really a performance issue? It should just come straight back if
> the conditions are still met, surely?
Not a perf issue. It is something I noticed while looking for the
jffs2: Fix serious write stall due to erase
>
> And if we're hitting this code path that often, we should look at
> erasing more aggressively so that we *don't* have to erase stuff on
> demand.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 0:11 ` David Woodhouse
2010-10-25 6:49 ` Joakim Tjernlund
@ 2010-10-25 8:01 ` Artem Bityutskiy
2010-10-25 10:56 ` David Woodhouse
1 sibling, 1 reply; 11+ messages in thread
From: Artem Bityutskiy @ 2010-10-25 8:01 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, Joakim Tjernlund
On Mon, 2010-10-25 at 01:11 +0100, David Woodhouse wrote:
> On Thu, 2010-10-07 at 18:29 +0200, Joakim Tjernlund wrote:
> >
> > Test if it did and then abort.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > ---
> > fs/jffs2/nodemgmt.c | 6 +++---
> > 1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
> > index 694aa5b..49ee5de 100644
> > --- a/fs/jffs2/nodemgmt.c
> > +++ b/fs/jffs2/nodemgmt.c
> > @@ -260,9 +260,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
> > spin_lock(&c->erase_completion_lock);
> >
> > /* An erase may have failed, decreasing the
> > - amount of free space available. So we must
> > - restart from the beginning */
> > - return -EAGAIN;
> > + amount of free space available. */
> > + if (list_empty(&c->free_list))
> > + return -EAGAIN; /* restart from the beginning */
>
> Hm, but there could have been more than one erase pending (or in
> progress). And if one fails and another succeeds then you could have a
> non-empty free_list but you could *also* now have run short of
> free/freeable space so that a userspace write should now receive
> -ENOSPC.
>
> Is this really a performance issue? It should just come straight back if
> the conditions are still met, surely?
>
> And if we're hitting this code path that often, we should look at
> erasing more aggressively so that we *don't* have to erase stuff on
> demand.
David,
there are 2 patches which you seem to miss. I've re-based my l2 tree
against your today's mtd tree, and applied them on top. I've also
preserved this patch. Please, look at those.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 6:49 ` Joakim Tjernlund
@ 2010-10-25 9:50 ` David Woodhouse
2010-10-25 10:01 ` Joakim Tjernlund
0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2010-10-25 9:50 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linux-mtd
On Mon, 2010-10-25 at 08:49 +0200, Joakim Tjernlund wrote:
> David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 02:11:25:
> >
> > On Thu, 2010-10-07 at 18:29 +0200, Joakim Tjernlund wrote:
> > >
> > > Test if it did and then abort.
> > >
> > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > ---
> > > fs/jffs2/nodemgmt.c | 6 +++---
> > > 1 files changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
> > > index 694aa5b..49ee5de 100644
> > > --- a/fs/jffs2/nodemgmt.c
> > > +++ b/fs/jffs2/nodemgmt.c
> > > @@ -260,9 +260,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
> > > spin_lock(&c->erase_completion_lock);
> > >
> > > /* An erase may have failed, decreasing the
> > > - amount of free space available. So we must
> > > - restart from the beginning */
> > > - return -EAGAIN;
> > > + amount of free space available. */
> > > + if (list_empty(&c->free_list))
> > > + return -EAGAIN; /* restart from the beginning */
> >
> > Hm, but there could have been more than one erase pending (or in
> > progress). And if one fails and another succeeds then you could have a
> > non-empty free_list but you could *also* now have run short of
> > free/freeable space so that a userspace write should now receive
> > -ENOSPC.
>
> I don't see how my patch changes that, if !list_empty(&c->free_list)
> then you have at least one free block so you should not run into -ENOSPC
Not for jffs2_reserve_space_gc(), you're right. But for non-GC
allocations it's different -- jffs2_reserve_space() will only allow an
allocation if you have more than a certain amount of freeable space,
according to the type of operation. And that amount of freeable space
can be reduced if an erase fails.
--
dwmw2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 9:50 ` David Woodhouse
@ 2010-10-25 10:01 ` Joakim Tjernlund
0 siblings, 0 replies; 11+ messages in thread
From: Joakim Tjernlund @ 2010-10-25 10:01 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd
David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 11:50:01:
>
> On Mon, 2010-10-25 at 08:49 +0200, Joakim Tjernlund wrote:
> > David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 02:11:25:
> > >
> > > On Thu, 2010-10-07 at 18:29 +0200, Joakim Tjernlund wrote:
> > > >
> > > > Test if it did and then abort.
> > > >
> > > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > > ---
> > > > fs/jffs2/nodemgmt.c | 6 +++---
> > > > 1 files changed, 3 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
> > > > index 694aa5b..49ee5de 100644
> > > > --- a/fs/jffs2/nodemgmt.c
> > > > +++ b/fs/jffs2/nodemgmt.c
> > > > @@ -260,9 +260,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
> > > > spin_lock(&c->erase_completion_lock);
> > > >
> > > > /* An erase may have failed, decreasing the
> > > > - amount of free space available. So we must
> > > > - restart from the beginning */
> > > > - return -EAGAIN;
> > > > + amount of free space available. */
> > > > + if (list_empty(&c->free_list))
> > > > + return -EAGAIN; /* restart from the beginning */
> > >
> > > Hm, but there could have been more than one erase pending (or in
> > > progress). And if one fails and another succeeds then you could have a
> > > non-empty free_list but you could *also* now have run short of
> > > free/freeable space so that a userspace write should now receive
> > > -ENOSPC.
> >
> > I don't see how my patch changes that, if !list_empty(&c->free_list)
> > then you have at least one free block so you should not run into -ENOSPC
>
> Not for jffs2_reserve_space_gc(), you're right. But for non-GC
> allocations it's different -- jffs2_reserve_space() will only allow an
> allocation if you have more than a certain amount of freeable space,
> according to the type of operation. And that amount of freeable space
> can be reduced if an erase fails.
But jffs2_find_nextblock is only about finding ONE block, isn't it?
Jocke
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 8:01 ` Artem Bityutskiy
@ 2010-10-25 10:56 ` David Woodhouse
2010-10-25 11:00 ` Joakim Tjernlund
0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2010-10-25 10:56 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd, Joakim Tjernlund
On Mon, 2010-10-25 at 11:01 +0300, Artem Bityutskiy wrote:
>
> there are 2 patches which you seem to miss. I've re-based my l2 tree
> against your today's mtd tree, and applied them on top. I've also
> preserved this patch. Please, look at those.
The 'fix NAND pwrite in raw mode' patch is redundant -- the problem is
fixed by Jon Povey's patch in commit cdcf12b2, which looks almost
identical to the way I suggested it be fixed.
The callback from m25p80 was dropped by its author, and rightly so.
Thanks, again, for keeping track.
--
dwmw2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 10:56 ` David Woodhouse
@ 2010-10-25 11:00 ` Joakim Tjernlund
2010-10-25 11:01 ` David Woodhouse
0 siblings, 1 reply; 11+ messages in thread
From: Joakim Tjernlund @ 2010-10-25 11:00 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, dedekind1
David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 12:56:48:
>
> On Mon, 2010-10-25 at 11:01 +0300, Artem Bityutskiy wrote:
> >
> > there are 2 patches which you seem to miss. I've re-based my l2 tree
> > against your today's mtd tree, and applied them on top. I've also
> > preserved this patch. Please, look at those.
>
> The 'fix NAND pwrite in raw mode' patch is redundant -- the problem is
> fixed by Jon Povey's patch in commit cdcf12b2, which looks almost
> identical to the way I suggested it be fixed.
>
> The callback from m25p80 was dropped by its author, and rightly so.
>
> Thanks, again, for keeping track.
But jffs2: Fix serious write stall due to erase
from me remains :)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 11:00 ` Joakim Tjernlund
@ 2010-10-25 11:01 ` David Woodhouse
2010-10-25 11:03 ` Joakim Tjernlund
0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2010-10-25 11:01 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linux-mtd, dedekind1
On Mon, 2010-10-25 at 13:00 +0200, Joakim Tjernlund wrote:
> David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 12:56:48:
> >
> > On Mon, 2010-10-25 at 11:01 +0300, Artem Bityutskiy wrote:
> > >
> > > there are 2 patches which you seem to miss. I've re-based my l2 tree
> > > against your today's mtd tree, and applied them on top. I've also
> > > preserved this patch. Please, look at those.
> >
> > The 'fix NAND pwrite in raw mode' patch is redundant -- the problem is
> > fixed by Jon Povey's patch in commit cdcf12b2, which looks almost
> > identical to the way I suggested it be fixed.
> >
> > The callback from m25p80 was dropped by its author, and rightly so.
> >
> > Thanks, again, for keeping track.
>
> But jffs2: Fix serious write stall due to erase
> from me remains :)
http://git.infradead.org/mtd-2.6.git/commitdiff/81cfc9f1
--
dwmw2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] jffs2: Do not assume erase will fail
2010-10-25 11:01 ` David Woodhouse
@ 2010-10-25 11:03 ` Joakim Tjernlund
0 siblings, 0 replies; 11+ messages in thread
From: Joakim Tjernlund @ 2010-10-25 11:03 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, dedekind1
David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 13:01:27:
>
> On Mon, 2010-10-25 at 13:00 +0200, Joakim Tjernlund wrote:
> > David Woodhouse <dwmw2@infradead.org> wrote on 2010/10/25 12:56:48:
> > >
> > > On Mon, 2010-10-25 at 11:01 +0300, Artem Bityutskiy wrote:
> > > >
> > > > there are 2 patches which you seem to miss. I've re-based my l2 tree
> > > > against your today's mtd tree, and applied them on top. I've also
> > > > preserved this patch. Please, look at those.
> > >
> > > The 'fix NAND pwrite in raw mode' patch is redundant -- the problem is
> > > fixed by Jon Povey's patch in commit cdcf12b2, which looks almost
> > > identical to the way I suggested it be fixed.
> > >
> > > The callback from m25p80 was dropped by its author, and rightly so.
> > >
> > > Thanks, again, for keeping track.
> >
> > But jffs2: Fix serious write stall due to erase
> > from me remains :)
>
> http://git.infradead.org/mtd-2.6.git/commitdiff/81cfc9f1
Oh, you had already taken it. Thanks
Jocke
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-10-25 11:03 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 16:29 [PATCH] jffs2: Do not assume erase will fail Joakim Tjernlund
2010-10-12 8:48 ` Artem Bityutskiy
2010-10-25 0:11 ` David Woodhouse
2010-10-25 6:49 ` Joakim Tjernlund
2010-10-25 9:50 ` David Woodhouse
2010-10-25 10:01 ` Joakim Tjernlund
2010-10-25 8:01 ` Artem Bityutskiy
2010-10-25 10:56 ` David Woodhouse
2010-10-25 11:00 ` Joakim Tjernlund
2010-10-25 11:01 ` David Woodhouse
2010-10-25 11:03 ` Joakim Tjernlund
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).