From: Bill Pringlemeir <bpringlemeir@nbsps.com>
To: dedekind1@gmail.com
Cc: Richard Weinberger <richard.weinberger@gmail.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
hujianyang <hujianyang@huawei.com>
Subject: Re: [PATCH RFC v2] UBI: New ioctl() to support ubidump
Date: Fri, 01 Aug 2014 11:35:04 -0400 [thread overview]
Message-ID: <87iomcrzo7.fsf@nbsps.com> (raw)
In-Reply-To: <1406878239.20616.65.camel@sauron.fi.intel.com> (Artem Bityutskiy's message of "Fri, 01 Aug 2014 10:30:39 +0300")
On 1 Aug 2014, dedekind1@gmail.com wrote:
> On Fri, 2014-08-01 at 10:50 +0800, hujianyang wrote:
>> 1) No UBI stuff and read UBIFS stuff from UBI-driver This is a
>> easiest way and we don't need any ioctl either. We can't get
>> UBI-level stuff right now but we can put this into our design of
>> dumping an image file.
> Yes. That's a good first step.
I agree that this is a good way to partition the functionality.
>> 2) Read data from MTD-driver and find a way to get pnum This way is
>> basing on my v2 work. We can put an ioctl() to kernel and if kernel
>> don't support this ioctl(), this tool will do a full-scan on MTD
>> device. It's transparent to user. But we should take some time to
>> consider how to do this full-scan.
> I guess, I'd need to think some more about the ioctl(), and may be
> someone else suggests something.
Isn't this just more work? The tool will rely on two things?
>> 3) Re-design this tool about dropping UBI driver based dumping.
>> This way is like the exist ubiformat utility. We don't use UBI driver
>> and just do read/write(maybe we can do some repairing later) with MTD
>> device or image files. It's not small.
> Probably, we'll think about this when we are done with 1) and may be
> 2).
Some of these points I don't understand. The 'ubiformat' already uses
'libscan.c', which have the basics for creating a static 'PEB->LEB'
mapping. So while I agree that maintaining two version of UBI is not
good, I think we already have this?
UBI has to deal with writing, especially atomic writes, and concurrency.
I don't think the tool needs either, so the 2nd version of UBI is
significantly simpler. Just look at 'libscan.c' versus
'driver/mtd/ubi/*.c'.
Also, I think a lot of people will have issues where they can not mount
the device and the only thing they can get is the whole 'nanddump';
which won't be done through Linux, but some other means. Ie, some ROM
boot code (which doesn't understand either UBI or UbiFS) to read out
NAND, a NAND programmer, etc.
Finally, the separate implementation can be good. Having two versions
of code use the same data structures will often show issues. If we want
to debug UBI, then using it is not so helpful. Having the separate
(simpler) implementation with worse performance is exactly the kind of
thing you want for debugging and repair, isn't it? Features like
'fastmap' are optional and we should fall back to a linear scan. I
think that future UBI changes will strive to be backwards compatible
unless there is some really good reason not to be?
The big advantage of doing everything outside the kernel is we can
eventually add lots of extra consistency checks that you would never
want to do in a running file system. Ie, verify a linear scan and the
fastmap are consistent, etc.
My intent is never to make work for anyone. Adding a patch to libscan.c
seems easy to me.
1. Allocate a 'pmap' array and a temporary 'sequence' array.
2. Initialize 'pmap' to -1.
3a. For each valid 'eb', get 'lnum' and 'sqnum' from vid header.
b. if (pmap[lnum] == -1 || sequence[lnum] < sqnum)
pmap[lnum] = eb, sequence[lnum] = sqnum;
but maybe I don't understand all the complexities. Isn't it that
simple?
Now if we want to use the tool on live volumes, 'libscan.c' will not
work for that. I thought that the concepts of a debugger may apply. It
can look at a core file, or a paused processes memory. But maybe it is
crazy to 'pause' Ubi/UbiFs. Someone might want such 'snapshots' to
examine the evolution of storage or some race issues... but I guess that
is not the main reason of using the ioctl().
Fwiw,
Bill Pringlemeir.
next prev parent reply other threads:[~2014-08-01 15:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 9:20 [PATCH RFC v2] ubi-utils: Introduce a utility ubidump hujianyang
2014-07-29 9:26 ` [PATCH RFC v2] UBI: New ioctl() to support ubidump hujianyang
2014-07-29 14:48 ` Bill Pringlemeir
2014-07-30 2:01 ` hujianyang
2014-07-30 15:53 ` Bill Pringlemeir
2014-07-31 3:01 ` hujianyang
2014-07-31 13:24 ` Artem Bityutskiy
2014-08-01 2:50 ` hujianyang
2014-08-01 7:30 ` Artem Bityutskiy
2014-08-01 10:10 ` hujianyang
2014-08-01 15:35 ` Bill Pringlemeir [this message]
2014-08-04 3:54 ` hujianyang
2014-08-05 21:10 ` Bill Pringlemeir
2014-07-31 13:25 ` Artem Bityutskiy
2014-07-29 16:37 ` Richard Weinberger
2014-07-30 2:19 ` hujianyang
2014-07-29 9:31 ` [PATCH 1/5] ubi-utils: Add libdump files hujianyang
2014-07-29 9:35 ` [PATCH 2/5] ubi-utils: Enable lnum2pnum ioctl in userspace hujianyang
2014-07-29 9:41 ` [PATCH 3/5] ubi-utils: Introduce ubidump hujianyang
2014-07-29 9:43 ` [PATCH 4/5] ubi-utils: Add ubifs-media.h hujianyang
2014-07-29 9:45 ` [PATCH 5/5] ubi-utils: Modified Makefile hujianyang
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=87iomcrzo7.fsf@nbsps.com \
--to=bpringlemeir@nbsps.com \
--cc=dedekind1@gmail.com \
--cc=hujianyang@huawei.com \
--cc=linux-mtd@lists.infradead.org \
--cc=richard.weinberger@gmail.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.