[Top] [All Lists]

[PATCH] libxfs: remove never-read "offset" assignment in readbufr_map &

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] libxfs: remove never-read "offset" assignment in readbufr_map & writebufr
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Wed, 09 Apr 2014 14:20:58 -0500
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
libxfs_readbufr_map() & libxfs_writebufr() iterate
over bp->b_map[] and read each chunk.  The loops start
out correctly, getting the offset from bm_bn and the
length from bm_len.  After the IO it correctly
advances the target buffer pointer by len, but then
inexplicably advances "offset" by len as well.  The
whole point of this exercise is to handle discontiguous
ranges - marching offset along by length of IO done
is incorrect.

Thankfully offset is immediately reset to the proper
value again at the top of the loop for the next range,
so this is harmless, other than being confusing.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 9887423..7208a2f 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -758,7 +758,6 @@ libxfs_readbufr_map(struct xfs_buftarg *btp, struct xfs_buf 
*bp, int flags)
                buf += len;
-               offset += len;
        if (!error)
@@ -878,7 +877,6 @@ libxfs_writebufr(xfs_buf_t *bp)
                        buf += len;
-                       offset += len;

<Prev in Thread] Current Thread [Next in Thread>