You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/07/19 20:14:01 UTC

[incubator-nuttx] 01/02: rwbuffer: Fix the wrong remaining block calculation in invalidation

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit e7034c102fade1c5aea83dfc79dac4c1050697fe
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jul 14 12:08:40 2020 +0800

    rwbuffer: Fix the wrong remaining block calculation in invalidation
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: I00e6e7332f397bcddfd44e1b3c5c514a8f07923f
---
 drivers/rwbuffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rwbuffer.c b/drivers/rwbuffer.c
index 6a88e03..d0d4b56 100644
--- a/drivers/rwbuffer.c
+++ b/drivers/rwbuffer.c
@@ -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) */
         {