]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove unnecessary int returns from deferred rmap functions
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 13 Dec 2019 00:54:33 +0000 (19:54 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 13 Dec 2019 00:54:33 +0000 (19:54 -0500)
Source kernel commit: bc46ac64713f11c86cbbe11a86abd2a71274b15f

Remove the return value from the functions that schedule deferred rmap
operations since they never fail and do not return status.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c
libxfs/xfs_refcount.c
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index f55e9919121cc9206d8f99a0c767a3a60a2da7e1..d89c0b978a96dfccdf46799bf5098fa5514fa912 100644 (file)
@@ -1978,11 +1978,8 @@ xfs_bmap_add_extent_delay_real(
        }
 
        /* add reverse mapping unless caller opted out */
-       if (!(bma->flags & XFS_BMAPI_NORMAP)) {
-               error = xfs_rmap_map_extent(bma->tp, bma->ip, whichfork, new);
-               if (error)
-                       goto done;
-       }
+       if (!(bma->flags & XFS_BMAPI_NORMAP))
+               xfs_rmap_map_extent(bma->tp, bma->ip, whichfork, new);
 
        /* convert to a btree if necessary */
        if (xfs_bmap_needs_btree(bma->ip, whichfork)) {
@@ -2464,9 +2461,7 @@ xfs_bmap_add_extent_unwritten_real(
        }
 
        /* update reverse mappings */
-       error = xfs_rmap_convert_extent(mp, tp, ip, whichfork, new);
-       if (error)
-               goto done;
+       xfs_rmap_convert_extent(mp, tp, ip, whichfork, new);
 
        /* convert to a btree if necessary */
        if (xfs_bmap_needs_btree(ip, whichfork)) {
@@ -2825,11 +2820,8 @@ xfs_bmap_add_extent_hole_real(
        }
 
        /* add reverse mapping unless caller opted out */
-       if (!(flags & XFS_BMAPI_NORMAP)) {
-               error = xfs_rmap_map_extent(tp, ip, whichfork, new);
-               if (error)
-                       goto done;
-       }
+       if (!(flags & XFS_BMAPI_NORMAP))
+               xfs_rmap_map_extent(tp, ip, whichfork, new);
 
        /* convert to a btree if necessary */
        if (xfs_bmap_needs_btree(ip, whichfork)) {
@@ -5142,9 +5134,7 @@ xfs_bmap_del_extent_real(
        }
 
        /* remove reverse mapping */
-       error = xfs_rmap_unmap_extent(tp, ip, whichfork, del);
-       if (error)
-               goto done;
+       xfs_rmap_unmap_extent(tp, ip, whichfork, del);
 
        /*
         * If we need to, add to list of extents to delete.
@@ -5644,12 +5634,11 @@ done:
                        &new);
 
        /* update reverse mapping. rmap functions merge the rmaps for us */
-       error = xfs_rmap_unmap_extent(tp, ip, whichfork, got);
-       if (error)
-               return error;
+       xfs_rmap_unmap_extent(tp, ip, whichfork, got);
        memcpy(&new, got, sizeof(new));
        new.br_startoff = left->br_startoff + left->br_blockcount;
-       return xfs_rmap_map_extent(tp, ip, whichfork, &new);
+       xfs_rmap_map_extent(tp, ip, whichfork, &new);
+       return 0;
 }
 
 static int
@@ -5688,10 +5677,9 @@ xfs_bmap_shift_update_extent(
                        got);
 
        /* update reverse mapping */
-       error = xfs_rmap_unmap_extent(tp, ip, whichfork, &prev);
-       if (error)
-               return error;
-       return xfs_rmap_map_extent(tp, ip, whichfork, got);
+       xfs_rmap_unmap_extent(tp, ip, whichfork, &prev);
+       xfs_rmap_map_extent(tp, ip, whichfork, got);
+       return 0;
 }
 
 int
index a16015c8191c76449a4785319c41f7acb5451c19..ea63c2d8523b38d44ff38e1835e5318358bf13f3 100644 (file)
@@ -1556,8 +1556,9 @@ xfs_refcount_alloc_cow_extent(
                return error;
 
        /* Add rmap entry */
-       return xfs_rmap_alloc_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
+       xfs_rmap_alloc_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
                        XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
+       return 0;
 }
 
 /* Forget a CoW staging event in the refcount btree. */
@@ -1568,17 +1569,13 @@ xfs_refcount_free_cow_extent(
        xfs_extlen_t                    len)
 {
        struct xfs_mount                *mp = tp->t_mountp;
-       int                             error;
 
        if (!xfs_sb_version_hasreflink(&mp->m_sb))
                return 0;
 
        /* Remove rmap entry */
-       error = xfs_rmap_free_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
+       xfs_rmap_free_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
                        XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
-       if (error)
-               return error;
-
        return __xfs_refcount_add(tp, XFS_REFCOUNT_FREE_COW, fsb, len);
 }
 
index 745121392d6888b8271fce2e41c0fc2b33332b46..d9b19c6718319b8db2f620ecf3ec9ae29499a56f 100644 (file)
@@ -2266,7 +2266,7 @@ xfs_rmap_update_is_needed(
  * Record a rmap intent; the list is kept sorted first by AG and then by
  * increasing age.
  */
-static int
+static void
 __xfs_rmap_add(
        struct xfs_trans                *tp,
        enum xfs_rmap_intent_type       type,
@@ -2293,11 +2293,10 @@ __xfs_rmap_add(
        ri->ri_bmap = *bmap;
 
        xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_RMAP, &ri->ri_list);
-       return 0;
 }
 
 /* Map an extent into a file. */
-int
+void
 xfs_rmap_map_extent(
        struct xfs_trans        *tp,
        struct xfs_inode        *ip,
@@ -2305,15 +2304,15 @@ xfs_rmap_map_extent(
        struct xfs_bmbt_irec    *PREV)
 {
        if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork))
-               return 0;
+               return;
 
-       return __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ?
+       __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ?
                        XFS_RMAP_MAP_SHARED : XFS_RMAP_MAP, ip->i_ino,
                        whichfork, PREV);
 }
 
 /* Unmap an extent out of a file. */
-int
+void
 xfs_rmap_unmap_extent(
        struct xfs_trans        *tp,
        struct xfs_inode        *ip,
@@ -2321,9 +2320,9 @@ xfs_rmap_unmap_extent(
        struct xfs_bmbt_irec    *PREV)
 {
        if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork))
-               return 0;
+               return;
 
-       return __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ?
+       __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ?
                        XFS_RMAP_UNMAP_SHARED : XFS_RMAP_UNMAP, ip->i_ino,
                        whichfork, PREV);
 }
