drivers/bch: flush the dirty sector to keep the sector sequence

flush the dirty sector to keep the sector sequence before ftl write

Change-Id: I1096cce39965806d5c877c2929b5a2ecdab27ac9
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2020-07-13 19:40:07 +08:00 committed by Xiang Xiao
parent ed3cddb684
commit f97b8436b3

View File

@ -141,6 +141,15 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset,
nsectors = bch->nsectors - sector;
}
/* Flush the dirty sector to keep the sector sequence */
ret = bchlib_flushsector(bch);
if (ret < 0)
{
ferr("ERROR: Flush failed: %d\n", ret);
return ret;
}
/* Write the contiguous sectors */
ret = bch->inode->u.i_bops->write(bch->inode, (FAR uint8_t *)buffer,