summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-05-11 15:04:09 +0000
committerAlex Elder <aelder@sgi.com>2011-05-25 10:48:37 -0500
commitf1c63b73cf60dc4800cde5ce7fd9466c419e5e36 (patch)
treedf9250617bbf4e7521c9b25a2d7b3a0ffb09c969 /fs/xfs/xfs_bmap.c
parent00239acf36d3bba8e7c0609e6c473d6e408a2135 (diff)
downloadlwn-f1c63b73cf60dc4800cde5ce7fd9466c419e5e36.tar.gz
lwn-f1c63b73cf60dc4800cde5ce7fd9466c419e5e36.zip
xfs: do not do pointer arithmetic on extent records
We need to call xfs_iext_get_ext for the previous extent to get a valid pointer, and can't just do pointer arithmetics as they might be in different pages. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Lachlan McIlroy <lmcilroy@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index ebcd45203c3d..896e16f08ed9 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -5143,9 +5143,12 @@ xfs_bunmapi(
*/
ASSERT(bno >= del.br_blockcount);
bno -= del.br_blockcount;
- if (bno < got.br_startoff) {
- if (--lastx >= 0)
- xfs_bmbt_get_all(--ep, &got);
+ if (got.br_startoff > bno) {
+ if (--lastx >= 0) {
+ ep = xfs_iext_get_ext(ifp,
+ lastx);
+ xfs_bmbt_get_all(ep, &got);
+ }
}
continue;
} else if (del.br_state == XFS_EXT_UNWRITTEN) {