summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-08-26 20:06:04 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-08-28 11:31:02 -0400
commit74b4c5d4a9c073162a37d1c20c95cb33152ca474 (patch)
treef4826f364670d077ec72d9504fe578b2bd3df484
parentbc46ac64713f11c86cbbe11a86abd2a71274b15f (diff)
xfs: remove unnecessary int returns from deferred refcount functions
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>
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c21
-rw-r--r--fs/xfs/libxfs/xfs_refcount.c39
-rw-r--r--fs/xfs/libxfs/xfs_refcount.h12
-rw-r--r--fs/xfs/xfs_refcount_item.c10
-rw-r--r--fs/xfs/xfs_reflink.c15
5 files changed, 36 insertions, 61 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index e82a3ff345af..fca226ce78fc 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4393,12 +4393,9 @@ xfs_bmapi_write(
4393 * If this is a CoW allocation, record the data in 4393 * If this is a CoW allocation, record the data in
4394 * the refcount btree for orphan recovery. 4394 * the refcount btree for orphan recovery.
4395 */ 4395 */
4396 if (whichfork == XFS_COW_FORK) { 4396 if (whichfork == XFS_COW_FORK)
4397 error = xfs_refcount_alloc_cow_extent(tp, 4397 xfs_refcount_alloc_cow_extent(tp, bma.blkno,
4398 bma.blkno, bma.length); 4398 bma.length);
4399 if (error)
4400 goto error0;
4401 }
4402 } 4399 }
4403 4400
4404 /* Deal with the allocated space we found. */ 4401 /* Deal with the allocated space we found. */
@@ -4532,12 +4529,8 @@ xfs_bmapi_convert_delalloc(
4532 *imap = bma.got; 4529 *imap = bma.got;
4533 *seq = READ_ONCE(ifp->if_seq); 4530 *seq = READ_ONCE(ifp->if_seq);
4534 4531
4535 if (whichfork == XFS_COW_FORK) { 4532 if (whichfork == XFS_COW_FORK)
4536 error = xfs_refcount_alloc_cow_extent(tp, bma.blkno, 4533 xfs_refcount_alloc_cow_extent(tp, bma.blkno, bma.length);
4537 bma.length);
4538 if (error)
4539 goto out_finish;
4540 }
4541 4534
4542 error = xfs_bmap_btree_to_extents(tp, ip, bma.cur, &bma.logflags, 4535 error = xfs_bmap_btree_to_extents(tp, ip, bma.cur, &bma.logflags,
4543 whichfork); 4536 whichfork);
@@ -5148,9 +5141,7 @@ xfs_bmap_del_extent_real(
5148 */ 5141 */
5149 if (do_fx && !(bflags & XFS_BMAPI_REMAP)) { 5142 if (do_fx && !(bflags & XFS_BMAPI_REMAP)) {
5150 if (xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) { 5143 if (xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) {
5151 error = xfs_refcount_decrease_extent(tp, del); 5144 xfs_refcount_decrease_extent(tp, del);
5152 if (error)
5153 goto done;
5154 } else { 5145 } else {
5155 __xfs_bmap_add_free(tp, del->br_startblock, 5146 __xfs_bmap_add_free(tp, del->br_startblock,
5156 del->br_blockcount, NULL, 5147 del->br_blockcount, NULL,
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
index a5edac834843..9a7fadb1361c 100644
--- a/fs/xfs/libxfs/xfs_refcount.c
+++ b/fs/xfs/libxfs/xfs_refcount.c
@@ -1174,7 +1174,7 @@ out_cur:
1174/* 1174/*
1175 * Record a refcount intent for later processing. 1175 * Record a refcount intent for later processing.
1176 */ 1176 */
1177static int 1177static void
1178__xfs_refcount_add( 1178__xfs_refcount_add(
1179 struct xfs_trans *tp, 1179 struct xfs_trans *tp,
1180 enum xfs_refcount_intent_type type, 1180 enum xfs_refcount_intent_type type,
@@ -1196,37 +1196,36 @@ __xfs_refcount_add(
1196 ri->ri_blockcount = blockcount; 1196 ri->ri_blockcount = blockcount;
1197 1197
1198 xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_REFCOUNT, &ri->ri_list); 1198 xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_REFCOUNT, &ri->ri_list);
1199 return 0;
1200} 1199}
1201 1200
1202/* 1201/*
1203 * Increase the reference count of the blocks backing a file's extent. 1202 * Increase the reference count of the blocks backing a file's extent.
1204 */ 1203 */
1205int 1204void
1206xfs_refcount_increase_extent( 1205xfs_refcount_increase_extent(
1207 struct xfs_trans *tp, 1206 struct xfs_trans *tp,
1208 struct xfs_bmbt_irec *PREV) 1207 struct xfs_bmbt_irec *PREV)
1209{ 1208{
1210 if (!xfs_sb_version_hasreflink(&tp->t_mountp->m_sb)) 1209 if (!xfs_sb_version_hasreflink(&tp->t_mountp->m_sb))
1211 return 0; 1210 return;
1212 1211
1213 return __xfs_refcount_add(tp, XFS_REFCOUNT_INCREASE, 1212 __xfs_refcount_add(tp, XFS_REFCOUNT_INCREASE, PREV->br_startblock,
1214 PREV->br_startblock, PREV->br_blockcount); 1213 PREV->br_blockcount);
1215} 1214}
1216 1215
1217/* 1216/*
1218 * Decrease the reference count of the blocks backing a file's extent. 1217 * Decrease the reference count of the blocks backing a file's extent.
1219 */ 1218 */
1220int 1219void
1221xfs_refcount_decrease_extent( 1220xfs_refcount_decrease_extent(
1222 struct xfs_trans *tp, 1221 struct xfs_trans *tp,
1223 struct xfs_bmbt_irec *PREV) 1222 struct xfs_bmbt_irec *PREV)
1224{ 1223{
1225 if (!xfs_sb_version_hasreflink(&tp->t_mountp->m_sb)) 1224 if (!xfs_sb_version_hasreflink(&tp->t_mountp->m_sb))
1226 return 0; 1225 return;
1227 1226
1228 return __xfs_refcount_add(tp, XFS_REFCOUNT_DECREASE, 1227 __xfs_refcount_add(tp, XFS_REFCOUNT_DECREASE, PREV->br_startblock,
1229 PREV->br_startblock, PREV->br_blockcount); 1228 PREV->br_blockcount);
1230} 1229}
1231 1230
1232/* 1231/*
@@ -1541,30 +1540,26 @@ __xfs_refcount_cow_free(
1541} 1540}
1542 1541
1543/* Record a CoW staging extent in the refcount btree. */ 1542/* Record a CoW staging extent in the refcount btree. */
1544int 1543void
1545xfs_refcount_alloc_cow_extent( 1544xfs_refcount_alloc_cow_extent(
1546 struct xfs_trans *tp, 1545 struct xfs_trans *tp,
1547 xfs_fsblock_t fsb, 1546 xfs_fsblock_t fsb,
1548 xfs_extlen_t len) 1547 xfs_extlen_t len)
1549{ 1548{
1550 struct xfs_mount *mp = tp->t_mountp; 1549 struct xfs_mount *mp = tp->t_mountp;
1551 int error;
1552 1550
1553 if (!xfs_sb_version_hasreflink(&mp->m_sb)) 1551 if (!xfs_sb_version_hasreflink(&mp->m_sb))
1554 return 0; 1552 return;
1555 1553
1556 error = __xfs_refcount_add(tp, XFS_REFCOUNT_ALLOC_COW, fsb, len); 1554 __xfs_refcount_add(tp, XFS_REFCOUNT_ALLOC_COW, fsb, len);
1557 if (error)
1558 return error;
1559 1555
1560 /* Add rmap entry */ 1556 /* Add rmap entry */
1561 xfs_rmap_alloc_extent(tp, XFS_FSB_TO_AGNO(mp, fsb), 1557 xfs_rmap_alloc_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
1562 XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW); 1558 XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
1563 return 0;
1564} 1559}
1565 1560
1566/* Forget a CoW staging event in the refcount btree. */ 1561/* Forget a CoW staging event in the refcount btree. */
1567int 1562void
1568xfs_refcount_free_cow_extent( 1563xfs_refcount_free_cow_extent(
1569 struct xfs_trans *tp, 1564 struct xfs_trans *tp,
1570 xfs_fsblock_t fsb, 1565 xfs_fsblock_t fsb,
@@ -1573,12 +1568,12 @@ xfs_refcount_free_cow_extent(
1573 struct xfs_mount *mp = tp->t_mountp; 1568 struct xfs_mount *mp = tp->t_mountp;
1574 1569
1575 if (!xfs_sb_version_hasreflink(&mp->m_sb)) 1570 if (!xfs_sb_version_hasreflink(&mp->m_sb))
1576 return 0; 1571 return;
1577 1572
1578 /* Remove rmap entry */ 1573 /* Remove rmap entry */
1579 xfs_rmap_free_extent(tp, XFS_FSB_TO_AGNO(mp, fsb), 1574 xfs_rmap_free_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
1580 XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW); 1575 XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
1581 return __xfs_refcount_add(tp, XFS_REFCOUNT_FREE_COW, fsb, len); 1576 __xfs_refcount_add(tp, XFS_REFCOUNT_FREE_COW, fsb, len);
1582} 1577}
1583 1578
1584struct xfs_refcount_recovery { 1579struct xfs_refcount_recovery {
@@ -1676,10 +1671,8 @@ xfs_refcount_recover_cow_leftovers(
1676 /* Free the orphan record */ 1671 /* Free the orphan record */
1677 agbno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START; 1672 agbno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START;
1678 fsb = XFS_AGB_TO_FSB(mp, agno, agbno); 1673 fsb = XFS_AGB_TO_FSB(mp, agno, agbno);
1679 error = xfs_refcount_free_cow_extent(tp, fsb, 1674 xfs_refcount_free_cow_extent(tp, fsb,
1680 rr->rr_rrec.rc_blockcount); 1675 rr->rr_rrec.rc_blockcount);
1681 if (error)
1682 goto out_trans;
1683 1676
1684 /* Free the block. */ 1677 /* Free the block. */
1685 xfs_bmap_add_free(tp, fsb, rr->rr_rrec.rc_blockcount, NULL); 1678 xfs_bmap_add_free(tp, fsb, rr->rr_rrec.rc_blockcount, NULL);
diff --git a/fs/xfs/libxfs/xfs_refcount.h b/fs/xfs/libxfs/xfs_refcount.h
index 1d9c518575e7..209795539c8d 100644
--- a/fs/xfs/libxfs/xfs_refcount.h
+++ b/fs/xfs/libxfs/xfs_refcount.h
@@ -29,9 +29,9 @@ struct xfs_refcount_intent {
29 xfs_extlen_t ri_blockcount; 29 xfs_extlen_t ri_blockcount;
30}; 30};
31 31
32extern int xfs_refcount_increase_extent(struct xfs_trans *tp, 32void xfs_refcount_increase_extent(struct xfs_trans *tp,
33 struct xfs_bmbt_irec *irec); 33 struct xfs_bmbt_irec *irec);
34extern int xfs_refcount_decrease_extent(struct xfs_trans *tp, 34void xfs_refcount_decrease_extent(struct xfs_trans *tp,
35 struct xfs_bmbt_irec *irec); 35 struct xfs_bmbt_irec *irec);
36 36
37extern void xfs_refcount_finish_one_cleanup(struct xfs_trans *tp, 37extern 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,
45 xfs_agblock_t agbno, xfs_extlen_t aglen, xfs_agblock_t *fbno, 45 xfs_agblock_t agbno, xfs_extlen_t aglen, xfs_agblock_t *fbno,
46 xfs_extlen_t *flen, bool find_end_of_shared); 46 xfs_extlen_t *flen, bool find_end_of_shared);
47 47
48extern int xfs_refcount_alloc_cow_extent(struct xfs_trans *tp, 48void xfs_refcount_alloc_cow_extent(struct xfs_trans *tp, xfs_fsblock_t fsb,
49 xfs_fsblock_t fsb, xfs_extlen_t len); 49 xfs_extlen_t len);
50extern int xfs_refcount_free_cow_extent(struct xfs_trans *tp, 50void xfs_refcount_free_cow_extent(struct xfs_trans *tp, xfs_fsblock_t fsb,
51 xfs_fsblock_t fsb, xfs_extlen_t len); 51 xfs_extlen_t len);
52extern int xfs_refcount_recover_cow_leftovers(struct xfs_mount *mp, 52extern int xfs_refcount_recover_cow_leftovers(struct xfs_mount *mp,
53 xfs_agnumber_t agno); 53 xfs_agnumber_t agno);
54 54
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index db0e0d7cffb7..2328268e6245 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -555,26 +555,24 @@ xfs_cui_recover(
555 irec.br_blockcount = new_len; 555 irec.br_blockcount = new_len;
556 switch (type) { 556 switch (type) {
557 case XFS_REFCOUNT_INCREASE: 557 case XFS_REFCOUNT_INCREASE:
558 error = xfs_refcount_increase_extent(tp, &irec); 558 xfs_refcount_increase_extent(tp, &irec);
559 break; 559 break;
560 case XFS_REFCOUNT_DECREASE: 560 case XFS_REFCOUNT_DECREASE:
561 error = xfs_refcount_decrease_extent(tp, &irec); 561 xfs_refcount_decrease_extent(tp, &irec);
562 break; 562 break;
563 case XFS_REFCOUNT_ALLOC_COW: 563 case XFS_REFCOUNT_ALLOC_COW:
564 error = xfs_refcount_alloc_cow_extent(tp, 564 xfs_refcount_alloc_cow_extent(tp,
565 irec.br_startblock, 565 irec.br_startblock,
566 irec.br_blockcount); 566 irec.br_blockcount);
567 break; 567 break;
568 case XFS_REFCOUNT_FREE_COW: 568 case XFS_REFCOUNT_FREE_COW:
569 error = xfs_refcount_free_cow_extent(tp, 569 xfs_refcount_free_cow_extent(tp,
570 irec.br_startblock, 570 irec.br_startblock,
571 irec.br_blockcount); 571 irec.br_blockcount);
572 break; 572 break;
573 default: 573 default:
574 ASSERT(0); 574 ASSERT(0);
575 } 575 }
576 if (error)
577 goto abort_error;
578 requeue_only = true; 576 requeue_only = true;
579 } 577 }
580 } 578 }
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index edbe37b7f636..eae128ea0c12 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -495,10 +495,8 @@ xfs_reflink_cancel_cow_blocks(
495 ASSERT((*tpp)->t_firstblock == NULLFSBLOCK); 495 ASSERT((*tpp)->t_firstblock == NULLFSBLOCK);
496 496
497 /* Free the CoW orphan record. */ 497 /* Free the CoW orphan record. */
498 error = xfs_refcount_free_cow_extent(*tpp, 498 xfs_refcount_free_cow_extent(*tpp, del.br_startblock,
499 del.br_startblock, del.br_blockcount); 499 del.br_blockcount);
500 if (error)
501 break;
502 500
503 xfs_bmap_add_free(*tpp, del.br_startblock, 501 xfs_bmap_add_free(*tpp, del.br_startblock,
504 del.br_blockcount, NULL); 502 del.br_blockcount, NULL);
@@ -675,10 +673,7 @@ xfs_reflink_end_cow_extent(
675 trace_xfs_reflink_cow_remap(ip, &del); 673 trace_xfs_reflink_cow_remap(ip, &del);
676 674
677 /* Free the CoW orphan record. */ 675 /* Free the CoW orphan record. */
678 error = xfs_refcount_free_cow_extent(tp, del.br_startblock, 676 xfs_refcount_free_cow_extent(tp, del.br_startblock, del.br_blockcount);
679 del.br_blockcount);
680 if (error)
681 goto out_cancel;
682 677
683 /* Map the new blocks into the data fork. */ 678 /* Map the new blocks into the data fork. */
684 error = xfs_bmap_map_extent(tp, ip, &del); 679 error = xfs_bmap_map_extent(tp, ip, &del);
@@ -1070,9 +1065,7 @@ xfs_reflink_remap_extent(
1070 uirec.br_blockcount, uirec.br_startblock); 1065 uirec.br_blockcount, uirec.br_startblock);
1071 1066
1072 /* Update the refcount tree */ 1067 /* Update the refcount tree */
1073 error = xfs_refcount_increase_extent(tp, &uirec); 1068 xfs_refcount_increase_extent(tp, &uirec);
1074 if (error)
1075 goto out_cancel;
1076 1069
1077 /* Map the new blocks into the data fork. */ 1070 /* Map the new blocks into the data fork. */
1078 error = xfs_bmap_map_extent(tp, ip, &uirec); 1071 error = xfs_bmap_map_extent(tp, ip, &uirec);