aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_bmap.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-06-25 00:58:08 -0400
committerDave Chinner <david@fromorbit.com>2014-06-25 00:58:08 -0400
commit2451337dd043901b5270b7586942abe564443e3d (patch)
tree5f2a59b2c829dbb942c18315ffc0edfed0d3790a /fs/xfs/libxfs/xfs_bmap.c
parent30f712c9dd69348aa51351d5cb6d366bf4fae31d (diff)
xfs: global error sign conversion
Convert all the errors the core XFs code to negative error signs like the rest of the kernel and remove all the sign conversion we do in the interface layers. Errors for conversion (and comparison) found via searches like: $ git grep " E" fs/xfs $ git grep "return E" fs/xfs $ git grep " E[A-Z].*;$" fs/xfs Negation points found via searches like: $ git grep "= -[a-z,A-Z]" fs/xfs $ git grep "return -[a-z,A-D,F-Z]" fs/xfs $ git grep " -[a-z].*;" fs/xfs [ with some bits I missed from Brian Foster ] Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.c')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index b44d63189dab..72a110eb1dda 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1033,7 +1033,7 @@ xfs_bmap_add_attrfork_btree(
1033 goto error0; 1033 goto error0;
1034 if (stat == 0) { 1034 if (stat == 0) {
1035 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 1035 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
1036 return ENOSPC; 1036 return -ENOSPC;
1037 } 1037 }
1038 *firstblock = cur->bc_private.b.firstblock; 1038 *firstblock = cur->bc_private.b.firstblock;
1039 cur->bc_private.b.allocated = 0; 1039 cur->bc_private.b.allocated = 0;
@@ -1115,7 +1115,7 @@ xfs_bmap_add_attrfork_local(
1115 1115
1116 /* should only be called for types that support local format data */ 1116 /* should only be called for types that support local format data */
1117 ASSERT(0); 1117 ASSERT(0);
1118 return EFSCORRUPTED; 1118 return -EFSCORRUPTED;
1119} 1119}
1120 1120
1121/* 1121/*
@@ -1192,7 +1192,7 @@ xfs_bmap_add_attrfork(
1192 break; 1192 break;
1193 default: 1193 default:
1194 ASSERT(0); 1194 ASSERT(0);
1195 error = EINVAL; 1195 error = -EINVAL;
1196 goto trans_cancel; 1196 goto trans_cancel;
1197 } 1197 }
1198 1198
@@ -1399,7 +1399,7 @@ xfs_bmap_read_extents(
1399 return 0; 1399 return 0;
1400error0: 1400error0:
1401 xfs_trans_brelse(tp, bp); 1401 xfs_trans_brelse(tp, bp);
1402 return EFSCORRUPTED; 1402 return -EFSCORRUPTED;
1403} 1403}
1404 1404
1405 1405
@@ -1576,7 +1576,7 @@ xfs_bmap_last_before(
1576 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && 1576 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
1577 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && 1577 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
1578 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL) 1578 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL)
1579 return EIO; 1579 return -EIO;
1580 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { 1580 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) {
1581 *last_block = 0; 1581 *last_block = 0;
1582 return 0; 1582 return 0;
@@ -1690,7 +1690,7 @@ xfs_bmap_last_offset(
1690 1690
1691 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && 1691 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
1692 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) 1692 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS)
1693 return EIO; 1693 return -EIO;
1694 1694
1695 error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty); 1695 error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty);
1696 if (error || is_empty) 1696 if (error || is_empty)
@@ -3323,7 +3323,7 @@ xfs_bmap_extsize_align(
3323 if (orig_off < align_off || 3323 if (orig_off < align_off ||
3324 orig_end > align_off + align_alen || 3324 orig_end > align_off + align_alen ||
3325 align_alen - temp < orig_alen) 3325 align_alen - temp < orig_alen)
3326 return EINVAL; 3326 return -EINVAL;
3327 /* 3327 /*
3328 * Try to fix it by moving the start up. 3328 * Try to fix it by moving the start up.
3329 */ 3329 */
@@ -3348,7 +3348,7 @@ xfs_bmap_extsize_align(
3348 * Result doesn't cover the request, fail it. 3348 * Result doesn't cover the request, fail it.
3349 */ 3349 */
3350 if (orig_off < align_off || orig_end > align_off + align_alen) 3350 if (orig_off < align_off || orig_end > align_off + align_alen)
3351 return EINVAL; 3351 return -EINVAL;
3352 } else { 3352 } else {
3353 ASSERT(orig_off >= align_off); 3353 ASSERT(orig_off >= align_off);
3354 ASSERT(orig_end <= align_off + align_alen); 3354 ASSERT(orig_end <= align_off + align_alen);
@@ -4051,11 +4051,11 @@ xfs_bmapi_read(
4051 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), 4051 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
4052 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 4052 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
4053 XFS_ERROR_REPORT("xfs_bmapi_read", XFS_ERRLEVEL_LOW, mp); 4053 XFS_ERROR_REPORT("xfs_bmapi_read", XFS_ERRLEVEL_LOW, mp);
4054 return EFSCORRUPTED; 4054 return -EFSCORRUPTED;
4055 } 4055 }
4056 4056
4057 if (XFS_FORCED_SHUTDOWN(mp)) 4057 if (XFS_FORCED_SHUTDOWN(mp))
4058 return EIO; 4058 return -EIO;
4059 4059
4060 XFS_STATS_INC(xs_blk_mapr); 4060 XFS_STATS_INC(xs_blk_mapr);
4061 4061
@@ -4246,11 +4246,11 @@ xfs_bmapi_delay(
4246 XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_BTREE), 4246 XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_BTREE),
4247 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 4247 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
4248 XFS_ERROR_REPORT("xfs_bmapi_delay", XFS_ERRLEVEL_LOW, mp); 4248 XFS_ERROR_REPORT("xfs_bmapi_delay", XFS_ERRLEVEL_LOW, mp);
4249 return EFSCORRUPTED; 4249 return -EFSCORRUPTED;
4250 } 4250 }
4251 4251
4252 if (XFS_FORCED_SHUTDOWN(mp)) 4252 if (XFS_FORCED_SHUTDOWN(mp))
4253 return EIO; 4253 return -EIO;
4254 4254
4255 XFS_STATS_INC(xs_blk_mapw); 4255 XFS_STATS_INC(xs_blk_mapw);
4256 4256
@@ -4469,7 +4469,7 @@ xfs_bmapi_convert_unwritten(
4469 * so generate another request. 4469 * so generate another request.
4470 */ 4470 */
4471 if (mval->br_blockcount < len) 4471 if (mval->br_blockcount < len)
4472 return EAGAIN; 4472 return -EAGAIN;
4473 return 0; 4473 return 0;
4474} 4474}
4475 4475
@@ -4540,11 +4540,11 @@ xfs_bmapi_write(
4540 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), 4540 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
4541 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 4541 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
4542 XFS_ERROR_REPORT("xfs_bmapi_write", XFS_ERRLEVEL_LOW, mp); 4542 XFS_ERROR_REPORT("xfs_bmapi_write", XFS_ERRLEVEL_LOW, mp);
4543 return EFSCORRUPTED; 4543 return -EFSCORRUPTED;
4544 } 4544 }
4545 4545
4546 if (XFS_FORCED_SHUTDOWN(mp)) 4546 if (XFS_FORCED_SHUTDOWN(mp))
4547 return EIO; 4547 return -EIO;
4548 4548
4549 ifp = XFS_IFORK_PTR(ip, whichfork); 4549 ifp = XFS_IFORK_PTR(ip, whichfork);
4550 4550
@@ -4623,7 +4623,7 @@ xfs_bmapi_write(
4623 4623
4624 /* Execute unwritten extent conversion if necessary */ 4624 /* Execute unwritten extent conversion if necessary */
4625 error = xfs_bmapi_convert_unwritten(&bma, mval, len, flags); 4625 error = xfs_bmapi_convert_unwritten(&bma, mval, len, flags);
4626 if (error == EAGAIN) 4626 if (error == -EAGAIN)
4627 continue; 4627 continue;
4628 if (error) 4628 if (error)
4629 goto error0; 4629 goto error0;
@@ -4925,7 +4925,7 @@ xfs_bmap_del_extent(
4925 goto done; 4925 goto done;
4926 cur->bc_rec.b = new; 4926 cur->bc_rec.b = new;
4927 error = xfs_btree_insert(cur, &i); 4927 error = xfs_btree_insert(cur, &i);
4928 if (error && error != ENOSPC) 4928 if (error && error != -ENOSPC)
4929 goto done; 4929 goto done;
4930 /* 4930 /*
4931 * If get no-space back from btree insert, 4931 * If get no-space back from btree insert,
@@ -4933,7 +4933,7 @@ xfs_bmap_del_extent(
4933 * block reservation. 4933 * block reservation.
4934 * Fix up our state and return the error. 4934 * Fix up our state and return the error.
4935 */ 4935 */
4936 if (error == ENOSPC) { 4936 if (error == -ENOSPC) {
4937 /* 4937 /*
4938 * Reset the cursor, don't trust 4938 * Reset the cursor, don't trust
4939 * it after any insert operation. 4939 * it after any insert operation.
@@ -4961,7 +4961,7 @@ xfs_bmap_del_extent(
4961 xfs_bmbt_set_blockcount(ep, 4961 xfs_bmbt_set_blockcount(ep,
4962 got.br_blockcount); 4962 got.br_blockcount);
4963 flags = 0; 4963 flags = 0;
4964 error = ENOSPC; 4964 error = -ENOSPC;
4965 goto done; 4965 goto done;
4966 } 4966 }
4967 XFS_WANT_CORRUPTED_GOTO(i == 1, done); 4967 XFS_WANT_CORRUPTED_GOTO(i == 1, done);
@@ -5079,11 +5079,11 @@ xfs_bunmapi(
5079 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { 5079 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
5080 XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW, 5080 XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW,
5081 ip->i_mount); 5081 ip->i_mount);
5082 return EFSCORRUPTED; 5082 return -EFSCORRUPTED;
5083 } 5083 }
5084 mp = ip->i_mount; 5084 mp = ip->i_mount;
5085 if (XFS_FORCED_SHUTDOWN(mp)) 5085 if (XFS_FORCED_SHUTDOWN(mp))
5086 return EIO; 5086 return -EIO;
5087 5087
5088 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 5088 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
5089 ASSERT(len > 0); 5089 ASSERT(len > 0);
@@ -5328,7 +5328,7 @@ xfs_bunmapi(
5328 del.br_startoff > got.br_startoff && 5328 del.br_startoff > got.br_startoff &&
5329 del.br_startoff + del.br_blockcount < 5329 del.br_startoff + del.br_blockcount <
5330 got.br_startoff + got.br_blockcount) { 5330 got.br_startoff + got.br_blockcount) {
5331 error = ENOSPC; 5331 error = -ENOSPC;
5332 goto error0; 5332 goto error0;
5333 } 5333 }
5334 error = xfs_bmap_del_extent(ip, tp, &lastx, flist, cur, &del, 5334 error = xfs_bmap_del_extent(ip, tp, &lastx, flist, cur, &del,
@@ -5452,11 +5452,11 @@ xfs_bmap_shift_extents(
5452 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 5452 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
5453 XFS_ERROR_REPORT("xfs_bmap_shift_extents", 5453 XFS_ERROR_REPORT("xfs_bmap_shift_extents",
5454 XFS_ERRLEVEL_LOW, mp); 5454 XFS_ERRLEVEL_LOW, mp);
5455 return EFSCORRUPTED; 5455 return -EFSCORRUPTED;
5456 } 5456 }
5457 5457
5458 if (XFS_FORCED_SHUTDOWN(mp)) 5458 if (XFS_FORCED_SHUTDOWN(mp))
5459 return EIO; 5459 return -EIO;
5460 5460
5461 ASSERT(current_ext != NULL); 5461 ASSERT(current_ext != NULL);
5462 5462
@@ -5519,14 +5519,14 @@ xfs_bmap_shift_extents(
5519 *current_ext - 1), &left); 5519 *current_ext - 1), &left);
5520 5520
5521 if (startoff < left.br_startoff + left.br_blockcount) 5521 if (startoff < left.br_startoff + left.br_blockcount)
5522 error = EINVAL; 5522 error = -EINVAL;
5523 } else if (offset_shift_fsb > got.br_startoff) { 5523 } else if (offset_shift_fsb > got.br_startoff) {
5524 /* 5524 /*
5525 * When first extent is shifted, offset_shift_fsb 5525 * When first extent is shifted, offset_shift_fsb
5526 * should be less than the stating offset of 5526 * should be less than the stating offset of
5527 * the first extent. 5527 * the first extent.
5528 */ 5528 */
5529 error = EINVAL; 5529 error = -EINVAL;
5530 } 5530 }
5531 5531
5532 if (error) 5532 if (error)