Revert "driver/ftl: Read the current eraseblock only"
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
c40f9b8d9f
commit
a6080e4502
@ -287,7 +287,6 @@ static ssize_t ftl_mtd_bread(FAR struct ftl_struct_s *dev, off_t startblock,
|
|||||||
{
|
{
|
||||||
off_t startphysicalblock;
|
off_t startphysicalblock;
|
||||||
off_t starteraseblock;
|
off_t starteraseblock;
|
||||||
size_t erase;
|
|
||||||
size_t count;
|
size_t count;
|
||||||
|
|
||||||
starteraseblock = startblock / dev->blkper;
|
starteraseblock = startblock / dev->blkper;
|
||||||
@ -297,14 +296,9 @@ static ssize_t ftl_mtd_bread(FAR struct ftl_struct_s *dev, off_t startblock,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
erase = ftl_get_cblock(dev, starteraseblock,
|
count = ftl_get_cblock(dev, starteraseblock,
|
||||||
(nblocks + mask) / dev->blkper);
|
(nblocks + mask) / dev->blkper);
|
||||||
count = MIN(erase * dev->blkper, nblocks);
|
count = MIN(count * dev->blkper, nblocks);
|
||||||
if (erase == 1)
|
|
||||||
{
|
|
||||||
count -= startblock & mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
startphysicalblock = dev->lptable[starteraseblock] *
|
startphysicalblock = dev->lptable[starteraseblock] *
|
||||||
dev->blkper + (startblock & mask);
|
dev->blkper + (startblock & mask);
|
||||||
ret = MTD_BREAD(dev->mtd, startphysicalblock, count, buffer);
|
ret = MTD_BREAD(dev->mtd, startphysicalblock, count, buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user