rwbuffer: Fix the wrong remaining block calculation in invalidation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I00e6e7332f397bcddfd44e1b3c5c514a8f07923f
This commit is contained in:
Xiang Xiao 2020-07-14 12:08:40 +08:00 committed by Brennan Ashton
parent 4f22f746f8
commit e7034c102f

View File

@ -492,7 +492,7 @@ int rwb_invalidate_writebuffer(FAR struct rwbuffer_s *rwb,
else if (wrbend > startblock && wrbend <= invend)
{
rwb->wrnblocks = wrbend - startblock;
rwb->wrnblocks -= wrbend - startblock;
ret = OK;
}
@ -612,11 +612,11 @@ int rwb_invalidate_readahead(FAR struct rwbuffer_s *rwb,
else if (rhbend > startblock && rhbend <= invend)
{
rwb->rhnblocks = rhbend - startblock;
rwb->rhnblocks -= rhbend - startblock;
ret = OK;
}
/* 4. We invalidate a portion at the beginning of the write buffer */
/* 4. We invalidate a portion at the begin of the read-ahead buffer */
else /* if (rwb->rhblockstart >= startblock && rhbend > invend) */
{