linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org, tglx@linutronix.de,
	dedekind1@gmail.com, linux-kernel@vger.kernel.org,
	Heinz.Egger@linutronix.de, tim.bird@am.sony.com
Subject: Re: [PATCH] [RFC] UBI: Implement Fastmap support
Date: Thu, 31 May 2012 13:37:56 +0300	[thread overview]
Message-ID: <4FC74A04.30100@intel.com> (raw)
In-Reply-To: <1337771191-95358-2-git-send-email-richard@nod.at>

On 23/05/12 14:06, Richard Weinberger wrote:
> Fastmap (aka checkpointing) allows attaching of an UBI volume in nearly
> constant time. Only a fixed number of PEBs has to be scanned.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  drivers/mtd/ubi/Makefile    |    2 +-
>  drivers/mtd/ubi/attach.c    |   34 +-
>  drivers/mtd/ubi/build.c     |   25 +
>  drivers/mtd/ubi/eba.c       |   18 +-
>  drivers/mtd/ubi/fastmap.c   | 1240 +++++++++++++++++++++++++++++++++++++++++++
>  drivers/mtd/ubi/ubi-media.h |  119 +++++
>  drivers/mtd/ubi/ubi.h       |   68 +++-
>  drivers/mtd/ubi/wl.c        |  184 +++++++-
>  8 files changed, 1667 insertions(+), 23 deletions(-)
>  create mode 100644 drivers/mtd/ubi/fastmap.c
> 

...

> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
> new file mode 100644
> index 0000000..7757e5a

...

> +/**
> + * ubi_find_fastmap - searches the first UBI_FM_MAX_START PEBs for the
> + * fastmap super block.
> + * @ubi: UBI device object
> + */
> +static int ubi_find_fastmap(struct ubi_device *ubi, int *fm_start)
> +{
> +	int i, ret;
> +	struct ubi_vid_hdr *vhdr;
> +
> +	vhdr = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL);
> +	if (!vhdr)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < UBI_FM_MAX_START; i++) {
> +		ret = ubi_io_read_vid_hdr(ubi, i, vhdr, 0);
> +		if (ret < 0)
> +			break;
> +		else if (ret > 0)
> +			continue;
> +
> +		if (be32_to_cpu(vhdr->vol_id) == UBI_FM_SB_VOLUME_ID) {
> +			*fm_start = i;
> +			dbg_bld("Found fastmap super block at PEB %i\n", i);
> +			ret = 0;
> +
> +			break;

How do you know that this is the current fastmap and not a remnant of an old
fastmap?

> +		}
> +	}
> +
> +	ubi_free_vid_hdr(ubi, vhdr);
> +
> +	return ret;
> +}


  parent reply	other threads:[~2012-05-31 10:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-26 13:22   ` Artem Bityutskiy
2012-05-31 10:37   ` Adrian Hunter [this message]
2012-05-31 13:31     ` Richard Weinberger
2012-06-01  5:47   ` Adrian Hunter
2012-06-01  8:00     ` Richard Weinberger
2012-06-01  8:10       ` Artem Bityutskiy
2012-06-01  8:10         ` Richard Weinberger
2012-06-01  8:47           ` Adrian Hunter
2012-05-26 12:41 ` [RFC v7] UBI: Fastmap support (aka checkpointing) Artem Bityutskiy
2012-05-26 14:01   ` Richard Weinberger
2012-05-26 14:15     ` Artem Bityutskiy
2012-05-28  6:36   ` Shmulik Ladkani
2012-05-28  6:46     ` Artem Bityutskiy
2012-05-28  9:49       ` Richard Weinberger
  -- strict thread matches above, loose matches on Subject: below --
2012-05-21 14:01 [RFC v6] " Richard Weinberger
2012-05-21 14:01 ` [PATCH] [RFC] UBI: Implement Fastmap support Richard Weinberger
2012-05-22 13:43   ` Artem Bityutskiy
2012-05-22 15:01   ` Shmulik Ladkani
2012-05-22 16:55     ` Richard Weinberger
2012-05-22 18:18       ` Shmulik Ladkani
2012-05-22 18:57         ` Richard Weinberger
2012-05-23  6:18           ` Shmulik Ladkani
2012-05-23  7:43             ` Richard Weinberger
2012-05-22 20:11         ` Richard Weinberger
2012-05-24  8:19           ` Artem Bityutskiy
2012-05-24  8:26             ` Richard Weinberger
2012-05-24  9:21               ` Artem Bityutskiy
2012-05-24  8:17       ` Artem Bityutskiy
2012-05-24  9:56         ` Shmulik Ladkani
2012-05-24 10:03           ` Richard Weinberger
2012-05-24 20:07             ` Shmulik Ladkani
2012-05-24  8:22       ` Artem Bityutskiy
2012-05-24  8:24         ` Richard Weinberger

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=4FC74A04.30100@intel.com \
    --to=adrian.hunter@intel.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 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).