Why is PEB not erased before writing???

brijesh.singh at calsoftinc.com brijesh.singh at calsoftinc.com
Tue Feb 20 04:49:58 EST 2007


> On Tue, 2007-02-20 at 12:07 +0530, Brijesh Singh wrote:
>> I tried to overwrite same block.
>> Ubi should call erase before overwriting the data block.But it didn't.
>> UBI simply wrote the block again.That will write garbage for a flash.
>> So who will call erase??Is it the application's responsibility to call
>> erase before writing at same  location???
>>
>> I am stuck here because my concept was,
>> ubi will check if we are re-writing the same PEB.
>> If yes,UBI will erase the block and then write the same block.
>
> Applications and UBI kernel users have no access to physical erase
> blocks. They look at logical erase blocks. UBI manages the translation
> of logical to physical blocks. If you write to the same logical erase
> block again UBI will just write to a different physical erase block and
> erase the previous PEB later on. The internal management guarantees that
> the application looks only at the newest written block and not at the
> older one.

Yes this is what I thought it should do.If LEB is mapped to a dirty PEB
remap it and wl daemon will erase it.But it doesn't.
But here is the scenario
Steps
     *I made a 2MB ubi volume
     *Total mtd device size is 3MB
     *I wrote a 2MB file to UBI using "dd if=file of=/dev/ubi_vol"
     *Now device is full
     *Again I did the same thing.
     *Now theoretically erase should have been called,by wl or eba module
     *But it directly over-writes the device.
I am using mtdram to test if erase is called.Nop,it is not.
Cdev write interface calls eba_write which doesn't check if block is
already written.And it over-writes it with no call to erase.
Now what to do?Erase is not even called!







More information about the linux-mtd mailing list