@@ -2334,7 +2333,7 @@ xfs_rmap_unmap_extent(
  * Note that tp can be NULL here as no transaction is used for COW fork
  * unwritten conversion.
  */
-int
+void
 xfs_rmap_convert_extent(
        struct xfs_mount        *mp,
        struct xfs_trans        *tp,
@@ -2343,15 +2342,15 @@ xfs_rmap_convert_extent(
        struct xfs_bmbt_irec    *PREV)
 {
        if (!xfs_rmap_update_is_needed(mp, whichfork))
-               return 0;
+               return;
 
-       return __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ?
+       __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ?
                        XFS_RMAP_CONVERT_SHARED : XFS_RMAP_CONVERT, ip->i_ino,
                        whichfork, PREV);
 }
 
 /* Schedule the creation of an rmap for non-file data. */
-int
+void
 xfs_rmap_alloc_extent(
        struct xfs_trans        *tp,
        xfs_agnumber_t          agno,
@@ -2362,18 +2361,18 @@ xfs_rmap_alloc_extent(
        struct xfs_bmbt_irec    bmap;
 
        if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK))
-               return 0;
+               return;
 
        bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno);
        bmap.br_blockcount = len;
        bmap.br_startoff = 0;
        bmap.br_state = XFS_EXT_NORM;
 
-       return __xfs_rmap_add(tp, XFS_RMAP_ALLOC, owner, XFS_DATA_FORK, &bmap);
+       __xfs_rmap_add(tp, XFS_RMAP_ALLOC, owner, XFS_DATA_FORK, &bmap);
 }
 
 /* Schedule the deletion of an rmap for non-file data. */
-int
+void
 xfs_rmap_free_extent(
        struct xfs_trans        *tp,
        xfs_agnumber_t          agno,
@@ -2384,14 +2383,14 @@ xfs_rmap_free_extent(
        struct xfs_bmbt_irec    bmap;
 
        if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK))
-               return 0;
+               return;
 
        bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno);
        bmap.br_blockcount = len;
        bmap.br_startoff = 0;
        bmap.br_state = XFS_EXT_NORM;
 
-       return __xfs_rmap_add(tp, XFS_RMAP_FREE, owner, XFS_DATA_FORK, &bmap);
+       __xfs_rmap_add(tp, XFS_RMAP_FREE, owner, XFS_DATA_FORK, &bmap);
 }
 
 /* Compare rmap records.  Returns -1 if a < b, 1 if a > b, and 0 if equal. */
index e21ed0294e5c9898584eb688b700692273718706..0c2c3cb73429a3fd2df697e3f2f2a56ba39cd788 100644 (file)
@@ -161,16 +161,16 @@ struct xfs_rmap_intent {
 };
 
 /* functions for updating the rmapbt based on bmbt map/unmap operations */
-int xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
+void xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
                int whichfork, struct xfs_bmbt_irec *imap);
-int xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
+void xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
                int whichfork, struct xfs_bmbt_irec *imap);
-int xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp,
+void xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp,
                struct xfs_inode *ip, int whichfork,
                struct xfs_bmbt_irec *imap);
-int xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
+void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
                xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
-int xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
+void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
                xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
 
 void xfs_rmap_finish_one_cleanup(struct xfs_trans *tp,