From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: dedekind1@gmail.com, linux-kernel@vger.kernel.org,
Heinz.Egger@linutronix.de, linux-mtd@lists.infradead.org,
tim.bird@am.sony.com, tglx@linutronix.de
Subject: Re: [PATCH] [RFC] UBI: Implement Fastmap support
Date: Tue, 22 May 2012 21:18:09 +0300 [thread overview]
Message-ID: <20120522211809.53bd6444@halley> (raw)
In-Reply-To: <4FBBC4EE.4040802@nod.at>
Hi Richard,
On Tue, 22 May 2012 18:55:10 +0200 Richard Weinberger <richard@nod.at> wrote:
> >> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> >> index 2c5ed5c..ef5d7b7 100644
> >> --- a/drivers/mtd/ubi/build.c
> >> +++ b/drivers/mtd/ubi/build.c
> >> @@ -144,6 +144,16 @@ int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype)
> >>
> >> ubi_do_get_device_info(ubi,&nt.di);
> >> ubi_do_get_volume_info(ubi, vol,&nt.vi);
> >> +
> >> + switch (ntype) {
> >> + case UBI_VOLUME_ADDED:
> >> + case UBI_VOLUME_REMOVED:
> >> + case UBI_VOLUME_RESIZED:
> >> + case UBI_VOLUME_RENAMED:
> >> + if (ubi_update_fastmap(ubi))
> >> + ubi_err("Unable to update fastmap!");
> >
> > In the error case, what are the consequences leaving the older on-flash
> > fastmap? Shouldn't it be invalidated?
>
> If the fastmap is not written complete the CRC check will fail next time
> and we fall back to scanning mode.
There are many fail-points within 'ubi_update_fastmap' where an error
code is returned, long before it attempts writing to the media.
If 'ubi_update_fastmap' fails due to those, then the old on-flash
fastmap is still valid.
However we know a volume has been just changed.
Will the system be coherent after a sudden reboot (that occurs prior
next successful fastmap update)?
> >> diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
> >> index 5275632..299a601 100644
> >> --- a/drivers/mtd/ubi/ubi.h
> >> +++ b/drivers/mtd/ubi/ubi.h
> >> @@ -202,6 +202,39 @@ struct ubi_rename_entry {
> >> struct ubi_volume_desc;
> >>
> >> /**
> >> + * struct ubi_fastmap - in-memory fastmap data structure.
> >> + * @peb: PEBs used by the current fastamp
> >
> > s/fastamp/fastmap/
> >
> >> + * @ec: the erase counter of each used PEB
> >> + * @size: size of the fastmap in bytes
> >> + * @used_blocks: number of used PEBs
> >> + */
> >> +struct ubi_fastmap {
> >
> > Suggestion: maybe ubi_fastmap_location / ubi_fastmap_layout /
> > ubi_fastmap_position ? slightly more explanatory than 'ubi_fastmap'.
>
> Good idea. ubi_fastmap_position seems good to me.
Sounds good. You could amend the comments above the struct as well.
> >> + * @root: the RB-tree where to look for
> >> + * @max_pnum: highest possible pnum
> >> + *
> >> + * This function looks for a wear leveling entry containing a eb which
> >> + * is in front of the memory.
> >
> > IMO can remove the last comment.
>
> Documentation is like sex: when it is good, it is very, very good; and
> when it is bad, it is better than nothing.
> - Dick Brandon
:-)
BTW what is "in front of the memory"? ;)
> >> + if (!e) {
> >> + spin_unlock(&ubi->wl_lock);
> >> + return -ENOMEM;
> >
> > This is traumatic; you must return the PEB back to WL, but fail to do so
> > due to an internal error.
>
> This is not easy. In the !e case I need memory.
Yes, I noticed this is far from trivial ;)
What troubles me, is that the system is unaware of the fault, acts
business as usual, with one less PEB.
Care to elaborate how come 'ubi->lookuptbl[pnum]' is NULL? What's the
exact flow leading to it?
> > (BTW the return value of ubi_wl_put_fm_peb is not tested at the call
> > sites)
> > The system is left with a missing PEB.
> > Can't we guarantee ubi_wl_put_fm_peb is called only after wl_init is
> > completed?
>
> Why would that help?
I tried to asses why 'ubi->lookuptbl[pnum]' gets NULL, I was
probably mistaken in my analysis.
There's a bit of assymetry here.
'ubi_wl_get_fm_peb' doesn't clear the 'ubi_wl_entry' from the lookuptbl.
It does not free the 'ubi_wl_entry' either (seems like it should, no?)
However 'ubi_wl_put_fm_peb' creates a 'ubi_wl_entry' if not found in
the lookuptbl.
Formerly, wl_init was responsible for correctly populating
'ubi->lookuptbl'. Can we somehow preserve this for FM pebs as well?
Regards,
Shmulik
WARNING: multiple messages have this Message-ID (diff)
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org, dedekind1@gmail.com,
linux-kernel@vger.kernel.org, Heinz.Egger@linutronix.de,
tim.bird@am.sony.com, tglx@linutronix.de
Subject: Re: [PATCH] [RFC] UBI: Implement Fastmap support
Date: Tue, 22 May 2012 21:18:09 +0300 [thread overview]
Message-ID: <20120522211809.53bd6444@halley> (raw)
In-Reply-To: <4FBBC4EE.4040802@nod.at>
Hi Richard,
On Tue, 22 May 2012 18:55:10 +0200 Richard Weinberger <richard@nod.at> wrote:
> >> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> >> index 2c5ed5c..ef5d7b7 100644
> >> --- a/drivers/mtd/ubi/build.c
> >> +++ b/drivers/mtd/ubi/build.c
> >> @@ -144,6 +144,16 @@ int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype)
> >>
> >> ubi_do_get_device_info(ubi,&nt.di);
> >> ubi_do_get_volume_info(ubi, vol,&nt.vi);
> >> +
> >> + switch (ntype) {
> >> + case UBI_VOLUME_ADDED:
> >> + case UBI_VOLUME_REMOVED:
> >> + case UBI_VOLUME_RESIZED:
> >> + case UBI_VOLUME_RENAMED:
> >> + if (ubi_update_fastmap(ubi))
> >> + ubi_err("Unable to update fastmap!");
> >
> > In the error case, what are the consequences leaving the older on-flash
> > fastmap? Shouldn't it be invalidated?
>
> If the fastmap is not written complete the CRC check will fail next time
> and we fall back to scanning mode.
There are many fail-points within 'ubi_update_fastmap' where an error
code is returned, long before it attempts writing to the media.
If 'ubi_update_fastmap' fails due to those, then the old on-flash
fastmap is still valid.
However we know a volume has been just changed.
Will the system be coherent after a sudden reboot (that occurs prior
next successful fastmap update)?
> >> diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
> >> index 5275632..299a601 100644
> >> --- a/drivers/mtd/ubi/ubi.h
> >> +++ b/drivers/mtd/ubi/ubi.h
> >> @@ -202,6 +202,39 @@ struct ubi_rename_entry {
> >> struct ubi_volume_desc;
> >>
> >> /**
> >> + * struct ubi_fastmap - in-memory fastmap data structure.
> >> + * @peb: PEBs used by the current fastamp
> >
> > s/fastamp/fastmap/
> >
> >> + * @ec: the erase counter of each used PEB
> >> + * @size: size of the fastmap in bytes
> >> + * @used_blocks: number of used PEBs
> >> + */
> >> +struct ubi_fastmap {
> >
> > Suggestion: maybe ubi_fastmap_location / ubi_fastmap_layout /
> > ubi_fastmap_position ? slightly more explanatory than 'ubi_fastmap'.
>
> Good idea. ubi_fastmap_position seems good to me.
Sounds good. You could amend the comments above the struct as well.
> >> + * @root: the RB-tree where to look for
> >> + * @max_pnum: highest possible pnum
> >> + *
> >> + * This function looks for a wear leveling entry containing a eb which
> >> + * is in front of the memory.
> >
> > IMO can remove the last comment.
>
> Documentation is like sex: when it is good, it is very, very good; and
> when it is bad, it is better than nothing.
> - Dick Brandon
:-)
BTW what is "in front of the memory"? ;)
> >> + if (!e) {
> >> + spin_unlock(&ubi->wl_lock);
> >> + return -ENOMEM;
> >
> > This is traumatic; you must return the PEB back to WL, but fail to do so
> > due to an internal error.
>
> This is not easy. In the !e case I need memory.
Yes, I noticed this is far from trivial ;)
What troubles me, is that the system is unaware of the fault, acts
business as usual, with one less PEB.
Care to elaborate how come 'ubi->lookuptbl[pnum]' is NULL? What's the
exact flow leading to it?
> > (BTW the return value of ubi_wl_put_fm_peb is not tested at the call
> > sites)
> > The system is left with a missing PEB.
> > Can't we guarantee ubi_wl_put_fm_peb is called only after wl_init is
> > completed?
>
> Why would that help?
I tried to asses why 'ubi->lookuptbl[pnum]' gets NULL, I was
probably mistaken in my analysis.
There's a bit of assymetry here.
'ubi_wl_get_fm_peb' doesn't clear the 'ubi_wl_entry' from the lookuptbl.
It does not free the 'ubi_wl_entry' either (seems like it should, no?)
However 'ubi_wl_put_fm_peb' creates a 'ubi_wl_entry' if not found in
the lookuptbl.
Formerly, wl_init was responsible for correctly populating
'ubi->lookuptbl'. Can we somehow preserve this for FM pebs as well?
Regards,
Shmulik
next prev parent reply other threads:[~2012-05-22 18:18 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 14:01 [RFC v6] UBI: Fastmap support (aka checkpointing) Richard Weinberger
2012-05-21 14:01 ` Richard Weinberger
2012-05-21 14:01 ` [PATCH] [RFC] UBI: Implement Fastmap support Richard Weinberger
2012-05-21 14:01 ` Richard Weinberger
2012-05-22 13:43 ` Artem Bityutskiy
2012-05-22 13:43 ` Artem Bityutskiy
2012-05-22 15:01 ` Shmulik Ladkani
2012-05-22 15:01 ` Shmulik Ladkani
2012-05-22 16:55 ` Richard Weinberger
2012-05-22 16:55 ` Richard Weinberger
2012-05-22 18:18 ` Shmulik Ladkani [this message]
2012-05-22 18:18 ` Shmulik Ladkani
2012-05-22 18:57 ` Richard Weinberger
2012-05-22 18:57 ` Richard Weinberger
2012-05-23 6:18 ` Shmulik Ladkani
2012-05-23 6:18 ` Shmulik Ladkani
2012-05-23 7:43 ` Richard Weinberger
2012-05-23 7:43 ` Richard Weinberger
2012-05-22 20:11 ` Richard Weinberger
2012-05-22 20:11 ` Richard Weinberger
2012-05-24 8:19 ` Artem Bityutskiy
2012-05-24 8:19 ` Artem Bityutskiy
2012-05-24 8:26 ` Richard Weinberger
2012-05-24 8:26 ` Richard Weinberger
2012-05-24 9:21 ` Artem Bityutskiy
2012-05-24 9:21 ` Artem Bityutskiy
2012-05-24 8:17 ` Artem Bityutskiy
2012-05-24 8:17 ` Artem Bityutskiy
2012-05-24 9:56 ` Shmulik Ladkani
2012-05-24 9:56 ` Shmulik Ladkani
2012-05-24 10:03 ` Richard Weinberger
2012-05-24 10:03 ` Richard Weinberger
2012-05-24 20:07 ` Shmulik Ladkani
2012-05-24 20:07 ` Shmulik Ladkani
2012-05-24 8:22 ` Artem Bityutskiy
2012-05-24 8:22 ` Artem Bityutskiy
2012-05-24 8:24 ` Richard Weinberger
2012-05-24 8:24 ` Richard Weinberger
-- strict thread matches above, loose matches on Subject: below --
2012-05-23 11:06 [RFC v7] UBI: Fastmap support (aka checkpointing) Richard Weinberger
2012-05-23 11:06 ` [PATCH] [RFC] UBI: Implement Fastmap support Richard Weinberger
2012-05-23 11:06 ` Richard Weinberger
2012-05-26 13:22 ` Artem Bityutskiy
2012-05-26 13:22 ` Artem Bityutskiy
2012-05-31 10:37 ` Adrian Hunter
2012-05-31 10:37 ` Adrian Hunter
2012-05-31 13:31 ` Richard Weinberger
2012-05-31 13:31 ` Richard Weinberger
2012-06-01 5:47 ` Adrian Hunter
2012-06-01 5:47 ` Adrian Hunter
2012-06-01 8:00 ` Richard Weinberger
2012-06-01 8:00 ` Richard Weinberger
2012-06-01 8:10 ` Artem Bityutskiy
2012-06-01 8:10 ` Artem Bityutskiy
2012-06-01 8:10 ` Richard Weinberger
2012-06-01 8:10 ` Richard Weinberger
2012-06-01 8:47 ` Adrian Hunter
2012-06-01 8:47 ` Adrian Hunter
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=20120522211809.53bd6444@halley \
--to=shmulik.ladkani@gmail.com \
--cc=Heinz.Egger@linutronix.de \
--cc=dedekind1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=tglx@linutronix.de \
--cc=tim.bird@am.sony.com \
/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.