diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-12-06 17:47:30 +0100 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-12-26 18:15:14 +0100 |
commit | 393852ecfeec575ac78216b0eb58e4fd92f0816c (patch) | |
tree | 99edbcd7fee9cdaa69f51187834f93ada73feada /drivers/mtd/ubi/eba.c | |
parent | UBI: bugfix: allocate mandatory EBs first (diff) | |
download | linux-393852ecfeec575ac78216b0eb58e4fd92f0816c.tar.xz linux-393852ecfeec575ac78216b0eb58e4fd92f0816c.zip |
UBI: add ubi_leb_map interface
The idea of this interface belongs to Adrian Hunter. The
interface is extremely useful when one has to have a guarantee
that an LEB will contain all 0xFFs even in case of an unclean
reboot. UBI does have an 'ubi_leb_erase()' call which may do
this, but it is stupid and ineffecient, because it flushes whole
queue. I should be re-worked to just be a pair of unmap,
map calls.
The user of the interfaci is UBIFS at the moment.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r-- | drivers/mtd/ubi/eba.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 85f50c83cf42..c87db07bcd0c 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -656,11 +656,14 @@ retry: goto write_error; } - err = ubi_io_write_data(ubi, buf, pnum, offset, len); - if (err) { - ubi_warn("failed to write %d bytes at offset %d of LEB %d:%d, " - "PEB %d", len, offset, vol_id, lnum, pnum); - goto write_error; + if (len) { + err = ubi_io_write_data(ubi, buf, pnum, offset, len); + if (err) { + ubi_warn("failed to write %d bytes at offset %d of " + "LEB %d:%d, PEB %d", len, offset, vol_id, + lnum, pnum); + goto write_error; + } } vol->eba_tbl[lnum] = pnum; |