Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
From: Richard Weinberger <richard.weinberger@gmail.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	David Gstir <david@sigma-star.at>,
	yi.zhang@huawei.com, Richard Weinberger <richard@nod.at>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mtd@lists.infradead.org,
	David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Subject: Re: [PATCH RFC v2] mtd: ubi: Add fastmap sysfs attribute
Date: Fri, 12 Jul 2019 23:54:27 +0200
Message-ID: <CAFLxGvwHO9nSLiMEpqtEr1Y-5TSjs_M4+_pbwUG6_Fojk+CUvA@mail.gmail.com> (raw)
In-Reply-To: <1561723581-70340-1-git-send-email-chengzhihao1@huawei.com>

On Fri, Jun 28, 2019 at 2:01 PM Zhihao Cheng <chengzhihao1@huawei.com> wrote:
>
> The UBI device can be attached to a MTD device via fastmap by setting
> CONFIG_MTD_UBI_FASTMAP to 'y' (If there already exists a fastmap on the
> UBI device). To support some debugging scenarios, attaching process by
> fastmap can be confirmed in dmesg. If the UBI device is attached by
> fastmap, logs like following will appear in dmesg:
>
>   ubi0: attached by fastmap
>
> If multiple UBI devices are attached to multiple MTD devices at the same
> time, how to distinguish which UBI devices are successfully attached by
> fastmap? Extracting attaching information for each UBI device one by one
> from dmesg is a way. A better method is to record fastmap existence in
> sysfs, so it can be obtained by userspace tools.
>
> This patch exposes fastmap on sysfs. Suppose you attach an UBI device to a
> MTD device by fastmap: if fastmap equals to '1', that is, the fastmap
> generated before last detaching operation is confirmed valid. Else, there
> may be some problems with old fastmap. Besides, userspace tool can also
> check whether the fastmap updating triggered by other operations (such as
> resize volume) is successful by reading this sysfs attribute.
>
> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>

Sorry for the delay.

[...]

No locks in sysfs, please. :-)

> +               ret = sprintf(buf, "%d\n", ubi->fm ? 1 : 0);
> +               up_write(&ubi->fm_protect);
> +       } else

So, I like the idea to expose that information and I gave it
a second thought.

Basically you want to export two distinct infos.
1. Did we attach using fastmap?
2. Is *currently* a fastmap on the flash?

For 1, just expose ubi->fast_attach via sysfs.
To expose 2, you need to create a shadow variable of ubi->fm.
The problem is ubi->fm is internal and can be NULL while an
update happens.

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 12:06 Zhihao Cheng
2019-07-03  1:25 ` 答复: " chengzhihao
2019-07-12 21:54 ` Richard Weinberger [this message]

Reply instructions:

You may reply publically 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=CAFLxGvwHO9nSLiMEpqtEr1Y-5TSjs_M4+_pbwUG6_Fojk+CUvA@mail.gmail.com \
    --to=richard.weinberger@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=chengzhihao1@huawei.com \
    --cc=david.oberhollenzer@sigma-star.at \
    --cc=david@sigma-star.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=yi.zhang@huawei.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

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org linux-mtd@archiver.kernel.org
	public-inbox-index linux-mtd


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/ public-inbox