]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: remove unnecessary int returns from deferred refcount functions
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 15 Nov 2019 22:16:22 +0000 (17:16 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 15 Nov 2019 22:16:22 +0000 (17:16 -0500)
Source kernel commit: 74b4c5d4a9c073162a37d1c20c95cb33152ca474

Remove the return value from the functions that schedule deferred
refcount 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_refcount.h

index d89c0b978a96dfccdf46799bf5098fa5514fa912..470be877b95903b67707f70eb824e12136a35b86 100644 (file)
@@ -4386,12 +4386,9 @@ xfs_bmapi_write(
                         * If this is a CoW allocation, record the data in
                         * the refcount btree for orphan recovery.
                         */
-                       if (whichfork == XFS_COW_FORK) {
-                               error = xfs_refcount_alloc_cow_extent(tp,
-                                               bma.blkno, bma.length);
-                               if (error)
-                                       goto error0;
-                       }
+                       if (whichfork == XFS_COW_FORK)
+                               xfs_refcount_alloc_cow_extent(tp, bma.blkno,
+                                               bma.length);
                }
 
                /* Deal with the allocated space we found.  */
@@ -4525,12 +4522,8 @@ xfs_bmapi_convert_delalloc(
        *imap = bma.got;
        *seq = READ_ONCE(ifp->if_seq);
 
-       if (whichfork == XFS_COW_FORK) {
-               error = xfs_refcount_alloc_cow_extent(tp, bma.blkno,
-                               bma.length);
-               if (error)
-                       goto out_finish;
-       }
+       if (whichfork == XFS_COW_FORK)
+               xfs_refcount_alloc_cow_extent(tp, bma.blkno, bma.length);
 
        error = xfs_bmap_btree_to_extents(tp, ip, bma.cur, &bma.logflags,
                        whichfork);
@@ -5141,9 +5134,7 @@ xfs_bmap_del_extent_real(
         */
        if (do_fx && !(bflags & XFS_BMAPI_REMAP)) {
                if (xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) {
-                       error = xfs_refcount_decrease_extent(tp, del);
-                       if (error)
-                               goto done;
+                       xfs_refcount_decrease_extent(tp, del);
                } else {
                        __xfs_bmap_add_free(tp, del->br_startblock,
                                        del->br_blockcount, NULL,
index ea63c2d8523b38d44ff38e1835e5318358bf13f3..8b810a30e314ada0e3d4eee476b203c7a23435ac 100644 (file)
@@ -1172,7 +1172,7 @@ out_cur:
 /*
  * Record a refcount intent for later processing.
  */
-static int
+static void
 __xfs_refcount_add(
        struct xfs_trans                *tp,
        enum xfs_refcount_intent_type   type,
@@ -1194,37 +1194,36 @@ __xfs_refcount_add(
        ri->ri_blockcount = blockcount;
 
        xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_REFCOUNT, &ri->ri_list);
-       return 0;
 }
 
 /*
  * Increase the reference count of the blocks backing a file's extent.
  */
-int
+void
 xfs_refcount_increase_extent(
        struct xfs_trans                *tp,
        struct xfs_bmbt_irec            *PREV)
 {
        if (!xfs_sb_version_hasreflink(&tp->t_mountp->m_sb))
-               return 0;
+               return;
 
-       return __xfs_refcount_add(tp, XFS_REFCOUNT_INCREASE,
-                       PREV->br_startblock, PREV->br_blockcount);
+       __xfs_refcount_add(tp, XFS_REFCOUNT_INCREASE, PREV->br_startblock,
+                       PREV->br_blockcount);
 }
 
 /*
  * Decrease the reference count of the blocks backing a file's extent.
  */
-int
+void
 xfs_refcount_decrease_extent(
        struct xfs_trans                *tp,
        struct xfs_bmbt_irec            *PREV)
 {
        if (!xfs_sb_version_hasreflink(&tp->t_mountp->m_sb))
-               return 0;
+               return;
 
-       return __xfs_refcount_add(tp, XFS_REFCOUNT_DECREASE,
-                       PREV->br_startblock, PREV->br_blockcount);
+       __xfs_refcount_add(tp, XFS_REFCOUNT_DECREASE, PREV->br_startblock,
+                       PREV->br_blockcount);
 }
 
 /*
@@ -1539,30 +1538,26 @@ __xfs_refcount_cow_free(
 }
 
 /* Record a CoW staging extent in the refcount btree. */
-int
+void
 xfs_refcount_alloc_cow_extent(
        struct xfs_trans                *tp,
        xfs_fsblock_t                   fsb,
        xfs_extlen_t                    len)
 {
        struct xfs_mount                *mp = tp->t_mountp;
-       int                             error;
 
        if (!xfs_sb_version_hasreflink(&mp->m_sb))
-               return 0;
+               return;
 
-       error = __xfs_refcount_add(tp, XFS_REFCOUNT_ALLOC_COW, fsb, len);
-       if (error)
-               return error;
+       __xfs_refcount_add(tp, XFS_REFCOUNT_ALLOC_COW, fsb, len);
 
        /* Add rmap entry */
        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. */
-int
+void
 xfs_refcount_free_cow_extent(
        struct xfs_trans                *tp,
        xfs_fsblock_t                   fsb,
@@ -1571,12 +1566,12 @@ xfs_refcount_free_cow_extent(
        struct xfs_mount                *mp = tp->t_mountp;
 
        if (!xfs_sb_version_hasreflink(&mp->m_sb))
-               return 0;
+               return;
 
        /* Remove rmap entry */
        xfs_rmap_free_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
                        XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
-       return __xfs_refcount_add(tp, XFS_REFCOUNT_FREE_COW, fsb, len);
+       __xfs_refcount_add(tp, XFS_REFCOUNT_FREE_COW, fsb, len);
 }
 
 struct xfs_refcount_recovery {
@@ -1674,10 +1669,8 @@ xfs_refcount_recover_cow_leftovers(
                /* Free the orphan record */
                agbno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START;
                fsb = XFS_AGB_TO_FSB(mp, agno, agbno);
-               error = xfs_refcount_free_cow_extent(tp, fsb,
+               xfs_refcount_free_cow_extent(tp, fsb,
                                rr->rr_rrec.rc_blockcount);
-               if (error)
-                       goto out_trans;
 
                /* Free the block. */
                xfs_bmap_add_free(tp, fsb, rr->rr_rrec.rc_blockcount, NULL);
index 1d9c518575e7922e19b8d4e8de63fb3a55995e64..209795539c8dd012462e850fe721f5bca4888fea 100644 (file)
@@ -29,9 +29,9 @@ struct xfs_refcount_intent {
        xfs_extlen_t                            ri_blockcount;
 };
 
-extern int xfs_refcount_increase_extent(struct xfs_trans *tp,
+void xfs_refcount_increase_extent(struct xfs_trans *tp,
                struct xfs_bmbt_irec *irec);
-extern int xfs_refcount_decrease_extent(struct xfs_trans *tp,
+void xfs_refcount_decrease_extent(struct xfs_trans *tp,
                struct xfs_bmbt_irec *irec);
 
 extern void xfs_refcount_finish_one_cleanup(struct xfs_trans *tp,
@@ -45,10 +45,10 @@ extern int xfs_refcount_find_shared(struct xfs_btree_cur *cur,
                xfs_agblock_t agbno, xfs_extlen_t aglen, xfs_agblock_t *fbno,
                xfs_extlen_t *flen, bool find_end_of_shared);
 
-extern int xfs_refcount_alloc_cow_extent(struct xfs_trans *tp,
-               xfs_fsblock_t fsb, xfs_extlen_t len);
-extern int xfs_refcount_free_cow_extent(struct xfs_trans *tp,
-               xfs_fsblock_t fsb, xfs_extlen_t len);
+void xfs_refcount_alloc_cow_extent(struct xfs_trans *tp, xfs_fsblock_t fsb,
+               xfs_extlen_t len);
+void xfs_refcount_free_cow_extent(struct xfs_trans *tp, xfs_fsblock_t fsb,
+               xfs_extlen_t len);
 extern int xfs_refcount_recover_cow_leftovers(struct xfs_mount *mp,
                xfs_agnumber_t agno);