[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFLxGvwHO9nSLiMEpqtEr1Y-5TSjs_M4+_pbwUG6_Fojk+CUvA@mail.gmail.com>
Date: Fri, 12 Jul 2019 23:54:27 +0200
From: Richard Weinberger <richard.weinberger@...il.com>
To: Zhihao Cheng <chengzhihao1@...wei.com>
Cc: David Oberhollenzer <david.oberhollenzer@...ma-star.at>,
Richard Weinberger <richard@....at>,
David Gstir <david@...ma-star.at>,
Boris Brezillon <boris.brezillon@...e-electrons.com>,
yi.zhang@...wei.com, linux-mtd@...ts.infradead.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC v2] mtd: ubi: Add fastmap sysfs attribute
On Fri, Jun 28, 2019 at 2:01 PM Zhihao Cheng <chengzhihao1@...wei.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@...wei.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
Powered by blists - more mailing lists