xfs
[Top] [All Lists]

[PATCH 14/20] xfs: don't assume a left rmap when allocating a new rmap

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 14/20] xfs: don't assume a left rmap when allocating a new rmap
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 25 Aug 2016 16:44:55 -0700
Cc: linux-xfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <147216860614.3688.3200692982609112535.stgit@xxxxxxxxxxxxxxxx>
References: <147216860614.3688.3200692982609112535.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
The original rmap code assumed that there would always be at least
one rmap in the rmapbt (the AG sb/agf/agi) and so errored out if
it didn't find one.  This assumption isn't true for rtrmapbt, so
remove the check and just deal with the situation.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_rmap.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)


diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index 71704d6..73e8dc4 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -708,19 +708,19 @@ xfs_rmap_map(
                        &have_lt);
        if (error)
                goto out_error;
-       XFS_WANT_CORRUPTED_GOTO(mp, have_lt == 1, out_error);
-
-       error = xfs_rmap_get_rec(cur, &ltrec, &have_lt);
-       if (error)
-               goto out_error;
-       XFS_WANT_CORRUPTED_GOTO(mp, have_lt == 1, out_error);
-       trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
-                       xfs_rmap_cur_agno(cur), ltrec.rm_startblock,
-                       ltrec.rm_blockcount, ltrec.rm_owner,
-                       ltrec.rm_offset, ltrec.rm_flags);
+       if (have_lt) {
+               error = xfs_rmap_get_rec(cur, &ltrec, &have_lt);
+               if (error)
+                       goto out_error;
+               XFS_WANT_CORRUPTED_GOTO(mp, have_lt == 1, out_error);
+               trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
+                               xfs_rmap_cur_agno(cur), ltrec.rm_startblock,
+                               ltrec.rm_blockcount, ltrec.rm_owner,
+                               ltrec.rm_offset, ltrec.rm_flags);
 
-       if (!xfs_rmap_is_mergeable(&ltrec, owner, flags))
-               have_lt = 0;
+               if (!xfs_rmap_is_mergeable(&ltrec, owner, flags))
+                       have_lt = 0;
+       }
 
        XFS_WANT_CORRUPTED_GOTO(mp,
                have_lt == 0 ||

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