Commit 2d58f6ef authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

xfs: use new extent lookup helpers in xfs_bmapi_write

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 334f3423
...@@ -4561,7 +4561,7 @@ xfs_bmapi_write( ...@@ -4561,7 +4561,7 @@ xfs_bmapi_write(
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
struct xfs_bmalloca bma = { NULL }; /* args for xfs_bmap_alloc */ struct xfs_bmalloca bma = { NULL }; /* args for xfs_bmap_alloc */
xfs_fileoff_t end; /* end of mapped file region */ xfs_fileoff_t end; /* end of mapped file region */
int eof; /* after the end of extents */ bool eof = false; /* after the end of extents */
int error; /* error return */ int error; /* error return */
int n; /* current extent index */ int n; /* current extent index */
xfs_fileoff_t obno; /* old block number (offset) */ xfs_fileoff_t obno; /* old block number (offset) */
...@@ -4639,12 +4639,14 @@ xfs_bmapi_write( ...@@ -4639,12 +4639,14 @@ xfs_bmapi_write(
goto error0; goto error0;
} }
xfs_bmap_search_extents(ip, bno, whichfork, &eof, &bma.idx, &bma.got,
&bma.prev);
n = 0; n = 0;
end = bno + len; end = bno + len;
obno = bno; obno = bno;
if (!xfs_iext_lookup_extent(ip, ifp, bno, &bma.idx, &bma.got))
eof = true;
if (!xfs_iext_get_extent(ifp, bma.idx - 1, &bma.prev))
bma.prev.br_startoff = NULLFILEOFF;
bma.tp = tp; bma.tp = tp;
bma.ip = ip; bma.ip = ip;
bma.total = total; bma.total = total;
...@@ -4731,11 +4733,8 @@ xfs_bmapi_write( ...@@ -4731,11 +4733,8 @@ xfs_bmapi_write(
/* Else go on to the next record. */ /* Else go on to the next record. */
bma.prev = bma.got; bma.prev = bma.got;
if (++bma.idx < xfs_iext_count(ifp)) { if (!xfs_iext_get_extent(ifp, ++bma.idx, &bma.got))
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, bma.idx), eof = true;
&bma.got);
} else
eof = 1;
} }
*nmap = n; *nmap = n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment