driver/ftl: pass the number of eraseblock for ftl_get_cblock

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2023-08-01 10:42:20 +08:00 committed by Xiang Xiao
parent 80004ef07d
commit 917728bad9

View File

@ -296,7 +296,8 @@ static ssize_t ftl_mtd_bread(FAR struct ftl_struct_s *dev, off_t startblock,
break;
}
count = ftl_get_cblock(dev, starteraseblock, (nblocks + mask) & ~mask);
count = ftl_get_cblock(dev, starteraseblock,
(nblocks + mask) / dev->blkper);
count = MIN(count * dev->blkper, nblocks);
startphysicalblock = dev->lptable[starteraseblock] *
dev->blkper + (startblock & mask);