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