xfs
[Top] [All Lists]

[PATCH 06/14] xfs: get mp from bma->ip in xfs_bmap code

To: xfs@xxxxxxxxxxx
Subject: [PATCH 06/14] xfs: get mp from bma->ip in xfs_bmap code
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 15 Feb 2016 17:18:17 +1100
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1455517105-20033-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1455517105-20033-1-git-send-email-david@xxxxxxxxxxxxx>
From: Eric Sandeen <sandeen@xxxxxxxxxx>

Source kernel commit f1f96c4946590616812711ac19eb7a84be160877

In my earlier commit

  c29aad4 xfs: pass mp to XFS_WANT_CORRUPTED_GOTO

I added some local mp variables with code which indicates that
mp might be NULL.  Coverity doesn't like this now, because the
updated per-fs XFS_STATS macros dereference mp.

I don't think this is actually a problem; from what I can tell,
we cannot get to these functions with a null bma->tp, so my NULL
check was probably pointless.  Still, it's not super obvious.

So switch this code to get mp from the inode on the xfs_bmalloca
structure, with no conditional, because the functions are already
using bmap->ip directly.

Addresses-Coverity-Id: 1339552
Addresses-Coverity-Id: 1339553
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
---
 libxfs/xfs_bmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index a38549c..70417fc 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -1718,7 +1718,7 @@ xfs_bmap_add_extent_delay_real(
        struct xfs_mount        *mp;
        int                     whichfork = XFS_DATA_FORK;
 
-       mp  = bma->tp ? bma->tp->t_mountp : NULL;
+       mp = bma->ip->i_mount;
        ifp = XFS_IFORK_PTR(bma->ip, whichfork);
 
        ASSERT(bma->idx >= 0);
@@ -2932,7 +2932,7 @@ xfs_bmap_add_extent_hole_real(
        int                     state;  /* state bits, accessed thru macros */
        struct xfs_mount        *mp;
 
-       mp = bma->tp ? bma->tp->t_mountp : NULL;
+       mp = bma->ip->i_mount;
        ifp = XFS_IFORK_PTR(bma->ip, whichfork);
 
        ASSERT(bma->idx >= 0);
-- 
2.5.0

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