summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-07-19 15:26:31 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-07-23 12:08:00 -0400
commit0b04b6b875b32f2b32263ba46d54d001e05724f9 (patch)
tree584698190b272fbe00283d5b902eca1009a1e075
parent81b549aa626b650bbf00423c084c0fd5581169b9 (diff)
xfs: trivial xfs_btree_del_cursor cleanups
The error argument to xfs_btree_del_cursor already understands the "nonzero for error" semantics, so remove pointless error testing in the callers and pass it directly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c24
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.c2
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_refcount.c2
-rw-r--r--fs/xfs/libxfs/xfs_rmap.c18
-rw-r--r--fs/xfs/scrub/bmap.c5
-rw-r--r--fs/xfs/scrub/repair.c2
-rw-r--r--fs/xfs/xfs_discard.c2
-rw-r--r--fs/xfs/xfs_fsmap.c2
-rw-r--r--fs/xfs/xfs_itable.c6
-rw-r--r--fs/xfs/xfs_reflink.c2
12 files changed, 23 insertions, 46 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 7b93b1e16ad9..6bc0cdff488e 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -961,8 +961,7 @@ xfs_bmap_add_attrfork_extents(
961 XFS_DATA_FORK); 961 XFS_DATA_FORK);
962 if (cur) { 962 if (cur) {
963 cur->bc_private.b.allocated = 0; 963 cur->bc_private.b.allocated = 0;
964 xfs_btree_del_cursor(cur, 964 xfs_btree_del_cursor(cur, error);
965 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
966 } 965 }
967 return error; 966 return error;
968} 967}
@@ -4447,8 +4446,7 @@ error0:
4447 xfs_trans_log_inode(tp, ip, bma.logflags); 4446 xfs_trans_log_inode(tp, ip, bma.logflags);
4448 4447
4449 if (bma.cur) { 4448 if (bma.cur) {
4450 xfs_btree_del_cursor(bma.cur, 4449 xfs_btree_del_cursor(bma.cur, error);
4451 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
4452 } 4450 }
4453 if (!error) 4451 if (!error)
4454 xfs_bmap_validate_ret(orig_bno, orig_len, orig_flags, orig_mval, 4452 xfs_bmap_validate_ret(orig_bno, orig_len, orig_flags, orig_mval,
@@ -4542,10 +4540,8 @@ error0:
4542 4540
4543 if (logflags) 4541 if (logflags)
4544 xfs_trans_log_inode(tp, ip, logflags); 4542 xfs_trans_log_inode(tp, ip, logflags);
4545 if (cur) { 4543 if (cur)
4546 xfs_btree_del_cursor(cur, 4544 xfs_btree_del_cursor(cur, error);
4547 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
4548 }
4549 return error; 4545 return error;
4550} 4546}
4551 4547
@@ -5439,8 +5435,7 @@ error0:
5439 if (cur) { 5435 if (cur) {
5440 if (!error) 5436 if (!error)
5441 cur->bc_private.b.allocated = 0; 5437 cur->bc_private.b.allocated = 0;
5442 xfs_btree_del_cursor(cur, 5438 xfs_btree_del_cursor(cur, error);
5443 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
5444 } 5439 }
5445 return error; 5440 return error;
5446} 5441}
@@ -5700,8 +5695,7 @@ done:
5700 *next_fsb = got.br_startoff; 5695 *next_fsb = got.br_startoff;
5701del_cursor: 5696del_cursor:
5702 if (cur) 5697 if (cur)
5703 xfs_btree_del_cursor(cur, 5698 xfs_btree_del_cursor(cur, error);
5704 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
5705 if (logflags) 5699 if (logflags)
5706 xfs_trans_log_inode(tp, ip, logflags); 5700 xfs_trans_log_inode(tp, ip, logflags);
5707 return error; 5701 return error;
@@ -5828,8 +5822,7 @@ xfs_bmap_insert_extents(
5828 *next_fsb = got.br_startoff; 5822 *next_fsb = got.br_startoff;
5829del_cursor: 5823del_cursor:
5830 if (cur) 5824 if (cur)
5831 xfs_btree_del_cursor(cur, 5825 xfs_btree_del_cursor(cur, error);
5832 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
5833 if (logflags) 5826 if (logflags)
5834 xfs_trans_log_inode(tp, ip, logflags); 5827 xfs_trans_log_inode(tp, ip, logflags);
5835 return error; 5828 return error;
@@ -5945,8 +5938,7 @@ xfs_bmap_split_extent_at(
5945del_cursor: 5938del_cursor:
5946 if (cur) { 5939 if (cur) {
5947 cur->bc_private.b.allocated = 0; 5940 cur->bc_private.b.allocated = 0;
5948 xfs_btree_del_cursor(cur, 5941 xfs_btree_del_cursor(cur, error);
5949 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
5950 } 5942 }
5951 5943
5952 if (logflags) 5944 if (logflags)
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index 628ed82ca286..01489714a253 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -639,7 +639,7 @@ xfs_bmbt_change_owner(
639 cur->bc_private.b.flags |= XFS_BTCUR_BPRV_INVALID_OWNER; 639 cur->bc_private.b.flags |= XFS_BTCUR_BPRV_INVALID_OWNER;
640 640
641 error = xfs_btree_change_owner(cur, new_owner, buffer_list); 641 error = xfs_btree_change_owner(cur, new_owner, buffer_list);
642 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 642 xfs_btree_del_cursor(cur, error);
643 return error; 643 return error;
644} 644}
645 645
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 811d36afd024..295304ad1bc1 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2258,7 +2258,7 @@ xfs_imap_lookup(
2258 } 2258 }
2259 2259
2260 xfs_trans_brelse(tp, agbp); 2260 xfs_trans_brelse(tp, agbp);
2261 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 2261 xfs_btree_del_cursor(cur, error);
2262 if (error) 2262 if (error)
2263 return error; 2263 return error;
2264 2264
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index a5237afec5ab..735a33252eb2 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -566,7 +566,7 @@ xfs_inobt_count_blocks(
566 566
567 cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, btnum); 567 cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, btnum);
568 error = xfs_btree_count_blocks(cur, tree_blocks); 568 error = xfs_btree_count_blocks(cur, tree_blocks);
569 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 569 xfs_btree_del_cursor(cur, error);
570 xfs_buf_relse(agbp); 570 xfs_buf_relse(agbp);
571 571
572 return error; 572 return error;
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
index 2ecfb0518580..a2dfae67ade1 100644
--- a/fs/xfs/libxfs/xfs_refcount.c
+++ b/fs/xfs/libxfs/xfs_refcount.c
@@ -1067,7 +1067,7 @@ xfs_refcount_finish_one_cleanup(
1067 if (rcur == NULL) 1067 if (rcur == NULL)
1068 return; 1068 return;
1069 agbp = rcur->bc_private.a.agbp; 1069 agbp = rcur->bc_private.a.agbp;
1070 xfs_btree_del_cursor(rcur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 1070 xfs_btree_del_cursor(rcur, error);
1071 if (error) 1071 if (error)
1072 xfs_trans_brelse(tp, agbp); 1072 xfs_trans_brelse(tp, agbp);
1073} 1073}
diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index 8b2a2f81d110..fb266fa2cc45 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -670,14 +670,8 @@ xfs_rmap_free(
670 cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno); 670 cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
671 671
672 error = xfs_rmap_unmap(cur, bno, len, false, oinfo); 672 error = xfs_rmap_unmap(cur, bno, len, false, oinfo);
673 if (error)
674 goto out_error;
675 673
676 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 674 xfs_btree_del_cursor(cur, error);
677 return 0;
678
679out_error:
680 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
681 return error; 675 return error;
682} 676}
683 677
@@ -912,14 +906,8 @@ xfs_rmap_alloc(
912 906
913 cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno); 907 cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
914 error = xfs_rmap_map(cur, bno, len, false, oinfo); 908 error = xfs_rmap_map(cur, bno, len, false, oinfo);
915 if (error)
916 goto out_error;
917 909
918 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 910 xfs_btree_del_cursor(cur, error);
919 return 0;
920
921out_error:
922 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
923 return error; 911 return error;
924} 912}
925 913
@@ -2156,7 +2144,7 @@ xfs_rmap_finish_one_cleanup(
2156 if (rcur == NULL) 2144 if (rcur == NULL)
2157 return; 2145 return;
2158 agbp = rcur->bc_private.a.agbp; 2146 agbp = rcur->bc_private.a.agbp;
2159 xfs_btree_del_cursor(rcur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 2147 xfs_btree_del_cursor(rcur, error);
2160 if (error) 2148 if (error)
2161 xfs_trans_brelse(tp, agbp); 2149 xfs_trans_brelse(tp, agbp);
2162} 2150}
diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
index 3d08589f5c60..ebbfab173e97 100644
--- a/fs/xfs/scrub/bmap.c
+++ b/fs/xfs/scrub/bmap.c
@@ -404,8 +404,7 @@ xfs_scrub_bmap_btree(
404 cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork); 404 cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork);
405 xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork); 405 xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork);
406 error = xfs_scrub_btree(sc, cur, xfs_scrub_bmapbt_rec, &oinfo, info); 406 error = xfs_scrub_btree(sc, cur, xfs_scrub_bmapbt_rec, &oinfo, info);
407 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : 407 xfs_btree_del_cursor(cur, error);
408 XFS_BTREE_NOERROR);
409 return error; 408 return error;
410} 409}
411 410
@@ -514,7 +513,7 @@ xfs_scrub_bmap_check_ag_rmaps(
514 if (error == XFS_BTREE_QUERY_RANGE_ABORT) 513 if (error == XFS_BTREE_QUERY_RANGE_ABORT)
515 error = 0; 514 error = 0;
516 515
517 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 516 xfs_btree_del_cursor(cur, error);
518out_agf: 517out_agf:
519 xfs_trans_brelse(sc->tp, agf); 518 xfs_trans_brelse(sc->tp, agf);
520 return error; 519 return error;
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
index 326be4e8b71e..35c589a04fac 100644
--- a/fs/xfs/scrub/repair.c
+++ b/fs/xfs/scrub/repair.c
@@ -1009,7 +1009,7 @@ xfs_repair_find_ag_btree_roots(
1009 1009
1010 cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno); 1010 cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno);
1011 error = xfs_rmap_query_all(cur, xfs_repair_findroot_rmap, &ri); 1011 error = xfs_rmap_query_all(cur, xfs_repair_findroot_rmap, &ri);
1012 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 1012 xfs_btree_del_cursor(cur, error);
1013 1013
1014 return error; 1014 return error;
1015} 1015}
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 678a5fcd7576..93f07edafd81 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
@@ -128,7 +128,7 @@ next_extent:
128 } 128 }
129 129
130out_del_cursor: 130out_del_cursor:
131 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 131 xfs_btree_del_cursor(cur, error);
132 xfs_buf_relse(agbp); 132 xfs_buf_relse(agbp);
133out_put_perag: 133out_put_perag:
134 xfs_perag_put(pag); 134 xfs_perag_put(pag);
diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
index 297d7ce2901e..3d76a9e35870 100644
--- a/fs/xfs/xfs_fsmap.c
+++ b/fs/xfs/xfs_fsmap.c
@@ -219,7 +219,7 @@ xfs_getfsmap_is_shared(
219 error = xfs_refcount_find_shared(cur, rec->rm_startblock, 219 error = xfs_refcount_find_shared(cur, rec->rm_startblock,
220 rec->rm_blockcount, &fbno, &flen, false); 220 rec->rm_blockcount, &fbno, &flen, false);
221 221
222 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 222 xfs_btree_del_cursor(cur, error);
223 if (error) 223 if (error)
224 return error; 224 return error;
225 225
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 24f4f1c555b5..65810827a8d0 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -458,8 +458,7 @@ xfs_bulkstat(
458 * pending error, then we are done. 458 * pending error, then we are done.
459 */ 459 */
460del_cursor: 460del_cursor:
461 xfs_btree_del_cursor(cur, error ? 461 xfs_btree_del_cursor(cur, error);
462 XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
463 xfs_buf_relse(agbp); 462 xfs_buf_relse(agbp);
464 if (error) 463 if (error)
465 break; 464 break;
@@ -632,8 +631,7 @@ next_ag:
632 631
633 kmem_free(buffer); 632 kmem_free(buffer);
634 if (cur) 633 if (cur)
635 xfs_btree_del_cursor(cur, (error ? XFS_BTREE_ERROR : 634 xfs_btree_del_cursor(cur, error);
636 XFS_BTREE_NOERROR));
637 if (agbp) 635 if (agbp)
638 xfs_buf_relse(agbp); 636 xfs_buf_relse(agbp);
639 637
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 3143889097f1..406f79d44153 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -162,7 +162,7 @@ xfs_reflink_find_shared(
162 error = xfs_refcount_find_shared(cur, agbno, aglen, fbno, flen, 162 error = xfs_refcount_find_shared(cur, agbno, aglen, fbno, flen,
163 find_end_of_shared); 163 find_end_of_shared);
164 164
165 xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 165 xfs_btree_del_cursor(cur, error);
166 166
167 xfs_trans_brelse(tp, agbp); 167 xfs_trans_brelse(tp, agbp);
168 return error; 168 return error;