aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_da_btree.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_da_btree.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_da_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index a1a4e3e47a1e..8d809873525b 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -185,7 +185,7 @@ xfs_da3_node_write_verify(
185 struct xfs_da3_node_hdr *hdr3 = bp->b_addr; 185 struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
186 186
187 if (!xfs_da3_node_verify(bp)) { 187 if (!xfs_da3_node_verify(bp)) {
188 xfs_buf_ioerror(bp, EFSCORRUPTED); 188 xfs_buf_ioerror(bp, -EFSCORRUPTED);
189 xfs_verifier_error(bp); 189 xfs_verifier_error(bp);
190 return; 190 return;
191 } 191 }
@@ -214,13 +214,13 @@ xfs_da3_node_read_verify(
214 switch (be16_to_cpu(info->magic)) { 214 switch (be16_to_cpu(info->magic)) {
215 case XFS_DA3_NODE_MAGIC: 215 case XFS_DA3_NODE_MAGIC:
216 if (!xfs_buf_verify_cksum(bp, XFS_DA3_NODE_CRC_OFF)) { 216 if (!xfs_buf_verify_cksum(bp, XFS_DA3_NODE_CRC_OFF)) {
217 xfs_buf_ioerror(bp, EFSBADCRC); 217 xfs_buf_ioerror(bp, -EFSBADCRC);
218 break; 218 break;
219 } 219 }
220 /* fall through */ 220 /* fall through */
221 case XFS_DA_NODE_MAGIC: 221 case XFS_DA_NODE_MAGIC:
222 if (!xfs_da3_node_verify(bp)) { 222 if (!xfs_da3_node_verify(bp)) {
223 xfs_buf_ioerror(bp, EFSCORRUPTED); 223 xfs_buf_ioerror(bp, -EFSCORRUPTED);
224 break; 224 break;
225 } 225 }
226 return; 226 return;
@@ -385,7 +385,7 @@ xfs_da3_split(
385 switch (oldblk->magic) { 385 switch (oldblk->magic) {
386 case XFS_ATTR_LEAF_MAGIC: 386 case XFS_ATTR_LEAF_MAGIC:
387 error = xfs_attr3_leaf_split(state, oldblk, newblk); 387 error = xfs_attr3_leaf_split(state, oldblk, newblk);
388 if ((error != 0) && (error != ENOSPC)) { 388 if ((error != 0) && (error != -ENOSPC)) {
389 return error; /* GROT: attr is inconsistent */ 389 return error; /* GROT: attr is inconsistent */
390 } 390 }
391 if (!error) { 391 if (!error) {
@@ -1579,9 +1579,9 @@ xfs_da3_node_lookup_int(
1579 args->blkno = blk->blkno; 1579 args->blkno = blk->blkno;
1580 } else { 1580 } else {
1581 ASSERT(0); 1581 ASSERT(0);
1582 return EFSCORRUPTED; 1582 return -EFSCORRUPTED;
1583 } 1583 }
1584 if (((retval == ENOENT) || (retval == ENOATTR)) && 1584 if (((retval == -ENOENT) || (retval == -ENOATTR)) &&
1585 (blk->hashval == args->hashval)) { 1585 (blk->hashval == args->hashval)) {
1586 error = xfs_da3_path_shift(state, &state->path, 1, 1, 1586 error = xfs_da3_path_shift(state, &state->path, 1, 1,
1587 &retval); 1587 &retval);
@@ -1591,7 +1591,7 @@ xfs_da3_node_lookup_int(
1591 continue; 1591 continue;
1592 } else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { 1592 } else if (blk->magic == XFS_ATTR_LEAF_MAGIC) {
1593 /* path_shift() gives ENOENT */ 1593 /* path_shift() gives ENOENT */
1594 retval = ENOATTR; 1594 retval = -ENOATTR;
1595 } 1595 }
1596 } 1596 }
1597 break; 1597 break;
@@ -1859,7 +1859,7 @@ xfs_da3_path_shift(
1859 } 1859 }
1860 } 1860 }
1861 if (level < 0) { 1861 if (level < 0) {
1862 *result = ENOENT; /* we're out of our tree */ 1862 *result = -ENOENT; /* we're out of our tree */
1863 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); 1863 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
1864 return 0; 1864 return 0;
1865 } 1865 }
@@ -2068,7 +2068,7 @@ xfs_da_grow_inode_int(
2068 if (got != count || mapp[0].br_startoff != *bno || 2068 if (got != count || mapp[0].br_startoff != *bno ||
2069 mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount != 2069 mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount !=
2070 *bno + count) { 2070 *bno + count) {
2071 error = ENOSPC; 2071 error = -ENOSPC;
2072 goto out_free_map; 2072 goto out_free_map;
2073 } 2073 }
2074 2074
@@ -2158,7 +2158,7 @@ xfs_da3_swap_lastblock(
2158 if (unlikely(lastoff == 0)) { 2158 if (unlikely(lastoff == 0)) {
2159 XFS_ERROR_REPORT("xfs_da_swap_lastblock(1)", XFS_ERRLEVEL_LOW, 2159 XFS_ERROR_REPORT("xfs_da_swap_lastblock(1)", XFS_ERRLEVEL_LOW,
2160 mp); 2160 mp);
2161 return EFSCORRUPTED; 2161 return -EFSCORRUPTED;
2162 } 2162 }
2163 /* 2163 /*
2164 * Read the last block in the btree space. 2164 * Read the last block in the btree space.
@@ -2209,7 +2209,7 @@ xfs_da3_swap_lastblock(
2209 sib_info->magic != dead_info->magic)) { 2209 sib_info->magic != dead_info->magic)) {
2210 XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)", 2210 XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)",
2211 XFS_ERRLEVEL_LOW, mp); 2211 XFS_ERRLEVEL_LOW, mp);
2212 error = EFSCORRUPTED; 2212 error = -EFSCORRUPTED;
2213 goto done; 2213 goto done;
2214 } 2214 }
2215 sib_info->forw = cpu_to_be32(dead_blkno); 2215 sib_info->forw = cpu_to_be32(dead_blkno);
@@ -2231,7 +2231,7 @@ xfs_da3_swap_lastblock(
2231 sib_info->magic != dead_info->magic)) { 2231 sib_info->magic != dead_info->magic)) {
2232 XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)", 2232 XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)",
2233 XFS_ERRLEVEL_LOW, mp); 2233 XFS_ERRLEVEL_LOW, mp);
2234 error = EFSCORRUPTED; 2234 error = -EFSCORRUPTED;
2235 goto done; 2235 goto done;
2236 } 2236 }
2237 sib_info->back = cpu_to_be32(dead_blkno); 2237 sib_info->back = cpu_to_be32(dead_blkno);
@@ -2254,7 +2254,7 @@ xfs_da3_swap_lastblock(
2254 if (level >= 0 && level != par_hdr.level + 1) { 2254 if (level >= 0 && level != par_hdr.level + 1) {
2255 XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", 2255 XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)",
2256 XFS_ERRLEVEL_LOW, mp); 2256 XFS_ERRLEVEL_LOW, mp);
2257 error = EFSCORRUPTED; 2257 error = -EFSCORRUPTED;
2258 goto done; 2258 goto done;
2259 } 2259 }
2260 level = par_hdr.level; 2260 level = par_hdr.level;
@@ -2267,7 +2267,7 @@ xfs_da3_swap_lastblock(
2267 if (entno == par_hdr.count) { 2267 if (entno == par_hdr.count) {
2268 XFS_ERROR_REPORT("xfs_da_swap_lastblock(5)", 2268 XFS_ERROR_REPORT("xfs_da_swap_lastblock(5)",
2269 XFS_ERRLEVEL_LOW, mp); 2269 XFS_ERRLEVEL_LOW, mp);
2270 error = EFSCORRUPTED; 2270 error = -EFSCORRUPTED;
2271 goto done; 2271 goto done;
2272 } 2272 }
2273 par_blkno = be32_to_cpu(btree[entno].before); 2273 par_blkno = be32_to_cpu(btree[entno].before);
@@ -2294,7 +2294,7 @@ xfs_da3_swap_lastblock(
2294 if (unlikely(par_blkno == 0)) { 2294 if (unlikely(par_blkno == 0)) {
2295 XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)", 2295 XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)",
2296 XFS_ERRLEVEL_LOW, mp); 2296 XFS_ERRLEVEL_LOW, mp);
2297 error = EFSCORRUPTED; 2297 error = -EFSCORRUPTED;
2298 goto done; 2298 goto done;
2299 } 2299 }
2300 error = xfs_da3_node_read(tp, dp, par_blkno, -1, &par_buf, w); 2300 error = xfs_da3_node_read(tp, dp, par_blkno, -1, &par_buf, w);
@@ -2305,7 +2305,7 @@ xfs_da3_swap_lastblock(
2305 if (par_hdr.level != level) { 2305 if (par_hdr.level != level) {
2306 XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", 2306 XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)",
2307 XFS_ERRLEVEL_LOW, mp); 2307 XFS_ERRLEVEL_LOW, mp);
2308 error = EFSCORRUPTED; 2308 error = -EFSCORRUPTED;
2309 goto done; 2309 goto done;
2310 } 2310 }
2311 btree = dp->d_ops->node_tree_p(par_node); 2311 btree = dp->d_ops->node_tree_p(par_node);
@@ -2359,7 +2359,7 @@ xfs_da_shrink_inode(
2359 error = xfs_bunmapi(tp, dp, dead_blkno, count, 2359 error = xfs_bunmapi(tp, dp, dead_blkno, count,
2360 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, 2360 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
2361 0, args->firstblock, args->flist, &done); 2361 0, args->firstblock, args->flist, &done);
2362 if (error == ENOSPC) { 2362 if (error == -ENOSPC) {
2363 if (w != XFS_DATA_FORK) 2363 if (w != XFS_DATA_FORK)
2364 break; 2364 break;
2365 error = xfs_da3_swap_lastblock(args, &dead_blkno, 2365 error = xfs_da3_swap_lastblock(args, &dead_blkno,
@@ -2427,7 +2427,7 @@ xfs_buf_map_from_irec(
2427 map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map), 2427 map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map),
2428 KM_SLEEP | KM_NOFS); 2428 KM_SLEEP | KM_NOFS);
2429 if (!map) 2429 if (!map)
2430 return ENOMEM; 2430 return -ENOMEM;
2431 *mapp = map; 2431 *mapp = map;
2432 } 2432 }
2433 2433
@@ -2500,8 +2500,8 @@ xfs_dabuf_map(
2500 } 2500 }
2501 2501
2502 if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) { 2502 if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) {
2503 error = mappedbno == -2 ? -1 : EFSCORRUPTED; 2503 error = mappedbno == -2 ? -1 : -EFSCORRUPTED;
2504 if (unlikely(error == EFSCORRUPTED)) { 2504 if (unlikely(error == -EFSCORRUPTED)) {
2505 if (xfs_error_level >= XFS_ERRLEVEL_LOW) { 2505 if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
2506 int i; 2506 int i;
2507 xfs_alert(mp, "%s: bno %lld dir: inode %lld", 2507 xfs_alert(mp, "%s: bno %lld dir: inode %lld",
@@ -2561,7 +2561,7 @@ xfs_da_get_buf(
2561 2561
2562 bp = xfs_trans_get_buf_map(trans, dp->i_mount->m_ddev_targp, 2562 bp = xfs_trans_get_buf_map(trans, dp->i_mount->m_ddev_targp,
2563 mapp, nmap, 0); 2563 mapp, nmap, 0);
2564 error = bp ? bp->b_error : EIO; 2564 error = bp ? bp->b_error : -EIO;
2565 if (error) { 2565 if (error) {
2566 xfs_trans_brelse(trans, bp); 2566 xfs_trans_brelse(trans, bp);
2567 goto out_free; 2567 goto out_free;