public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: Nancy <nancydreaming@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: ubifs image file confusion!
Date: Wed, 14 May 2008 16:45:44 +0300	[thread overview]
Message-ID: <1210772744.5708.77.camel@sauron> (raw)
In-Reply-To: <bae050c10805130552o351fbcb6ifc83815895fcce22@mail.gmail.com>

On Tue, 2008-05-13 at 20:52 +0800, Nancy wrote:
> > dd if=/dev/mtd5 of=file
> > or
> > dd if=/dev/ubi0_0 of=file
> dd have to specify the count, blk...... I mean read size, It is
> difficult to get the size.
> And the output file is large. We need a small output file (only
> contain neccessary data).
> Cause those files will be offered online. suppose, the /dev/mtd5 is
> 1G, or /dev/ubi0_0 is 500M
> but the neccessary data only 10 or 100MiB. That waist too many space
> and our bandwidth which is unacceptable.

I see. But it is not a good reason for an additional ioctl anyway. In
Linux we try to keep the amount of ioctl's as low as possible.

What you can do instead, is to read the volume LEB by LEB, then check
the data against 0xFFs, and if it contains all 0xFFs - drop this data.

> I mean will you please make the ubifs.img(generated by mkfs.ubifs)
> contains all mapped LEBs?
Well... An UBIFS image file generated by mkfs.ubifs does contain some
LEBs which have only 0xFFs in it. And when you write this image file
using ubiupdate vol - these LEBs will be detected and UBI will leave
them unmapped.

>  fill all ubifs.img's unmapped LEBs with
> 0x00. Is that possible?

No, it is not.

I think I got it what is the problem you have hit. You drop unmapped
LEBs when you dump the volume, then you flash this dumped data back and
UBIFS cannot work anymore. Right?

Of course. UBIFS has the index which refers LEB numbers. And when you
drop unmapped LEBs the numbers change!

For example, you have mapped LEB3, unmapped LEB4, mapped LEB5. The UBIFS
index refers LEB3 and LEB5. You dump the volume and drop LEB4. Then you
flash the dumped image and LEB5 becomes LEB4! So the index now refers
incorrect LEB.

Basically speaking, you cannot do stuff like this. At least it is not
easy.

What you can do is to save the numbers of dropped LEBs in a file. And
when you write the dumped image, you feed 0xFFs instead of the LEB which
were dropped.

For example, you may improve ubiupdatevol and teach it to accept a
--unmapped=file option which would contain a list of unmapped LEB
numbers.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

  reply	other threads:[~2008-05-14 13:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  9:17 ubifs image file confusion! Nancy
2008-05-08  9:56 ` Nancy
2008-05-14 13:23   ` Artem Bityutskiy
2008-05-08 10:48 ` Artem Bityutskiy
2008-05-09  7:05   ` Nancy
2008-05-10  4:20     ` Nancy
2008-05-10  7:31       ` Nancy
2008-05-13  9:48         ` Artem Bityutskiy
2008-05-13 12:52           ` Nancy
2008-05-14 13:45             ` Artem Bityutskiy [this message]
2008-05-15  4:06               ` Nancy
2008-05-13  9:44       ` Artem Bityutskiy
2008-05-13 12:41         ` Nancy
2008-05-14 13:20           ` Artem Bityutskiy
2008-05-15  3:18             ` Nancy
2008-07-08 10:45             ` Artem Bityutskiy

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=1210772744.5708.77.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=nancydreaming@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox