From b6daf451ba359a460c7a8db53e85824a440dd48e Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Fri, 5 Jun 2015 10:13:28 +1000 Subject: [PATCH] libxfs: error negation rework The libxfs core in the kernel now returns negative error numbers one failure rather than positive numbers. This commit switches the libxfs core to use negative error numbers and converts all the libxfs function callers to negate the returned error so that none of the other codeneeds tobe changed at this time. This allows us to drive negative errors through the xfsprogs code base at our leisure rather than having to do it all right now. Signed-off-by: Dave Chinner --- db/io.c | 8 +-- libxfs/rdwr.c | 12 ++-- libxfs/trans.c | 6 +- libxfs/util.c | 16 ++--- libxfs/xfs_alloc.c | 20 +++--- libxfs/xfs_alloc_btree.c | 6 +- libxfs/xfs_attr.c | 50 +++++++-------- libxfs/xfs_attr_leaf.c | 44 ++++++------- libxfs/xfs_attr_remote.c | 10 +-- libxfs/xfs_bmap.c | 52 +++++++-------- libxfs/xfs_bmap_btree.c | 10 +-- libxfs/xfs_btree.c | 14 ++--- libxfs/xfs_da_btree.c | 42 ++++++------- libxfs/xfs_dir2.c | 24 +++---- libxfs/xfs_dir2_block.c | 16 ++--- libxfs/xfs_dir2_data.c | 10 +-- libxfs/xfs_dir2_leaf.c | 22 +++---- libxfs/xfs_dir2_node.c | 40 ++++++------ libxfs/xfs_dir2_sf.c | 28 ++++----- libxfs/xfs_dquot_buf.c | 6 +- libxfs/xfs_ialloc.c | 32 +++++----- libxfs/xfs_ialloc_btree.c | 6 +- libxfs/xfs_inode_buf.c | 10 +-- libxfs/xfs_inode_fork.c | 30 ++++----- libxfs/xfs_sb.c | 28 ++++----- libxfs/xfs_symlink_remote.c | 6 +- mkfs/proto.c | 54 ++++++++-------- mkfs/xfs_mkfs.c | 2 +- repair/attr_repair.c | 8 +-- repair/dinode.c | 2 +- repair/dir2.c | 8 +-- repair/phase6.c | 122 ++++++++++++++++++------------------ repair/phase7.c | 6 +- 33 files changed, 375 insertions(+), 375 deletions(-) diff --git a/db/io.c b/db/io.c index d90612335..0a9f756d5 100644 --- a/db/io.c +++ b/db/io.c @@ -429,12 +429,12 @@ write_cur_buf(void) { int ret; - ret = libxfs_writebufr(iocur_top->bp); + ret = -libxfs_writebufr(iocur_top->bp); if (ret != 0) dbprintf(_("write error: %s\n"), strerror(ret)); /* re-read buffer from disk */ - ret = libxfs_readbufr(mp->m_ddev_targp, iocur_top->bb, iocur_top->bp, + ret = -libxfs_readbufr(mp->m_ddev_targp, iocur_top->bb, iocur_top->bp, iocur_top->blen, 0); if (ret != 0) dbprintf(_("read error: %s\n"), strerror(ret)); @@ -445,13 +445,13 @@ write_cur_bbs(void) { int ret; - ret = libxfs_writebufr(iocur_top->bp); + ret = -libxfs_writebufr(iocur_top->bp); if (ret != 0) dbprintf(_("write error: %s\n"), strerror(ret)); /* re-read buffer from disk */ - ret = libxfs_readbufr_map(mp->m_ddev_targp, iocur_top->bp, 0); + ret = -libxfs_readbufr_map(mp->m_ddev_targp, iocur_top->bp, 0); if (ret != 0) dbprintf(_("read error: %s\n"), strerror(ret)); } diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 8318922a4..b19c29cb8 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -708,7 +708,7 @@ __read_buf(int fd, void *buf, int len, off64_t offset, int flags) sts = pread64(fd, buf, len, offset); if (sts < 0) { - int error = errno; + int error = -errno; fprintf(stderr, _("%s: read failed: %s\n"), progname, strerror(error)); if (flags & LIBXFS_EXIT_ON_FAILURE) @@ -719,7 +719,7 @@ __read_buf(int fd, void *buf, int len, off64_t offset, int flags) progname, sts, len); if (flags & LIBXFS_EXIT_ON_FAILURE) exit(1); - return EIO; + return -EIO; } return 0; } @@ -876,7 +876,7 @@ __write_buf(int fd, void *buf, int len, off64_t offset, int flags) sts = pwrite64(fd, buf, len, offset); if (sts < 0) { - int error = errno; + int error = -errno; fprintf(stderr, _("%s: pwrite64 failed: %s\n"), progname, strerror(error)); if (flags & LIBXFS_B_EXIT) @@ -887,7 +887,7 @@ __write_buf(int fd, void *buf, int len, off64_t offset, int flags) progname, sts, len); if (flags & LIBXFS_B_EXIT) exit(1); - return EIO; + return -EIO; } return 0; } @@ -905,7 +905,7 @@ libxfs_writebufr(xfs_buf_t *bp) * bugs like this. Make sure the error is obvious as to the cause. */ if (bp->b_flags & LIBXFS_B_STALE) { - bp->b_error = ESTALE; + bp->b_error = -ESTALE; return bp->b_error; } @@ -1114,7 +1114,7 @@ libxfs_iget(xfs_mount_t *mp, xfs_trans_t *tp, xfs_ino_t ino, uint lock_flags, ip = kmem_zone_zalloc(xfs_inode_zone, 0); if (!ip) - return ENOMEM; + return -ENOMEM; ip->i_ino = ino; ip->i_mount = mp; diff --git a/libxfs/trans.c b/libxfs/trans.c index 4c075be2e..261757fa2 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -190,7 +190,7 @@ libxfs_trans_reserve( */ if (blocks > 0) { if (mpsb->sb_fdblocks < blocks) - return ENOSPC; + return -ENOSPC; } /* user space, don't need log/RT stuff (preserve the API though) */ return 0; @@ -560,7 +560,7 @@ libxfs_trans_read_buf_map( if (tp == NULL) { bp = libxfs_readbuf_map(btp, map, nmaps, flags, ops); if (!bp) { - return (flags & XBF_TRYLOCK) ? EAGAIN : ENOMEM; + return (flags & XBF_TRYLOCK) ? -EAGAIN : -ENOMEM; } if (bp->b_error) goto out_relse; @@ -578,7 +578,7 @@ libxfs_trans_read_buf_map( bp = libxfs_readbuf_map(btp, map, nmaps, flags, ops); if (!bp) { - return (flags & XBF_TRYLOCK) ? EAGAIN : ENOMEM; + return (flags & XBF_TRYLOCK) ? -EAGAIN : -ENOMEM; } if (bp->b_error) goto out_relse; diff --git a/libxfs/util.c b/libxfs/util.c index d1d020029..b11889225 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -476,12 +476,12 @@ libxfs_mod_incore_sb( lcounter = (long long)mp->m_sb.sb_fdblocks; lcounter += delta; if (lcounter < 0) - return ENOSPC; + return -ENOSPC; mp->m_sb.sb_fdblocks = lcounter; return 0; default: ASSERT(0); - return EINVAL; + return -EINVAL; } } @@ -541,7 +541,7 @@ libxfs_alloc_file_space( int error; if (len <= 0) - return EINVAL; + return -EINVAL; count = len; error = 0; @@ -567,7 +567,7 @@ libxfs_alloc_file_space( /* * Free the transaction structure. */ - ASSERT(error == ENOSPC); + ASSERT(error == -ENOSPC); xfs_trans_cancel(tp, 0); break; } @@ -592,7 +592,7 @@ libxfs_alloc_file_space( allocated_fsb = imapp->br_blockcount; if (reccount == 0) - return ENOSPC; + return -ENOSPC; startoffset_fsb += allocated_fsb; allocatesize_fsb -= allocated_fsb; @@ -649,7 +649,7 @@ libxfs_inode_alloc( } if (!ialloc_context && !ip) { *ipp = NULL; - return ENOSPC; + return -ENOSPC; } if (ialloc_context) { @@ -673,7 +673,7 @@ libxfs_inode_alloc( error = libxfs_ialloc(*tp, pip, mode, nlink, rdev, cr, fsx, 1, &ialloc_context, &ip); if (!ip) - error = ENOSPC; + error = -ENOSPC; if (error) return error; } @@ -730,6 +730,6 @@ xfs_verifier_error( struct xfs_buf *bp) { xfs_alert(NULL, "Metadata %s detected at block 0x%llx/0x%x", - bp->b_error == EFSBADCRC ? "CRC error" : "corruption", + bp->b_error == -EFSBADCRC ? "CRC error" : "corruption", bp->b_bn, BBTOB(bp->b_length)); } diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 135b6e0d2..b795bd3ae 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -463,9 +463,9 @@ xfs_agfl_read_verify( return; if (!xfs_buf_verify_cksum(bp, XFS_AGFL_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_agfl_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -483,7 +483,7 @@ xfs_agfl_write_verify( return; if (!xfs_agfl_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -539,7 +539,7 @@ xfs_alloc_update_counters( xfs_trans_agblocks_delta(tp, len); if (unlikely(be32_to_cpu(agf->agf_freeblks) > be32_to_cpu(agf->agf_length))) - return EFSCORRUPTED; + return -EFSCORRUPTED; xfs_alloc_log_agf(tp, agbp, XFS_AGF_FREEBLKS); return 0; @@ -2214,11 +2214,11 @@ xfs_agf_read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (XFS_TEST_ERROR(!xfs_agf_verify(mp, bp), mp, XFS_ERRTAG_ALLOC_READ_AGF, XFS_RANDOM_ALLOC_READ_AGF)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -2232,7 +2232,7 @@ xfs_agf_write_verify( struct xfs_buf_log_item *bip = bp->b_fspriv; if (!xfs_agf_verify(mp, bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -2582,11 +2582,11 @@ xfs_free_extent( */ args.agno = XFS_FSB_TO_AGNO(args.mp, bno); if (args.agno >= args.mp->m_sb.sb_agcount) - return EFSCORRUPTED; + return -EFSCORRUPTED; args.agbno = XFS_FSB_TO_AGBNO(args.mp, bno); if (args.agbno >= args.mp->m_sb.sb_agblocks) - return EFSCORRUPTED; + return -EFSCORRUPTED; args.pag = xfs_perag_get(args.mp, args.agno); ASSERT(args.pag); @@ -2598,7 +2598,7 @@ xfs_free_extent( /* validate the extent size is legal now we have the agf locked */ if (args.agbno + len > be32_to_cpu(XFS_BUF_TO_AGF(args.agbp)->agf_length)) { - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto error0; } diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c index 1787df8de..2d755898b 100644 --- a/libxfs/xfs_alloc_btree.c +++ b/libxfs/xfs_alloc_btree.c @@ -338,9 +338,9 @@ xfs_allocbt_read_verify( struct xfs_buf *bp) { if (!xfs_btree_sblock_verify_crc(bp)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_allocbt_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) { trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -354,7 +354,7 @@ xfs_allocbt_write_verify( { if (!xfs_allocbt_verify(bp)) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 766aefd3f..5aa8c4ff3 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -59,7 +59,7 @@ xfs_attr_args_init( { if (!name) - return EINVAL; + return -EINVAL; memset(args, 0, sizeof(*args)); args->geo = dp->i_mount->m_attr_geo; @@ -69,7 +69,7 @@ xfs_attr_args_init( args->name = name; args->namelen = strlen((const char *)name); if (args->namelen >= MAXNAMELEN) - return EFAULT; /* match IRIX behaviour */ + return -EFAULT; /* match IRIX behaviour */ args->hashval = xfs_da_hashname(args->name, args->namelen); return 0; @@ -105,10 +105,10 @@ xfs_attr_get( XFS_STATS_INC(xs_attr_get); if (XFS_FORCED_SHUTDOWN(ip->i_mount)) - return EIO; + return -EIO; if (!xfs_inode_hasattr(ip)) - return ENOATTR; + return -ENOATTR; error = xfs_attr_args_init(&args, ip, name, flags); if (error) @@ -119,7 +119,7 @@ xfs_attr_get( lock_mode = xfs_ilock_attr_map_shared(ip); if (!xfs_inode_hasattr(ip)) - error = ENOATTR; + error = -ENOATTR; else if (ip->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) error = xfs_attr_shortform_getvalue(&args); else if (xfs_bmap_one_block(ip, XFS_ATTR_FORK)) @@ -129,7 +129,7 @@ xfs_attr_get( xfs_iunlock(ip, lock_mode); *valuelenp = args.valuelen; - return error == EEXIST ? 0 : error; + return error == -EEXIST ? 0 : error; } /* @@ -187,7 +187,7 @@ xfs_attr_set( XFS_STATS_INC(xs_attr_set); if (XFS_FORCED_SHUTDOWN(dp->i_mount)) - return EIO; + return -EIO; error = xfs_attr_args_init(&args, dp, name, flags); if (error) @@ -278,7 +278,7 @@ xfs_attr_set( * the inode. */ error = xfs_attr_shortform_addname(&args); - if (error != ENOSPC) { + if (error != -ENOSPC) { /* * Commit the shortform mods, and we're done. * NOTE: this is also the error path (EEXIST, etc). @@ -393,10 +393,10 @@ xfs_attr_remove( XFS_STATS_INC(xs_attr_remove); if (XFS_FORCED_SHUTDOWN(dp->i_mount)) - return EIO; + return -EIO; if (!xfs_inode_hasattr(dp)) - return ENOATTR; + return -ENOATTR; error = xfs_attr_args_init(&args, dp, name, flags); if (error) @@ -451,7 +451,7 @@ xfs_attr_remove( xfs_trans_ijoin(args.trans, dp, 0); if (!xfs_inode_hasattr(dp)) { - error = ENOATTR; + error = -ENOATTR; } else if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); error = xfs_attr_shortform_remove(&args); @@ -508,9 +508,9 @@ xfs_attr_shortform_addname(xfs_da_args_t *args) trace_xfs_attr_sf_addname(args); retval = xfs_attr_shortform_lookup(args); - if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) { + if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) { return retval; - } else if (retval == EEXIST) { + } else if (retval == -EEXIST) { if (args->flags & ATTR_CREATE) return retval; retval = xfs_attr_shortform_remove(args); @@ -519,14 +519,14 @@ xfs_attr_shortform_addname(xfs_da_args_t *args) if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX || args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX) - return ENOSPC; + return -ENOSPC; newsize = XFS_ATTR_SF_TOTSIZE(args->dp); newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen); forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize); if (!forkoff) - return ENOSPC; + return -ENOSPC; xfs_attr_shortform_add(args, forkoff); return 0; @@ -566,10 +566,10 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) * the given flags produce an error or call for an atomic rename. */ retval = xfs_attr3_leaf_lookup_int(bp, args); - if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) { + if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) { xfs_trans_brelse(args->trans, bp); return retval; - } else if (retval == EEXIST) { + } else if (retval == -EEXIST) { if (args->flags & ATTR_CREATE) { /* pure create op */ xfs_trans_brelse(args->trans, bp); return retval; @@ -600,7 +600,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) * if required. */ retval = xfs_attr3_leaf_add(bp, args); - if (retval == ENOSPC) { + if (retval == -ENOSPC) { /* * Promote the attribute list to the Btree format, then * Commit that transaction so that the node_addname() call @@ -769,7 +769,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) return error; error = xfs_attr3_leaf_lookup_int(bp, args); - if (error == ENOATTR) { + if (error == -ENOATTR) { xfs_trans_brelse(args->trans, bp); return error; } @@ -824,7 +824,7 @@ xfs_attr_leaf_get(xfs_da_args_t *args) return error; error = xfs_attr3_leaf_lookup_int(bp, args); - if (error != EEXIST) { + if (error != -EEXIST) { xfs_trans_brelse(args->trans, bp); return error; } @@ -880,9 +880,9 @@ restart: goto out; blk = &state->path.blk[ state->path.active-1 ]; ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); - if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) { + if ((args->flags & ATTR_REPLACE) && (retval == -ENOATTR)) { goto out; - } else if (retval == EEXIST) { + } else if (retval == -EEXIST) { if (args->flags & ATTR_CREATE) goto out; @@ -907,7 +907,7 @@ restart: } retval = xfs_attr3_leaf_add(blk->bp, state->args); - if (retval == ENOSPC) { + if (retval == -ENOSPC) { if (state->path.active == 1) { /* * Its really a single leaf node, but it had @@ -1142,7 +1142,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) * Search to see if name exists, and get back a pointer to it. */ error = xfs_da3_node_lookup_int(state, &retval); - if (error || (retval != EEXIST)) { + if (error || (retval != -EEXIST)) { if (error == 0) error = retval; goto out; @@ -1405,7 +1405,7 @@ xfs_attr_node_get(xfs_da_args_t *args) error = xfs_da3_node_lookup_int(state, &retval); if (error) { retval = error; - } else if (retval == EEXIST) { + } else if (retval == -EEXIST) { blk = &state->path.blk[ state->path.active-1 ]; ASSERT(blk->bp != NULL); ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 678db2c4f..7331c8537 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -188,7 +188,7 @@ xfs_attr3_leaf_write_verify( struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr; if (!xfs_attr3_leaf_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -216,9 +216,9 @@ xfs_attr3_leaf_read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_ATTR3_LEAF_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_attr3_leaf_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -521,7 +521,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) break; } if (i == end) - return ENOATTR; + return -ENOATTR; /* * Fix up the attribute fork data, covering the hole @@ -585,9 +585,9 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args) continue; if (!xfs_attr_namesp_match(args->flags, sfe->flags)) continue; - return EEXIST; + return -EEXIST; } - return ENOATTR; + return -ENOATTR; } /* @@ -614,18 +614,18 @@ xfs_attr_shortform_getvalue(xfs_da_args_t *args) continue; if (args->flags & ATTR_KERNOVAL) { args->valuelen = sfe->valuelen; - return EEXIST; + return -EEXIST; } if (args->valuelen < sfe->valuelen) { args->valuelen = sfe->valuelen; - return ERANGE; + return -ERANGE; } args->valuelen = sfe->valuelen; memcpy(args->value, &sfe->nameval[args->namelen], args->valuelen); - return EEXIST; + return -EEXIST; } - return ENOATTR; + return -ENOATTR; } /* @@ -665,7 +665,7 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) * If we hit an IO error middle of the transaction inside * grow_inode(), we may have inconsistent data. Bail out. */ - if (error == EIO) + if (error == -EIO) goto out; xfs_idata_realloc(dp, size, XFS_ATTR_FORK); /* try to put */ memcpy(ifp->if_u1.if_data, tmpbuffer, size); /* it back */ @@ -704,9 +704,9 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) sfe->namelen); nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags); error = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */ - ASSERT(error == ENOATTR); + ASSERT(error == -ENOATTR); error = xfs_attr3_leaf_add(bp, &nargs); - ASSERT(error != ENOSPC); + ASSERT(error != -ENOSPC); if (error) goto out; sfe = XFS_ATTR_SF_NEXTENTRY(sfe); @@ -783,7 +783,7 @@ xfs_attr3_leaf_to_shortform( tmpbuffer = kmem_alloc(args->geo->blksize, KM_SLEEP); if (!tmpbuffer) - return ENOMEM; + return -ENOMEM; memcpy(tmpbuffer, bp->b_addr, args->geo->blksize); @@ -1082,7 +1082,7 @@ xfs_attr3_leaf_add( * no good and we should just give up. */ if (!ichdr.holes && sum < entsize) - return ENOSPC; + return -ENOSPC; /* * Compact the entries to coalesce free space. @@ -1095,7 +1095,7 @@ xfs_attr3_leaf_add( * free region, in freemap[0]. If it is not big enough, give up. */ if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) { - tmp = ENOSPC; + tmp = -ENOSPC; goto out_log_hdr; } @@ -2097,7 +2097,7 @@ xfs_attr3_leaf_lookup_int( } if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) { args->index = probe; - return ENOATTR; + return -ENOATTR; } /* @@ -2126,7 +2126,7 @@ xfs_attr3_leaf_lookup_int( if (!xfs_attr_namesp_match(args->flags, entry->flags)) continue; args->index = probe; - return EEXIST; + return -EEXIST; } else { name_rmt = xfs_attr3_leaf_name_remote(leaf, probe); if (name_rmt->namelen != args->namelen) @@ -2142,11 +2142,11 @@ xfs_attr3_leaf_lookup_int( args->rmtblkcnt = xfs_attr3_rmt_blocks( args->dp->i_mount, args->rmtvaluelen); - return EEXIST; + return -EEXIST; } } args->index = probe; - return ENOATTR; + return -ENOATTR; } /* @@ -2182,7 +2182,7 @@ xfs_attr3_leaf_getvalue( } if (args->valuelen < valuelen) { args->valuelen = valuelen; - return ERANGE; + return -ERANGE; } args->valuelen = valuelen; memcpy(args->value, &name_loc->nameval[args->namelen], valuelen); @@ -2200,7 +2200,7 @@ xfs_attr3_leaf_getvalue( } if (args->valuelen < args->rmtvaluelen) { args->valuelen = args->rmtvaluelen; - return ERANGE; + return -ERANGE; } args->valuelen = args->rmtvaluelen; } diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index c44298111..23d1871c2 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -113,11 +113,11 @@ xfs_attr3_rmt_read_verify( while (len > 0) { if (!xfs_verify_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF)) { - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); break; } if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); break; } len -= blksize; @@ -153,7 +153,7 @@ xfs_attr3_rmt_write_verify( while (len > 0) { if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -232,7 +232,7 @@ xfs_attr_rmtval_copyout( xfs_alert(mp, "remote attribute header mismatch bno/off/len/owner (0x%llx/0x%x/Ox%x/0x%llx)", bno, *offset, byte_cnt, ino); - return EFSCORRUPTED; + return -EFSCORRUPTED; } hdr_size = sizeof(struct xfs_attr3_rmt_hdr); } @@ -483,7 +483,7 @@ xfs_attr_rmtval_set( bp = xfs_buf_get(mp->m_ddev_targp, dblkno, dblkcnt, 0); if (!bp) - return ENOMEM; + return -ENOMEM; bp->b_ops = &xfs_attr3_rmt_buf_ops; xfs_attr_rmtval_copyin(mp, bp, args->dp->i_ino, &offset, diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index fec59bc62..c50546747 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -1000,7 +1000,7 @@ xfs_bmap_add_attrfork_btree( goto error0; if (stat == 0) { xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); - return ENOSPC; + return -ENOSPC; } *firstblock = cur->bc_private.b.firstblock; cur->bc_private.b.allocated = 0; @@ -1082,7 +1082,7 @@ xfs_bmap_add_attrfork_local( /* should only be called for types that support local format data */ ASSERT(0); - return EFSCORRUPTED; + return -EFSCORRUPTED; } /* @@ -1159,7 +1159,7 @@ xfs_bmap_add_attrfork( break; default: ASSERT(0); - error = EINVAL; + error = -EINVAL; goto trans_cancel; } @@ -1366,7 +1366,7 @@ xfs_bmap_read_extents( return 0; error0: xfs_trans_brelse(tp, bp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } @@ -1543,7 +1543,7 @@ xfs_bmap_last_before( if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL) - return EIO; + return -EIO; if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { *last_block = 0; return 0; @@ -1657,7 +1657,7 @@ xfs_bmap_last_offset( if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) - return EIO; + return -EIO; error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty); if (error || is_empty) @@ -3290,7 +3290,7 @@ xfs_bmap_extsize_align( if (orig_off < align_off || orig_end > align_off + align_alen || align_alen - temp < orig_alen) - return EINVAL; + return -EINVAL; /* * Try to fix it by moving the start up. */ @@ -3315,7 +3315,7 @@ xfs_bmap_extsize_align( * Result doesn't cover the request, fail it. */ if (orig_off < align_off || orig_end > align_off + align_alen) - return EINVAL; + return -EINVAL; } else { ASSERT(orig_off >= align_off); ASSERT(orig_end <= align_off + align_alen); @@ -4018,11 +4018,11 @@ xfs_bmapi_read( XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { XFS_ERROR_REPORT("xfs_bmapi_read", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (XFS_FORCED_SHUTDOWN(mp)) - return EIO; + return -EIO; XFS_STATS_INC(xs_blk_mapr); @@ -4213,11 +4213,11 @@ xfs_bmapi_delay( XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_BTREE), mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { XFS_ERROR_REPORT("xfs_bmapi_delay", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (XFS_FORCED_SHUTDOWN(mp)) - return EIO; + return -EIO; XFS_STATS_INC(xs_blk_mapw); @@ -4436,7 +4436,7 @@ xfs_bmapi_convert_unwritten( * so generate another request. */ if (mval->br_blockcount < len) - return EAGAIN; + return -EAGAIN; return 0; } @@ -4507,11 +4507,11 @@ xfs_bmapi_write( XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { XFS_ERROR_REPORT("xfs_bmapi_write", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (XFS_FORCED_SHUTDOWN(mp)) - return EIO; + return -EIO; ifp = XFS_IFORK_PTR(ip, whichfork); @@ -4587,7 +4587,7 @@ xfs_bmapi_write( /* Execute unwritten extent conversion if necessary */ error = xfs_bmapi_convert_unwritten(&bma, mval, len, flags); - if (error == EAGAIN) + if (error == -EAGAIN) continue; if (error) goto error0; @@ -4889,7 +4889,7 @@ xfs_bmap_del_extent( goto done; cur->bc_rec.b = new; error = xfs_btree_insert(cur, &i); - if (error && error != ENOSPC) + if (error && error != -ENOSPC) goto done; /* * If get no-space back from btree insert, @@ -4897,7 +4897,7 @@ xfs_bmap_del_extent( * block reservation. * Fix up our state and return the error. */ - if (error == ENOSPC) { + if (error == -ENOSPC) { /* * Reset the cursor, don't trust * it after any insert operation. @@ -4925,7 +4925,7 @@ xfs_bmap_del_extent( xfs_bmbt_set_blockcount(ep, got.br_blockcount); flags = 0; - error = ENOSPC; + error = -ENOSPC; goto done; } XFS_WANT_CORRUPTED_GOTO(i == 1, done); @@ -5043,11 +5043,11 @@ xfs_bunmapi( XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW, ip->i_mount); - return EFSCORRUPTED; + return -EFSCORRUPTED; } mp = ip->i_mount; if (XFS_FORCED_SHUTDOWN(mp)) - return EIO; + return -EIO; ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(len > 0); @@ -5292,7 +5292,7 @@ xfs_bunmapi( del.br_startoff > got.br_startoff && del.br_startoff + del.br_blockcount < got.br_startoff + got.br_blockcount) { - error = ENOSPC; + error = -ENOSPC; goto error0; } error = xfs_bmap_del_extent(ip, tp, &lastx, flist, cur, &del, @@ -5416,11 +5416,11 @@ xfs_bmap_shift_extents( mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { XFS_ERROR_REPORT("xfs_bmap_shift_extents", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (XFS_FORCED_SHUTDOWN(mp)) - return EIO; + return -EIO; ASSERT(current_ext != NULL); @@ -5483,14 +5483,14 @@ xfs_bmap_shift_extents( *current_ext - 1), &left); if (startoff < left.br_startoff + left.br_blockcount) - error = EINVAL; + error = -EINVAL; } else if (offset_shift_fsb > got.br_startoff) { /* * When first extent is shifted, offset_shift_fsb * should be less than the stating offset of * the first extent. */ - error = EINVAL; + error = -EINVAL; } if (error) diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index 1fa20bdfc..37eee5030 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -533,7 +533,7 @@ xfs_bmbt_alloc_block( args.minlen = args.maxlen = args.prod = 1; args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL; if (!args.wasdel && xfs_trans_get_block_res(args.tp) == 0) { - error = ENOSPC; + error = -ENOSPC; goto error0; } error = xfs_alloc_vextent(&args); @@ -758,9 +758,9 @@ xfs_bmbt_read_verify( struct xfs_buf *bp) { if (!xfs_btree_lblock_verify_crc(bp)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_bmbt_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) { trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -774,7 +774,7 @@ xfs_bmbt_write_verify( { if (!xfs_bmbt_verify(bp)) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -938,7 +938,7 @@ xfs_bmbt_change_owner( cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork); if (!cur) - return ENOMEM; + return -ENOMEM; error = xfs_btree_change_owner(cur, new_owner, buffer_list); xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c index 74697daf1..0605560c7 100644 --- a/libxfs/xfs_btree.c +++ b/libxfs/xfs_btree.c @@ -75,7 +75,7 @@ xfs_btree_check_lblock( if (bp) trace_xfs_btree_corrupt(bp, _RET_IP_); XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } return 0; } @@ -123,7 +123,7 @@ xfs_btree_check_sblock( if (bp) trace_xfs_btree_corrupt(bp, _RET_IP_); XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } return 0; } @@ -1123,7 +1123,7 @@ xfs_btree_get_buf_block( mp->m_bsize, flags); if (!*bpp) - return ENOMEM; + return -ENOMEM; (*bpp)->b_ops = cur->bc_ops->buf_ops; *block = XFS_BUF_TO_BLOCK(*bpp); @@ -1481,7 +1481,7 @@ xfs_btree_increment( if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) goto out0; ASSERT(0); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto error0; } ASSERT(lev < cur->bc_nlevels); @@ -1580,7 +1580,7 @@ xfs_btree_decrement( if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) goto out0; ASSERT(0); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto error0; } ASSERT(lev < cur->bc_nlevels); @@ -4008,7 +4008,7 @@ xfs_btree_block_change_owner( /* now read rh sibling block for next iteration */ xfs_btree_get_sibling(cur, block, &rptr, XFS_BB_RIGHTSIB); if (xfs_btree_ptr_is_null(cur, &rptr)) - return ENOENT; + return -ENOENT; return xfs_btree_lookup_get_block(cur, level, &rptr, &block); } @@ -4051,7 +4051,7 @@ xfs_btree_change_owner( buffer_list); } while (!error); - if (error != ENOENT) + if (error != -ENOENT) return error; } diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 95eb027e3..fae2fd859 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -162,7 +162,7 @@ xfs_da3_node_write_verify( struct xfs_da3_node_hdr *hdr3 = bp->b_addr; if (!xfs_da3_node_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -191,13 +191,13 @@ xfs_da3_node_read_verify( switch (be16_to_cpu(info->magic)) { case XFS_DA3_NODE_MAGIC: if (!xfs_buf_verify_cksum(bp, XFS_DA3_NODE_CRC_OFF)) { - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); break; } /* fall through */ case XFS_DA_NODE_MAGIC: if (!xfs_da3_node_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); break; } return; @@ -362,7 +362,7 @@ xfs_da3_split( switch (oldblk->magic) { case XFS_ATTR_LEAF_MAGIC: error = xfs_attr3_leaf_split(state, oldblk, newblk); - if ((error != 0) && (error != ENOSPC)) { + if ((error != 0) && (error != -ENOSPC)) { return error; /* GROT: attr is inconsistent */ } if (!error) { @@ -1556,9 +1556,9 @@ xfs_da3_node_lookup_int( args->blkno = blk->blkno; } else { ASSERT(0); - return EFSCORRUPTED; + return -EFSCORRUPTED; } - if (((retval == ENOENT) || (retval == ENOATTR)) && + if (((retval == -ENOENT) || (retval == -ENOATTR)) && (blk->hashval == args->hashval)) { error = xfs_da3_path_shift(state, &state->path, 1, 1, &retval); @@ -1568,7 +1568,7 @@ xfs_da3_node_lookup_int( continue; } else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { /* path_shift() gives ENOENT */ - retval = ENOATTR; + retval = -ENOATTR; } } break; @@ -1836,7 +1836,7 @@ xfs_da3_path_shift( } } if (level < 0) { - *result = ENOENT; /* we're out of our tree */ + *result = -ENOENT; /* we're out of our tree */ ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); return 0; } @@ -2045,7 +2045,7 @@ xfs_da_grow_inode_int( if (got != count || mapp[0].br_startoff != *bno || mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount != *bno + count) { - error = ENOSPC; + error = -ENOSPC; goto out_free_map; } @@ -2135,7 +2135,7 @@ xfs_da3_swap_lastblock( if (unlikely(lastoff == 0)) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(1)", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } /* * Read the last block in the btree space. @@ -2186,7 +2186,7 @@ xfs_da3_swap_lastblock( sib_info->magic != dead_info->magic)) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)", XFS_ERRLEVEL_LOW, mp); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto done; } sib_info->forw = cpu_to_be32(dead_blkno); @@ -2208,7 +2208,7 @@ xfs_da3_swap_lastblock( sib_info->magic != dead_info->magic)) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)", XFS_ERRLEVEL_LOW, mp); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto done; } sib_info->back = cpu_to_be32(dead_blkno); @@ -2231,7 +2231,7 @@ xfs_da3_swap_lastblock( if (level >= 0 && level != par_hdr.level + 1) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", XFS_ERRLEVEL_LOW, mp); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto done; } level = par_hdr.level; @@ -2244,7 +2244,7 @@ xfs_da3_swap_lastblock( if (entno == par_hdr.count) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(5)", XFS_ERRLEVEL_LOW, mp); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto done; } par_blkno = be32_to_cpu(btree[entno].before); @@ -2271,7 +2271,7 @@ xfs_da3_swap_lastblock( if (unlikely(par_blkno == 0)) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)", XFS_ERRLEVEL_LOW, mp); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto done; } error = xfs_da3_node_read(tp, dp, par_blkno, -1, &par_buf, w); @@ -2282,7 +2282,7 @@ xfs_da3_swap_lastblock( if (par_hdr.level != level) { XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", XFS_ERRLEVEL_LOW, mp); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto done; } btree = dp->d_ops->node_tree_p(par_node); @@ -2336,7 +2336,7 @@ xfs_da_shrink_inode( error = xfs_bunmapi(tp, dp, dead_blkno, count, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, &done); - if (error == ENOSPC) { + if (error == -ENOSPC) { if (w != XFS_DATA_FORK) break; error = xfs_da3_swap_lastblock(args, &dead_blkno, @@ -2404,7 +2404,7 @@ xfs_buf_map_from_irec( map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map), KM_SLEEP | KM_NOFS); if (!map) - return ENOMEM; + return -ENOMEM; *mapp = map; } @@ -2477,8 +2477,8 @@ xfs_dabuf_map( } if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) { - error = mappedbno == -2 ? -1 : EFSCORRUPTED; - if (unlikely(error == EFSCORRUPTED)) { + error = mappedbno == -2 ? -1 : -EFSCORRUPTED; + if (unlikely(error == -EFSCORRUPTED)) { if (xfs_error_level >= XFS_ERRLEVEL_LOW) { int i; xfs_alert(mp, "%s: bno %lld dir: inode %lld", @@ -2538,7 +2538,7 @@ xfs_da_get_buf( bp = xfs_trans_get_buf_map(trans, dp->i_mount->m_ddev_targp, mapp, nmap, 0); - error = bp ? bp->b_error : EIO; + error = bp ? bp->b_error : -EIO; if (error) { xfs_trans_brelse(trans, bp); goto out_free; diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index 248b7cafb..e2d3ce7dd 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -107,7 +107,7 @@ xfs_da_mount( if (!mp->m_dir_geo || !mp->m_attr_geo) { kmem_free(mp->m_dir_geo); kmem_free(mp->m_attr_geo); - return ENOMEM; + return -ENOMEM; } /* set up directory geometry */ @@ -201,7 +201,7 @@ xfs_dir_ino_validate( xfs_warn(mp, "Invalid inode number 0x%Lx", (unsigned long long) ino); XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } return 0; } @@ -225,7 +225,7 @@ xfs_dir_init( args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); if (!args) - return ENOMEM; + return -ENOMEM; args->geo = dp->i_mount->m_dir_geo; args->dp = dp; @@ -260,7 +260,7 @@ xfs_dir_createname( args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); if (!args) - return ENOMEM; + return -ENOMEM; args->geo = dp->i_mount->m_dir_geo; args->name = name->name; @@ -313,18 +313,18 @@ xfs_dir_cilookup_result( int len) { if (args->cmpresult == XFS_CMP_DIFFERENT) - return ENOENT; + return -ENOENT; if (args->cmpresult != XFS_CMP_CASE || !(args->op_flags & XFS_DA_OP_CILOOKUP)) - return EEXIST; + return -EEXIST; args->value = kmem_alloc(len, KM_NOFS | KM_MAYFAIL); if (!args->value) - return ENOMEM; + return -ENOMEM; memcpy(args->value, name, len); args->valuelen = len; - return EEXIST; + return -EEXIST; } /* @@ -391,7 +391,7 @@ xfs_dir_lookup( rval = xfs_dir2_node_lookup(args); out_check_rval: - if (rval == EEXIST) + if (rval == -EEXIST) rval = 0; if (!rval) { *inum = args->inumber; @@ -427,7 +427,7 @@ xfs_dir_removename( args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); if (!args) - return ENOMEM; + return -ENOMEM; args->geo = dp->i_mount->m_dir_geo; args->name = name->name; @@ -492,7 +492,7 @@ xfs_dir_replace( args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); if (!args) - return ENOMEM; + return -ENOMEM; args->geo = dp->i_mount->m_dir_geo; args->name = name->name; @@ -554,7 +554,7 @@ xfs_dir_canenter( args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); if (!args) - return ENOMEM; + return -ENOMEM; args->geo = dp->i_mount->m_dir_geo; args->name = name->name; diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index e910b5bf4..d6da2dba7 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -72,9 +72,9 @@ xfs_dir3_block_read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_dir3_block_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -89,7 +89,7 @@ xfs_dir3_block_write_verify( struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; if (!xfs_dir3_block_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -373,7 +373,7 @@ xfs_dir2_block_addname( if (args->op_flags & XFS_DA_OP_JUSTCHECK) { xfs_trans_brelse(tp, bp); if (!dup) - return ENOSPC; + return -ENOSPC; return 0; } @@ -383,7 +383,7 @@ xfs_dir2_block_addname( if (!dup) { /* Don't have a space reservation: return no-space. */ if (args->total == 0) - return ENOSPC; + return -ENOSPC; /* * Convert to the next larger format. * Then add the new entry in that format. @@ -685,7 +685,7 @@ xfs_dir2_block_lookup_int( if (low > high) { ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); xfs_trans_brelse(tp, bp); - return ENOENT; + return -ENOENT; } } /* @@ -733,7 +733,7 @@ xfs_dir2_block_lookup_int( * No match, release the buffer and return ENOENT. */ xfs_trans_brelse(tp, bp); - return ENOENT; + return -ENOENT; } /* @@ -1073,7 +1073,7 @@ xfs_dir2_sf_to_block( */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { ASSERT(XFS_FORCED_SHUTDOWN(mp)); - return EIO; + return -EIO; } oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data; diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index 40ff57c2e..b3cb3e8e9 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -85,7 +85,7 @@ __xfs_dir3_data_check( break; default: XFS_ERROR_REPORT("Bad Magic", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } /* @@ -241,7 +241,7 @@ xfs_dir3_data_reada_verify( xfs_dir3_data_verify(bp); return; default: - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); break; } @@ -255,9 +255,9 @@ xfs_dir3_data_read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_dir3_data_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -272,7 +272,7 @@ xfs_dir3_data_write_verify( struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; if (!xfs_dir3_data_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index 26fc21393..a998bef0d 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -166,9 +166,9 @@ __read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_LEAF_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_dir3_leaf_verify(bp, magic)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -184,7 +184,7 @@ __write_verify( struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr; if (!xfs_dir3_leaf_verify(bp, magic)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -714,7 +714,7 @@ xfs_dir2_leaf_addname( if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0) { xfs_trans_brelse(tp, lbp); - return ENOSPC; + return -ENOSPC; } /* * Convert to node form. @@ -738,7 +738,7 @@ xfs_dir2_leaf_addname( */ if (args->op_flags & XFS_DA_OP_JUSTCHECK) { xfs_trans_brelse(tp, lbp); - return use_block == -1 ? ENOSPC : 0; + return use_block == -1 ? -ENOSPC : 0; } /* * If no allocations are allowed, return now before we've @@ -746,7 +746,7 @@ xfs_dir2_leaf_addname( */ if (args->total == 0 && use_block == -1) { xfs_trans_brelse(tp, lbp); - return ENOSPC; + return -ENOSPC; } /* * Need to compact the leaf entries, removing stale ones. @@ -1310,13 +1310,13 @@ xfs_dir2_leaf_lookup_int( return 0; } /* - * No match found, return ENOENT. + * No match found, return -ENOENT. */ ASSERT(cidb == -1); if (dbp) xfs_trans_brelse(tp, dbp); xfs_trans_brelse(tp, lbp); - return ENOENT; + return -ENOENT; } /* @@ -1423,7 +1423,7 @@ xfs_dir2_leaf_removename( * Just go on, returning success, leaving the * empty block in place. */ - if (error == ENOSPC && args->total == 0) + if (error == -ENOSPC && args->total == 0) error = 0; xfs_dir3_leaf_check(dp, lbp); return error; @@ -1624,7 +1624,7 @@ xfs_dir2_leaf_trim_data( * Get rid of the data block. */ if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { - ASSERT(error != ENOSPC); + ASSERT(error != -ENOSPC); xfs_trans_brelse(tp, dbp); return error; } @@ -1798,7 +1798,7 @@ xfs_dir2_node_to_leaf( * punching out the middle of an extent, and this is an * isolated block. */ - ASSERT(error != ENOSPC); + ASSERT(error != -ENOSPC); return error; } fbp = NULL; diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index 74db67682..3dc3d4c92 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -100,9 +100,9 @@ xfs_dir3_free_read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_FREE_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_dir3_free_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -117,7 +117,7 @@ xfs_dir3_free_write_verify( struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; if (!xfs_dir3_free_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } @@ -389,7 +389,7 @@ xfs_dir2_leafn_add( * into other peoples memory */ if (index < 0) - return EFSCORRUPTED; + return -EFSCORRUPTED; /* * If there are already the maximum number of leaf entries in @@ -400,7 +400,7 @@ xfs_dir2_leafn_add( if (leafhdr.count == dp->d_ops->leaf_max_ents(args->geo)) { if (!leafhdr.stale) - return ENOSPC; + return -ENOSPC; compact = leafhdr.stale > 1; } else compact = 0; @@ -612,7 +612,7 @@ xfs_dir2_leafn_lookup_for_addname( XFS_ERRLEVEL_LOW, mp); if (curfdb != newfdb) xfs_trans_brelse(tp, curbp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } curfdb = newfdb; if (be16_to_cpu(bests[fi]) >= length) @@ -643,7 +643,7 @@ out: * Return the index, that will be the insertion point. */ *indexp = index; - return ENOENT; + return -ENOENT; } /* @@ -772,7 +772,7 @@ xfs_dir2_leafn_lookup_for_entry( curbp->b_ops = &xfs_dir3_data_buf_ops; xfs_trans_buf_set_type(tp, curbp, XFS_BLFT_DIR_DATA_BUF); if (cmp == XFS_CMP_EXACT) - return EEXIST; + return -EEXIST; } } ASSERT(index == leafhdr.count || (args->op_flags & XFS_DA_OP_OKNOENT)); @@ -795,7 +795,7 @@ xfs_dir2_leafn_lookup_for_entry( state->extravalid = 0; } *indexp = index; - return ENOENT; + return -ENOENT; } /* @@ -1116,7 +1116,7 @@ xfs_dir3_data_block_free( if (error == 0) { fbp = NULL; logfree = 0; - } else if (error != ENOSPC || args->total != 0) + } else if (error != -ENOSPC || args->total != 0) return error; /* * It's possible to get ENOSPC if there is no @@ -1270,7 +1270,7 @@ xfs_dir2_leafn_remove( * In this case just drop the buffer and some one else * will eventually get rid of the empty block. */ - else if (!(error == ENOSPC && args->total == 0)) + else if (!(error == -ENOSPC && args->total == 0)) return error; } /* @@ -1582,7 +1582,7 @@ xfs_dir2_node_addname( error = xfs_da3_node_lookup_int(state, &rval); if (error) rval = error; - if (rval != ENOENT) { + if (rval != -ENOENT) { goto done; } /* @@ -1611,7 +1611,7 @@ xfs_dir2_node_addname( * It didn't work, we need to split the leaf block. */ if (args->total == 0) { - ASSERT(rval == ENOSPC); + ASSERT(rval == -ENOSPC); goto done; } /* @@ -1798,7 +1798,7 @@ xfs_dir2_node_addname_int( * Not allowed to allocate, return failure. */ if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0) - return ENOSPC; + return -ENOSPC; /* * Allocate and initialize the new data block. @@ -1859,7 +1859,7 @@ xfs_dir2_node_addname_int( } XFS_ERROR_REPORT("xfs_dir2_node_addname_int", XFS_ERRLEVEL_LOW, mp); - return EFSCORRUPTED; + return -EFSCORRUPTED; } /* @@ -2025,8 +2025,8 @@ xfs_dir2_node_lookup( error = xfs_da3_node_lookup_int(state, &rval); if (error) rval = error; - else if (rval == ENOENT && args->cmpresult == XFS_CMP_CASE) { - /* If a CI match, dup the actual name and return EEXIST */ + else if (rval == -ENOENT && args->cmpresult == XFS_CMP_CASE) { + /* If a CI match, dup the actual name and return -EEXIST */ xfs_dir2_data_entry_t *dep; dep = (xfs_dir2_data_entry_t *) @@ -2079,7 +2079,7 @@ xfs_dir2_node_removename( goto out_free; /* Didn't find it, upper layer screwed up. */ - if (rval != EEXIST) { + if (rval != -EEXIST) { error = rval; goto out_free; } @@ -2152,7 +2152,7 @@ xfs_dir2_node_replace( * It should be found, since the vnodeops layer has looked it up * and locked it. But paranoia is good. */ - if (rval == EEXIST) { + if (rval == -EEXIST) { struct xfs_dir2_leaf_entry *ents; /* * Find the leaf entry. @@ -2255,7 +2255,7 @@ xfs_dir2_node_trim_free( * space reservation, when breaking up an extent into two * pieces. This is the last block of an extent. */ - ASSERT(error != ENOSPC); + ASSERT(error != -ENOSPC); xfs_trans_brelse(tp, bp); return error; } diff --git a/libxfs/xfs_dir2_sf.c b/libxfs/xfs_dir2_sf.c index 16ce13885..61a0be1b1 100644 --- a/libxfs/xfs_dir2_sf.c +++ b/libxfs/xfs_dir2_sf.c @@ -234,7 +234,7 @@ xfs_dir2_block_to_sf( logflags = XFS_ILOG_CORE; error = xfs_dir2_shrink_inode(args, args->geo->datablk, bp); if (error) { - ASSERT(error != ENOSPC); + ASSERT(error != -ENOSPC); goto out; } @@ -282,7 +282,7 @@ xfs_dir2_sf_addname( trace_xfs_dir2_sf_addname(args); - ASSERT(xfs_dir2_sf_lookup(args) == ENOENT); + ASSERT(xfs_dir2_sf_lookup(args) == -ENOENT); dp = args->dp; ASSERT(dp->i_df.if_flags & XFS_IFINLINE); /* @@ -290,7 +290,7 @@ xfs_dir2_sf_addname( */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); - return EIO; + return -EIO; } ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); ASSERT(dp->i_df.if_u1.if_data != NULL); @@ -328,7 +328,7 @@ xfs_dir2_sf_addname( * Just checking or no space reservation, it doesn't fit. */ if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0) - return ENOSPC; + return -ENOSPC; /* * Convert to block form then add the name. */ @@ -721,7 +721,7 @@ xfs_dir2_sf_lookup( */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); - return EIO; + return -EIO; } ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); ASSERT(dp->i_df.if_u1.if_data != NULL); @@ -734,7 +734,7 @@ xfs_dir2_sf_lookup( args->inumber = dp->i_ino; args->cmpresult = XFS_CMP_EXACT; args->filetype = XFS_DIR3_FT_DIR; - return EEXIST; + return -EEXIST; } /* * Special case for .. @@ -744,7 +744,7 @@ xfs_dir2_sf_lookup( args->inumber = dp->d_ops->sf_get_parent_ino(sfp); args->cmpresult = XFS_CMP_EXACT; args->filetype = XFS_DIR3_FT_DIR; - return EEXIST; + return -EEXIST; } /* * Loop over all the entries trying to match ours. @@ -764,17 +764,17 @@ xfs_dir2_sf_lookup( args->inumber = dp->d_ops->sf_get_ino(sfp, sfep); args->filetype = dp->d_ops->sf_get_ftype(sfep); if (cmp == XFS_CMP_EXACT) - return EEXIST; + return -EEXIST; ci_sfep = sfep; } } ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); /* * Here, we can only be doing a lookup (not a rename or replace). - * If a case-insensitive match was not found, return ENOENT. + * If a case-insensitive match was not found, return -ENOENT. */ if (!ci_sfep) - return ENOENT; + return -ENOENT; /* otherwise process the CI match as required by the caller */ error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen); return error; @@ -807,7 +807,7 @@ xfs_dir2_sf_removename( */ if (oldsize < offsetof(xfs_dir2_sf_hdr_t, parent)) { ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); - return EIO; + return -EIO; } ASSERT(dp->i_df.if_bytes == oldsize); ASSERT(dp->i_df.if_u1.if_data != NULL); @@ -830,7 +830,7 @@ xfs_dir2_sf_removename( * Didn't find it. */ if (i == sfp->count) - return ENOENT; + return -ENOENT; /* * Calculate sizes. */ @@ -897,7 +897,7 @@ xfs_dir2_sf_replace( */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); - return EIO; + return -EIO; } ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); ASSERT(dp->i_df.if_u1.if_data != NULL); @@ -973,7 +973,7 @@ xfs_dir2_sf_replace( if (i8elevated) xfs_dir2_sf_toino4(args); #endif - return ENOENT; + return -ENOENT; } } #if XFS_BIG_INUMS diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c index fae05a598..97ac60c94 100644 --- a/libxfs/xfs_dquot_buf.c +++ b/libxfs/xfs_dquot_buf.c @@ -252,9 +252,9 @@ xfs_dquot_buf_read_verify( struct xfs_mount *mp = bp->b_target->bt_mount; if (!xfs_dquot_buf_verify_crc(mp, bp)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_dquot_buf_verify(mp, bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -272,7 +272,7 @@ xfs_dquot_buf_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; if (!xfs_dquot_buf_verify(mp, bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 93dc194d3..ec2d82de6 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -268,7 +268,7 @@ xfs_ialloc_inode_init( mp->m_bsize * blks_per_cluster, XBF_UNMAPPED); if (!fbuf) - return ENOMEM; + return -ENOMEM; /* Initialize the inode buffers and log them appropriately. */ fbuf->b_ops = &xfs_inode_buf_ops; @@ -356,7 +356,7 @@ xfs_ialloc_ag_alloc( newlen = args.mp->m_ialloc_inos; if (args.mp->m_maxicount && args.mp->m_sb.sb_icount + newlen > args.mp->m_maxicount) - return ENOSPC; + return -ENOSPC; args.minlen = args.maxlen = args.mp->m_ialloc_blks; /* * First try to allocate inodes contiguous with the last-allocated @@ -1361,7 +1361,7 @@ xfs_dialloc( if (error) { xfs_trans_brelse(tp, agbp); - if (error != ENOSPC) + if (error != -ENOSPC) goto out_error; xfs_perag_put(pag); @@ -1392,7 +1392,7 @@ nextag: agno = 0; if (agno == start_agno) { *inop = NULLFSINO; - return noroom ? ENOSPC : 0; + return noroom ? -ENOSPC : 0; } } @@ -1658,7 +1658,7 @@ xfs_difree( xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).", __func__, agno, mp->m_sb.sb_agcount); ASSERT(0); - return EINVAL; + return -EINVAL; } agino = XFS_INO_TO_AGINO(mp, inode); if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) { @@ -1666,14 +1666,14 @@ xfs_difree( __func__, (unsigned long long)inode, (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino)); ASSERT(0); - return EINVAL; + return -EINVAL; } agbno = XFS_AGINO_TO_AGBNO(mp, agino); if (agbno >= mp->m_sb.sb_agblocks) { xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).", __func__, agbno, mp->m_sb.sb_agblocks); ASSERT(0); - return EINVAL; + return -EINVAL; } /* * Get the allocation group header. @@ -1745,7 +1745,7 @@ xfs_imap_lookup( if (i) error = xfs_inobt_get_rec(cur, &rec, &i); if (!error && i == 0) - error = EINVAL; + error = -EINVAL; } xfs_trans_brelse(tp, agbp); @@ -1756,12 +1756,12 @@ xfs_imap_lookup( /* check that the returned record contains the required inode */ if (rec.ir_startino > agino || rec.ir_startino + mp->m_ialloc_inos <= agino) - return EINVAL; + return -EINVAL; /* for untrusted inodes check it is allocated first */ if ((flags & XFS_IGET_UNTRUSTED) && (rec.ir_free & XFS_INOBT_MASK(agino - rec.ir_startino))) - return EINVAL; + return -EINVAL; *chunk_agbno = XFS_AGINO_TO_AGBNO(mp, rec.ir_startino); *offset_agbno = agbno - *chunk_agbno; @@ -1805,7 +1805,7 @@ xfs_imap( * as they can be invalid without implying corruption. */ if (flags & XFS_IGET_UNTRUSTED) - return EINVAL; + return -EINVAL; if (agno >= mp->m_sb.sb_agcount) { xfs_alert(mp, "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)", @@ -1825,7 +1825,7 @@ xfs_imap( } xfs_stack_trace(); #endif /* DEBUG */ - return EINVAL; + return -EINVAL; } blks_per_cluster = xfs_icluster_size_fsb(mp); @@ -1898,7 +1898,7 @@ out_map: __func__, (unsigned long long) imap->im_blkno, (unsigned long long) imap->im_len, XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)); - return EINVAL; + return -EINVAL; } return 0; } @@ -2048,11 +2048,11 @@ xfs_agi_read_verify( if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_AGI_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (XFS_TEST_ERROR(!xfs_agi_verify(bp), mp, XFS_ERRTAG_IALLOC_READ_AGI, XFS_RANDOM_IALLOC_READ_AGI)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -2066,7 +2066,7 @@ xfs_agi_write_verify( struct xfs_buf_log_item *bip = bp->b_fspriv; if (!xfs_agi_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index 37f5623c1..55799b4ce 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -253,9 +253,9 @@ xfs_inobt_read_verify( struct xfs_buf *bp) { if (!xfs_btree_sblock_verify_crc(bp)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_inobt_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) { trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -269,7 +269,7 @@ xfs_inobt_write_verify( { if (!xfs_inobt_verify(bp)) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 08cf5d82e..06e9c0c21 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -87,7 +87,7 @@ xfs_inode_buf_verify( return; } - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); #ifdef DEBUG xfs_alert(mp, @@ -160,14 +160,14 @@ xfs_imap_to_bp( (int)imap->im_len, buf_flags, &bp, &xfs_inode_buf_ops); if (error) { - if (error == EAGAIN) { + if (error == -EAGAIN) { ASSERT(buf_flags & XBF_TRYLOCK); return error; } - if (error == EFSCORRUPTED && + if (error == -EFSCORRUPTED && (iget_flags & XFS_IGET_UNTRUSTED)) - return EINVAL; + return -EINVAL; xfs_warn(mp, "%s: xfs_trans_read_buf() returned error %d.", __func__, error); @@ -376,7 +376,7 @@ xfs_iread( __func__, ip->i_ino); XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, dip); - error = EFSCORRUPTED; + error = -EFSCORRUPTED; goto out_brelse; } diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c index eaab16595..0eac4c0f2 100644 --- a/libxfs/xfs_inode_fork.c +++ b/libxfs/xfs_inode_fork.c @@ -83,7 +83,7 @@ xfs_iformat_fork( be64_to_cpu(dip->di_nblocks)); XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { @@ -92,7 +92,7 @@ xfs_iformat_fork( dip->di_forkoff); XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && @@ -102,7 +102,7 @@ xfs_iformat_fork( ip->i_ino); XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } switch (ip->i_d.di_mode & S_IFMT) { @@ -113,7 +113,7 @@ xfs_iformat_fork( if (unlikely(dip->di_format != XFS_DINODE_FMT_DEV)) { XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } ip->i_d.di_size = 0; ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip); @@ -134,7 +134,7 @@ xfs_iformat_fork( XFS_CORRUPTION_ERROR("xfs_iformat(4)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } di_size = be64_to_cpu(dip->di_size); @@ -147,7 +147,7 @@ xfs_iformat_fork( XFS_CORRUPTION_ERROR("xfs_iformat(5)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } size = (int)di_size; @@ -162,13 +162,13 @@ xfs_iformat_fork( default: XFS_ERROR_REPORT("xfs_iformat(6)", XFS_ERRLEVEL_LOW, ip->i_mount); - return EFSCORRUPTED; + return -EFSCORRUPTED; } break; default: XFS_ERROR_REPORT("xfs_iformat(7)", XFS_ERRLEVEL_LOW, ip->i_mount); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (error) { return error; @@ -192,7 +192,7 @@ xfs_iformat_fork( XFS_CORRUPTION_ERROR("xfs_iformat(8)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); @@ -204,7 +204,7 @@ xfs_iformat_fork( error = xfs_iformat_btree(ip, dip, XFS_ATTR_FORK); break; default: - error = EFSCORRUPTED; + error = -EFSCORRUPTED; break; } if (error) { @@ -247,7 +247,7 @@ xfs_iformat_local( XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } ifp = XFS_IFORK_PTR(ip, whichfork); real_size = 0; @@ -303,7 +303,7 @@ xfs_iformat_extents( (unsigned long long) ip->i_ino, nex); XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW, ip->i_mount, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } ifp->if_real_bytes = 0; @@ -331,7 +331,7 @@ xfs_iformat_extents( XFS_ERROR_REPORT("xfs_iformat_extents(2)", XFS_ERRLEVEL_LOW, ip->i_mount); - return EFSCORRUPTED; + return -EFSCORRUPTED; } } ifp->if_flags |= XFS_IFEXTENTS; @@ -380,7 +380,7 @@ xfs_iformat_btree( (unsigned long long) ip->i_ino); XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW, mp, dip); - return EFSCORRUPTED; + return -EFSCORRUPTED; } ifp->if_broot_bytes = size; @@ -417,7 +417,7 @@ xfs_iread_extents( if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW, ip->i_mount); - return EFSCORRUPTED; + return -EFSCORRUPTED; } nextents = XFS_IFORK_NEXTENTS(ip, whichfork); ifp = XFS_IFORK_PTR(ip, whichfork); diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index 2c8447c67..e5b5662b4 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -165,13 +165,13 @@ xfs_mount_validate_sb( */ if (sbp->sb_magicnum != XFS_SB_MAGIC) { xfs_warn(mp, "bad magic number"); - return EWRONGFS; + return -EWRONGFS; } if (!xfs_sb_good_version(sbp)) { xfs_warn(mp, "bad version"); - return EWRONGFS; + return -EWRONGFS; } /* @@ -199,7 +199,7 @@ xfs_mount_validate_sb( xfs_warn(mp, "Attempted to mount read-only compatible filesystem read-write.\n" "Filesystem can only be safely mounted read only."); - return EINVAL; + return -EINVAL; } } if (xfs_sb_has_incompat_feature(sbp, @@ -209,7 +209,7 @@ xfs_mount_validate_sb( "Filesystem can not be safely mounted by this kernel.", (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_UNKNOWN)); - return EINVAL; + return -EINVAL; } } @@ -217,13 +217,13 @@ xfs_mount_validate_sb( if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) { xfs_notice(mp, "Version 5 of Super block has XFS_OQUOTA bits."); - return EFSCORRUPTED; + return -EFSCORRUPTED; } } else if (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) { xfs_notice(mp, "Superblock earlier than Version 5 has XFS_[PQ]UOTA_{ENFD|CHKD} bits."); - return EFSCORRUPTED; + return -EFSCORRUPTED; } if (unlikely( @@ -231,7 +231,7 @@ xfs_mount_validate_sb( xfs_warn(mp, "filesystem is marked as having an external log; " "specify logdev on the mount command line."); - return EINVAL; + return -EINVAL; } if (unlikely( @@ -239,7 +239,7 @@ xfs_mount_validate_sb( xfs_warn(mp, "filesystem is marked as having an internal log; " "do not specify logdev on the mount command line."); - return EINVAL; + return -EINVAL; } /* @@ -273,7 +273,7 @@ xfs_mount_validate_sb( sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp) || sbp->sb_shared_vn != 0)) { xfs_notice(mp, "SB sanity check failed"); - return EFSCORRUPTED; + return -EFSCORRUPTED; } /* @@ -288,14 +288,14 @@ xfs_mount_validate_sb( default: xfs_warn(mp, "inode size of %d bytes not supported", sbp->sb_inodesize); - return ENOSYS; + return -ENOSYS; } if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) || xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) { xfs_warn(mp, "file system too large to be mounted on this system."); - return EFBIG; + return -EFBIG; } return 0; @@ -584,7 +584,7 @@ xfs_sb_read_verify( /* Only fail bad secondaries on a known V5 filesystem */ if (bp->b_bn == XFS_SB_DADDR || xfs_sb_version_hascrc(&mp->m_sb)) { - error = EFSBADCRC; + error = -EFSBADCRC; goto out_error; } } @@ -594,7 +594,7 @@ xfs_sb_read_verify( out_error: if (error) { xfs_buf_ioerror(bp, error); - if (error == EFSCORRUPTED || error == EFSBADCRC) + if (error == -EFSCORRUPTED || error == -EFSBADCRC) xfs_verifier_error(bp); } } @@ -617,7 +617,7 @@ xfs_sb_quiet_read_verify( return; } /* quietly fail */ - xfs_buf_ioerror(bp, EWRONGFS); + xfs_buf_ioerror(bp, -EWRONGFS); } static void diff --git a/libxfs/xfs_symlink_remote.c b/libxfs/xfs_symlink_remote.c index 9503b979d..525c83df4 100644 --- a/libxfs/xfs_symlink_remote.c +++ b/libxfs/xfs_symlink_remote.c @@ -116,9 +116,9 @@ xfs_symlink_read_verify( return; if (!xfs_buf_verify_cksum(bp, XFS_SYMLINK_CRC_OFF)) - xfs_buf_ioerror(bp, EFSBADCRC); + xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_symlink_verify(bp)) - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); @@ -136,7 +136,7 @@ xfs_symlink_write_verify( return; if (!xfs_symlink_verify(bp)) { - xfs_buf_ioerror(bp, EFSCORRUPTED); + xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } diff --git a/mkfs/proto.c b/mkfs/proto.c index b67687693..9830e9fcd 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -129,7 +129,7 @@ getres( for (i = 0, r = MKFS_BLOCKRES(blocks); r >= blocks; r--) { struct xfs_trans_res tres = {0}; - i = libxfs_trans_reserve(tp, &tres, r, 0); + i = -libxfs_trans_reserve(tp, &tres, r, 0); if (i == 0) return; } @@ -184,7 +184,7 @@ rsvfile( int error; xfs_trans_t *tp; - error = libxfs_alloc_file_space(ip, 0, llen, 1, 0); + error = -libxfs_alloc_file_space(ip, 0, llen, 1, 0); if (error) { fail(_("error reserving space for a file"), error); @@ -252,7 +252,7 @@ newfile( } else if (len > 0) { nb = XFS_B_TO_FSB(mp, len); nmap = 1; - error = libxfs_bmapi_write(tp, ip, 0, nb, 0, first, nb, + error = -libxfs_bmapi_write(tp, ip, 0, nb, 0, first, nb, &map, &nmap, flist); if (error) { fail(_("error allocating space for a file"), error); @@ -322,7 +322,7 @@ newdirent( rsv = XFS_DIRENTER_SPACE_RES(mp, name->len); - error = libxfs_dir_createname(tp, pip, name, inum, first, flist, rsv); + error = -libxfs_dir_createname(tp, pip, name, inum, first, flist, rsv); if (error) fail(_("directory createname error"), error); } @@ -336,7 +336,7 @@ newdirectory( { int error; - error = libxfs_dir_init(tp, dp, pdp); + error = -libxfs_dir_init(tp, dp, pdp); if (error) fail(_("directory create error"), error); } @@ -453,7 +453,7 @@ parseproto( case IF_REGULAR: buf = newregfile(pp, &len); getres(tp, XFS_B_TO_FSB(mp, len)); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0, &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); @@ -470,7 +470,7 @@ parseproto( llen = cvtnum(mp->m_sb.sb_blocksize, mp->m_sb.sb_sectsize, value); getres(tp, XFS_B_TO_FSB(mp, llen)); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0, &creds, fsxp, &ip); if (error) fail(_("Inode pre-allocation failed"), error); @@ -481,7 +481,7 @@ parseproto( newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist); libxfs_trans_log_inode(tp, ip, flags); - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) fail(_("Pre-allocated file creation failed"), error); libxfs_trans_commit(tp, 0); @@ -493,7 +493,7 @@ parseproto( getres(tp, 0); majdev = (int)getnum(pp); mindev = (int)getnum(pp); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1, IRIX_MKDEV(majdev, mindev), &creds, fsxp, &ip); if (error) { fail(_("Inode allocation failed"), error); @@ -508,7 +508,7 @@ parseproto( getres(tp, 0); majdev = (int)getnum(pp); mindev = (int)getnum(pp); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1, IRIX_MKDEV(majdev, mindev), &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); @@ -520,7 +520,7 @@ parseproto( case IF_FIFO: getres(tp, 0); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0, &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); @@ -532,7 +532,7 @@ parseproto( buf = getstr(pp); len = (int)strlen(buf); getres(tp, XFS_B_TO_FSB(mp, len)); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0, &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); @@ -543,7 +543,7 @@ parseproto( break; case IF_DIRECTORY: getres(tp, 0); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0, &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); @@ -563,7 +563,7 @@ parseproto( } newdirectory(mp, tp, ip, pip); libxfs_trans_log_inode(tp, ip, flags); - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) fail(_("Directory creation failed"), error); libxfs_trans_commit(tp, 0); @@ -589,7 +589,7 @@ parseproto( fail(_("Unknown format"), EINVAL); } libxfs_trans_log_inode(tp, ip, flags); - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { fail(_("Error encountered creating file from prototype file"), error); @@ -636,13 +636,13 @@ rtinit( * First, allocate the inodes. */ tp = libxfs_trans_alloc(mp, 0); - i = libxfs_trans_reserve(tp, &tres, MKFS_BLOCKRES_INODE, 0); + i = -libxfs_trans_reserve(tp, &tres, MKFS_BLOCKRES_INODE, 0); if (i) res_failed(i); memset(&creds, 0, sizeof(creds)); memset(&fsxattrs, 0, sizeof(fsxattrs)); - error = libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0, + error = -libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0, &creds, &fsxattrs, &rbmip); if (error) { fail(_("Realtime bitmap inode allocation failed"), error); @@ -659,7 +659,7 @@ rtinit( libxfs_trans_log_inode(tp, rbmip, XFS_ILOG_CORE); libxfs_mod_sb(tp, XFS_SB_RBMINO); mp->m_rbmip = rbmip; - error = libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0, + error = -libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0, &creds, &fsxattrs, &rsumip); if (error) { fail(_("Realtime summary inode allocation failed"), error); @@ -674,7 +674,7 @@ rtinit( * Next, give the bitmap file some zero-filled blocks. */ tp = libxfs_trans_alloc(mp, 0); - i = libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks + + i = -libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0); if (i) res_failed(i); @@ -684,7 +684,7 @@ rtinit( xfs_bmap_init(&flist, &first); while (bno < mp->m_sb.sb_rbmblocks) { nmap = XFS_BMAP_MAX_NMAP; - error = libxfs_bmapi_write(tp, rbmip, bno, + error = -libxfs_bmapi_write(tp, rbmip, bno, (xfs_extlen_t)(mp->m_sb.sb_rbmblocks - bno), 0, &first, mp->m_sb.sb_rbmblocks, map, &nmap, &flist); @@ -700,7 +700,7 @@ rtinit( } } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { fail(_("Completion of the realtime bitmap failed"), error); } @@ -711,7 +711,7 @@ rtinit( */ tp = libxfs_trans_alloc(mp, 0); nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog; - i = libxfs_trans_reserve(tp, &tres, nsumblocks + + i = -libxfs_trans_reserve(tp, &tres, nsumblocks + (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0); if (i) res_failed(i); @@ -720,7 +720,7 @@ rtinit( xfs_bmap_init(&flist, &first); while (bno < nsumblocks) { nmap = XFS_BMAP_MAX_NMAP; - error = libxfs_bmapi_write(tp, rsumip, bno, + error = -libxfs_bmapi_write(tp, rsumip, bno, (xfs_extlen_t)(nsumblocks - bno), 0, &first, nsumblocks, map, &nmap, &flist); @@ -735,7 +735,7 @@ rtinit( bno += ep->br_blockcount; } } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { fail(_("Completion of the realtime summary failed"), error); } @@ -747,19 +747,19 @@ rtinit( */ for (bno = 0; bno < mp->m_sb.sb_rextents; bno = ebno) { tp = libxfs_trans_alloc(mp, 0); - i = libxfs_trans_reserve(tp, &tres, 0, 0); + i = -libxfs_trans_reserve(tp, &tres, 0, 0); if (i) res_failed(i); libxfs_trans_ijoin(tp, rbmip, 0); xfs_bmap_init(&flist, &first); ebno = XFS_RTMIN(mp->m_sb.sb_rextents, bno + NBBY * mp->m_sb.sb_blocksize); - error = libxfs_rtfree_extent(tp, bno, (xfs_extlen_t)(ebno-bno)); + error = -libxfs_rtfree_extent(tp, bno, (xfs_extlen_t)(ebno-bno)); if (error) { fail(_("Error initializing the realtime space"), error); } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { fail(_("Error completing the realtime space"), error); } diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 845c98088..c03119c35 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -2998,7 +2998,7 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), args.agno = agno; args.alignment = 1; args.pag = xfs_perag_get(mp,agno); - c = libxfs_trans_reserve(tp, &tres, worst_freelist, 0); + c = -libxfs_trans_reserve(tp, &tres, worst_freelist, 0); if (c) res_failed(c); diff --git a/repair/attr_repair.c b/repair/attr_repair.c index 7eb3bccc7..d305cdb1a 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -634,7 +634,7 @@ verify_da_path(xfs_mount_t *mp, * contains what appears to be a valid node block, but only if * we are fixing errors. */ - if (bp->b_error == EFSBADCRC && !no_modify) + if (bp->b_error == -EFSBADCRC && !no_modify) cursor->level[this_level].dirty++; } /* @@ -1023,7 +1023,7 @@ rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap, break; } - if (bp->b_error == EFSBADCRC || bp->b_error == EFSCORRUPTED) { + if (bp->b_error == -EFSBADCRC || bp->b_error == -EFSCORRUPTED) { do_warn( _("Corrupt remote block for attributes of inode %" PRIu64 "\n"), ino); clearit = 1; @@ -1366,7 +1366,7 @@ process_leaf_attr_level(xfs_mount_t *mp, da_bno, dev_bno, ino); goto error_out; } - if (bp->b_error == EFSBADCRC) + if (bp->b_error == -EFSBADCRC) repair++; leaf = bp->b_addr; @@ -1553,7 +1553,7 @@ process_longform_attr( ino); return(1); } - if (bp->b_error == EFSBADCRC) + if (bp->b_error == -EFSBADCRC) (*repair)++; /* verify leaf block */ diff --git a/repair/dinode.c b/repair/dinode.c index d6c41d09d..a6be98f32 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -1285,7 +1285,7 @@ _("cannot read inode %" PRIu64 ", file block %d, disk block %" PRIu64 "\n"), lino, i, fsbno); return 1; } - if (bp->b_error == EFSBADCRC) { + if (bp->b_error == -EFSBADCRC) { do_warn( _("Bad symlink buffer CRC, block %" PRIu64 ", inode %" PRIu64 ".\n" "Correcting CRC, but symlink may be bad.\n"), fsbno, lino); diff --git a/repair/dir2.c b/repair/dir2.c index 005156480..5177bca94 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -602,7 +602,7 @@ _("bad level %d in block %u for directory inode %" PRIu64 "\n"), * recompute it. */ if (!no_modify && - cursor->level[this_level].bp->b_error == EFSBADCRC) + cursor->level[this_level].bp->b_error == -EFSBADCRC) cursor->level[this_level].dirty = 1; if (cursor->level[this_level].dirty && !no_modify) libxfs_writebuf(cursor->level[this_level].bp, 0); @@ -1583,7 +1583,7 @@ _("bad directory block magic # %#x in block %u for directory inode %" PRIu64 "\n rval = process_dir2_data(mp, ino, dip, ino_discovery, dirname, parent, bp, dot, dotdot, mp->m_dir_geo->datablk, (char *)blp, &dirty); /* If block looks ok but CRC didn't match, make sure to recompute it. */ - if (!rval && bp->b_error == EFSBADCRC) + if (!rval && bp->b_error == -EFSBADCRC) dirty = 1; if (dirty && !no_modify) { *repair = 1; @@ -1752,7 +1752,7 @@ _("bad sibling back pointer for block %u in directory inode %" PRIu64 "\n"), * If block looks ok but CRC didn't match, make sure to * recompute it. */ - if (!no_modify && bp->b_error == EFSBADCRC) + if (!no_modify && bp->b_error == -EFSBADCRC) buf_dirty = 1; ASSERT(buf_dirty == 0 || (buf_dirty && !no_modify)); if (buf_dirty && !no_modify) { @@ -1900,7 +1900,7 @@ _("bad directory block magic # %#x in block %" PRIu64 " for directory inode %" P if (i == 0) { good++; /* Maybe just CRC is wrong. Make sure we correct it. */ - if (bp->b_error == EFSBADCRC) + if (bp->b_error == -EFSBADCRC) dirty = 1; } if (dirty && !no_modify) { diff --git a/repair/phase6.c b/repair/phase6.c index 945330f24..5a6188685 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -147,13 +147,13 @@ dir_read_buf( int error; int error2; - error = libxfs_da_read_buf(NULL, ip, bno, mappedbno, bpp, + error = -libxfs_da_read_buf(NULL, ip, bno, mappedbno, bpp, XFS_DATA_FORK, ops); if (error != EFSBADCRC && error != EFSCORRUPTED) return error; - error2 = libxfs_da_read_buf(NULL, ip, bno, mappedbno, bpp, + error2 = -libxfs_da_read_buf(NULL, ip, bno, mappedbno, bpp, XFS_DATA_FORK, NULL); if (error2) return error2; @@ -496,11 +496,11 @@ mk_rbmino(xfs_mount_t *mp) */ tp = libxfs_trans_alloc(mp, 0); - i = libxfs_trans_reserve(tp, &tres, 10, 0); + i = -libxfs_trans_reserve(tp, &tres, 10, 0); if (i) res_failed(i); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip); + error = -libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime bitmap inode -- error - %d\n"), @@ -551,7 +551,7 @@ mk_rbmino(xfs_mount_t *mp) * from mkfs) */ tp = libxfs_trans_alloc(mp, 0); - error = libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks + + error = -libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0); if (error) res_failed(error); @@ -561,7 +561,7 @@ mk_rbmino(xfs_mount_t *mp) xfs_bmap_init(&flist, &first); while (bno < mp->m_sb.sb_rbmblocks) { nmap = XFS_BMAP_MAX_NMAP; - error = libxfs_bmapi_write(tp, ip, bno, + error = -libxfs_bmapi_write(tp, ip, bno, (xfs_extlen_t)(mp->m_sb.sb_rbmblocks - bno), 0, &first, mp->m_sb.sb_rbmblocks, map, &nmap, &flist); @@ -577,7 +577,7 @@ mk_rbmino(xfs_mount_t *mp) bno += ep->br_blockcount; } } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { do_error( _("allocation of the realtime bitmap failed, error = %d\n"), @@ -605,11 +605,11 @@ fill_rbmino(xfs_mount_t *mp) tp = libxfs_trans_alloc(mp, 0); - error = libxfs_trans_reserve(tp, &tres, 10, 0); + error = -libxfs_trans_reserve(tp, &tres, 10, 0); if (error) res_failed(error); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip); + error = -libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime bitmap inode -- error - %d\n"), @@ -622,7 +622,7 @@ fill_rbmino(xfs_mount_t *mp) * fill the file one block at a time */ nmap = 1; - error = libxfs_bmapi_write(tp, ip, bno, 1, 0, + error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, &first, 1, &map, &nmap, NULL); if (error || nmap != 1) { do_error( @@ -632,7 +632,7 @@ fill_rbmino(xfs_mount_t *mp) ASSERT(map.br_startblock != HOLESTARTBLOCK); - error = libxfs_trans_read_buf( + error = -libxfs_trans_read_buf( mp, tp, mp->m_dev, XFS_FSB_TO_DADDR(mp, map.br_startblock), XFS_FSB_TO_BB(mp, 1), 1, &bp, NULL); @@ -677,11 +677,11 @@ fill_rsumino(xfs_mount_t *mp) tp = libxfs_trans_alloc(mp, 0); - error = libxfs_trans_reserve(tp, &tres, 10, 0); + error = -libxfs_trans_reserve(tp, &tres, 10, 0); if (error) res_failed(error); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip); + error = -libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime summary inode -- error - %d\n"), @@ -694,7 +694,7 @@ fill_rsumino(xfs_mount_t *mp) * fill the file one block at a time */ nmap = 1; - error = libxfs_bmapi_write(tp, ip, bno, 1, 0, + error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, &first, 1, &map, &nmap, NULL); if (error || nmap != 1) { do_error( @@ -704,7 +704,7 @@ fill_rsumino(xfs_mount_t *mp) ASSERT(map.br_startblock != HOLESTARTBLOCK); - error = libxfs_trans_read_buf( + error = -libxfs_trans_read_buf( mp, tp, mp->m_dev, XFS_FSB_TO_DADDR(mp, map.br_startblock), XFS_FSB_TO_BB(mp, 1), 1, &bp, NULL); @@ -752,11 +752,11 @@ mk_rsumino(xfs_mount_t *mp) */ tp = libxfs_trans_alloc(mp, 0); - i = libxfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 10, 0); + i = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 10, 0); if (i) res_failed(i); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip); + error = -libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime summary inode -- error - %d\n"), @@ -813,7 +813,7 @@ mk_rsumino(xfs_mount_t *mp) tres.tr_logres = BBTOB(128); tres.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; - error = libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks + + error = -libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0); if (error) res_failed(error); @@ -823,7 +823,7 @@ mk_rsumino(xfs_mount_t *mp) xfs_bmap_init(&flist, &first); while (bno < nsumblocks) { nmap = XFS_BMAP_MAX_NMAP; - error = libxfs_bmapi_write(tp, ip, bno, + error = -libxfs_bmapi_write(tp, ip, bno, (xfs_extlen_t)(nsumblocks - bno), 0, &first, nsumblocks, map, &nmap, &flist); if (error) { @@ -838,7 +838,7 @@ mk_rsumino(xfs_mount_t *mp) bno += ep->br_blockcount; } } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { do_error( _("allocation of the realtime summary ino failed, error = %d\n"), @@ -865,11 +865,11 @@ mk_root_dir(xfs_mount_t *mp) tp = libxfs_trans_alloc(mp, 0); ip = NULL; - i = libxfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 10, 0); + i = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 10, 0); if (i) res_failed(i); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rootino, 0, 0, &ip); + error = -libxfs_trans_iget(mp, tp, mp->m_sb.sb_rootino, 0, 0, &ip); if (error) { do_error(_("could not iget root inode -- error - %d\n"), error); } @@ -953,7 +953,7 @@ mk_orphanage(xfs_mount_t *mp) * would have been cleared in phase3 and phase4. */ - if ((i = libxfs_iget(mp, NULL, mp->m_sb.sb_rootino, 0, &pip, 0))) + if ((i = -libxfs_iget(mp, NULL, mp->m_sb.sb_rootino, 0, &pip, 0))) do_error(_("%d - couldn't iget root inode to obtain %s\n"), i, ORPHANAGE); @@ -972,7 +972,7 @@ mk_orphanage(xfs_mount_t *mp) xfs_bmap_init(&flist, &first); nres = XFS_MKDIR_SPACE_RES(mp, xname.len); - i = libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0); + i = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0); if (i) res_failed(i); @@ -980,11 +980,11 @@ mk_orphanage(xfs_mount_t *mp) * use iget/ijoin instead of trans_iget because the ialloc * wrapper can commit the transaction and start a new one */ -/* if ((i = libxfs_iget(mp, NULL, mp->m_sb.sb_rootino, 0, &pip, 0))) +/* if ((i = -libxfs_iget(mp, NULL, mp->m_sb.sb_rootino, 0, &pip, 0))) do_error(_("%d - couldn't iget root inode to make %s\n"), i, ORPHANAGE);*/ - error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, + error = -libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0, &zerocr, &zerofsx, &ip); if (error) { do_error(_("%s inode allocation failed %d\n"), @@ -1030,7 +1030,7 @@ mk_orphanage(xfs_mount_t *mp) /* * create the actual entry */ - error = libxfs_dir_createname(tp, pip, &xname, ip->i_ino, &first, + error = -libxfs_dir_createname(tp, pip, &xname, ip->i_ino, &first, &flist, nres); if (error) do_error( @@ -1052,7 +1052,7 @@ mk_orphanage(xfs_mount_t *mp) libxfs_dir_init(tp, ip, pip); libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { do_error(_("%s directory creation failed -- bmapf error %d\n"), ORPHANAGE, error); @@ -1095,7 +1095,7 @@ mv_orphanage( xname.len = snprintf((char *)fname, sizeof(fname), "%llu", (unsigned long long)ino); - err = libxfs_iget(mp, NULL, orphanage_ino, 0, &orphanage_ip, 0); + err = -libxfs_iget(mp, NULL, orphanage_ino, 0, &orphanage_ip, 0); if (err) do_error(_("%d - couldn't iget orphanage inode\n"), err); /* @@ -1109,7 +1109,7 @@ mv_orphanage( tp = libxfs_trans_alloc(mp, 0); - if ((err = libxfs_iget(mp, NULL, ino, 0, &ino_p, 0))) + if ((err = -libxfs_iget(mp, NULL, ino, 0, &ino_p, 0))) do_error(_("%d - couldn't iget disconnected inode\n"), err); xname.type = xfs_mode_to_ftype[(ino_p->i_d.di_mode & S_IFMT)>>S_SHIFT]; @@ -1122,12 +1122,12 @@ mv_orphanage( irec->ino_startnum; nres = XFS_DIRENTER_SPACE_RES(mp, fnamelen) + XFS_DIRENTER_SPACE_RES(mp, 2); - err = libxfs_dir_lookup(tp, ino_p, &xfs_name_dotdot, + err = -libxfs_dir_lookup(tp, ino_p, &xfs_name_dotdot, &entry_ino_num, NULL); if (err) { ASSERT(err == ENOENT); - err = libxfs_trans_reserve(tp, &M_RES(mp)->tr_rename, + err = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_rename, nres, 0); if (err) do_error( @@ -1138,7 +1138,7 @@ mv_orphanage( libxfs_trans_ijoin(tp, ino_p, 0); xfs_bmap_init(&flist, &first); - err = libxfs_dir_createname(tp, orphanage_ip, &xname, + err = -libxfs_dir_createname(tp, orphanage_ip, &xname, ino, &first, &flist, nres); if (err) do_error( @@ -1151,7 +1151,7 @@ mv_orphanage( orphanage_ip->i_d.di_nlink++; libxfs_trans_log_inode(tp, orphanage_ip, XFS_ILOG_CORE); - err = libxfs_dir_createname(tp, ino_p, &xfs_name_dotdot, + err = -libxfs_dir_createname(tp, ino_p, &xfs_name_dotdot, orphanage_ino, &first, &flist, nres); if (err) do_error( @@ -1161,7 +1161,7 @@ mv_orphanage( ino_p->i_d.di_nlink++; libxfs_trans_log_inode(tp, ino_p, XFS_ILOG_CORE); - err = libxfs_bmap_finish(&tp, &flist, &committed); + err = -libxfs_bmap_finish(&tp, &flist, &committed); if (err) do_error( _("bmap finish failed (err - %d), filesystem may be out of space\n"), @@ -1170,7 +1170,7 @@ mv_orphanage( libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_SYNC); } else { - err = libxfs_trans_reserve(tp, &M_RES(mp)->tr_rename, + err = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_rename, nres, 0); if (err) do_error( @@ -1182,7 +1182,7 @@ mv_orphanage( xfs_bmap_init(&flist, &first); - err = libxfs_dir_createname(tp, orphanage_ip, &xname, + err = -libxfs_dir_createname(tp, orphanage_ip, &xname, ino, &first, &flist, nres); if (err) do_error( @@ -1200,7 +1200,7 @@ mv_orphanage( * to us. that'll pop a libxfs/kernel ASSERT. */ if (entry_ino_num != orphanage_ino) { - err = libxfs_dir_replace(tp, ino_p, + err = -libxfs_dir_replace(tp, ino_p, &xfs_name_dotdot, orphanage_ino, &first, &flist, nres); if (err) @@ -1209,7 +1209,7 @@ mv_orphanage( err); } - err = libxfs_bmap_finish(&tp, &flist, &committed); + err = -libxfs_bmap_finish(&tp, &flist, &committed); if (err) do_error( _("bmap finish failed (%d), filesystem may be out of space\n"), @@ -1227,7 +1227,7 @@ mv_orphanage( * also accounted for in the create */ nres = XFS_DIRENTER_SPACE_RES(mp, xname.len); - err = libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, + err = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); if (err) do_error( @@ -1238,7 +1238,7 @@ mv_orphanage( libxfs_trans_ijoin(tp, ino_p, 0); xfs_bmap_init(&flist, &first); - err = libxfs_dir_createname(tp, orphanage_ip, &xname, ino, + err = -libxfs_dir_createname(tp, orphanage_ip, &xname, ino, &first, &flist, nres); if (err) do_error( @@ -1249,7 +1249,7 @@ mv_orphanage( ino_p->i_d.di_nlink = 1; libxfs_trans_log_inode(tp, ino_p, XFS_ILOG_CORE); - err = libxfs_bmap_finish(&tp, &flist, &committed); + err = -libxfs_bmap_finish(&tp, &flist, &committed); if (err) do_error( _("bmap finish failed (%d), filesystem may be out of space\n"), @@ -1326,17 +1326,17 @@ longform_dir2_rebuild( tp = libxfs_trans_alloc(mp, 0); nres = XFS_REMOVE_SPACE_RES(mp); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); if (error) res_failed(error); libxfs_trans_ijoin(tp, ip, 0); - if ((error = libxfs_bmap_last_offset(ip, &lastblock, XFS_DATA_FORK))) + if ((error = -libxfs_bmap_last_offset(ip, &lastblock, XFS_DATA_FORK))) do_error(_("xfs_bmap_last_offset failed -- error - %d\n"), error); /* free all data, leaf, node and freespace blocks */ - error = libxfs_bunmapi(tp, ip, 0, lastblock, XFS_BMAPI_METADATA, 0, + error = -libxfs_bunmapi(tp, ip, 0, lastblock, XFS_BMAPI_METADATA, 0, &firstblock, &flist, &done); if (error) { do_warn(_("xfs_bunmapi failed -- error - %d\n"), error); @@ -1351,7 +1351,7 @@ longform_dir2_rebuild( goto out_bmap_cancel; } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_SYNC); @@ -1369,7 +1369,7 @@ longform_dir2_rebuild( tp = libxfs_trans_alloc(mp, 0); nres = XFS_CREATE_SPACE_RES(mp, p->name.len); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_create, + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_create, nres, 0); if (error) res_failed(error); @@ -1377,7 +1377,7 @@ longform_dir2_rebuild( libxfs_trans_ijoin(tp, ip, 0); xfs_bmap_init(&flist, &firstblock); - error = libxfs_dir_createname(tp, ip, &p->name, p->inum, + error = -libxfs_dir_createname(tp, ip, &p->name, p->inum, &firstblock, &flist, nres); if (error) { do_warn( @@ -1386,7 +1386,7 @@ _("name create failed in ino %" PRIu64 " (%d), filesystem may be out of space\n" goto out_bmap_cancel; } - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); if (error) { do_warn( _("bmap finish failed (%d), filesystem may be out of space\n"), @@ -1428,7 +1428,7 @@ dir2_kill_block( tp = libxfs_trans_alloc(mp, 0); nres = XFS_REMOVE_SPACE_RES(mp); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); if (error) res_failed(error); libxfs_trans_ijoin(tp, ip, 0); @@ -1441,9 +1441,9 @@ dir2_kill_block( args.flist = &flist; args.whichfork = XFS_DATA_FORK; if (da_bno >= mp->m_dir_geo->leafblk && da_bno < mp->m_dir_geo->freeblk) - error = libxfs_da_shrink_inode(&args, da_bno, bp); + error = -libxfs_da_shrink_inode(&args, da_bno, bp); else - error = libxfs_dir2_shrink_inode(&args, + error = -libxfs_dir2_shrink_inode(&args, xfs_dir2_da_to_db(mp->m_dir_geo, da_bno), bp); if (error) do_error(_("shrink_inode failed inode %" PRIu64 " block %u\n"), @@ -1618,7 +1618,7 @@ longform_dir2_entry_check_data( freetab->nents = db + 1; tp = libxfs_trans_alloc(mp, 0); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, 0, 0); + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, 0, 0); if (error) res_failed(error); da.trans = tp; @@ -2858,7 +2858,7 @@ process_dir_inode( ASSERT(!is_inode_refchecked(irec, ino_offset) || dotdot_update); - error = libxfs_iget(mp, NULL, ino, 0, &ip, 0); + error = -libxfs_iget(mp, NULL, ino, 0, &ip, 0); if (error) { if (!no_modify) do_error( @@ -2929,7 +2929,7 @@ process_dir_inode( * new define in ourselves. */ nres = no_modify ? 0 : XFS_REMOVE_SPACE_RES(mp); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); if (error) res_failed(error); @@ -2977,7 +2977,7 @@ process_dir_inode( ASSERT(tp != NULL); nres = XFS_MKDIR_SPACE_RES(mp, 2); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0); + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0); if (error) res_failed(error); @@ -2985,7 +2985,7 @@ process_dir_inode( xfs_bmap_init(&flist, &first); - error = libxfs_dir_createname(tp, ip, &xfs_name_dotdot, + error = -libxfs_dir_createname(tp, ip, &xfs_name_dotdot, ip->i_ino, &first, &flist, nres); if (error) do_error( @@ -2993,7 +2993,7 @@ process_dir_inode( libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); ASSERT(error == 0); libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_SYNC); @@ -3037,7 +3037,7 @@ process_dir_inode( ASSERT(tp != NULL); nres = XFS_MKDIR_SPACE_RES(mp, 1); - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0); if (error) res_failed(error); @@ -3046,7 +3046,7 @@ process_dir_inode( xfs_bmap_init(&flist, &first); - error = libxfs_dir_createname(tp, ip, &xfs_name_dot, + error = -libxfs_dir_createname(tp, ip, &xfs_name_dot, ip->i_ino, &first, &flist, nres); if (error) do_error( @@ -3055,7 +3055,7 @@ process_dir_inode( libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); - error = libxfs_bmap_finish(&tp, &flist, &committed); + error = -libxfs_bmap_finish(&tp, &flist, &committed); ASSERT(error == 0); libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES |XFS_TRANS_SYNC); diff --git a/repair/phase7.c b/repair/phase7.c index 04dd63b76..becacf83f 100644 --- a/repair/phase7.c +++ b/repair/phase7.c @@ -67,10 +67,10 @@ update_inode_nlinks( tp = libxfs_trans_alloc(mp, XFS_TRANS_REMOVE); nres = no_modify ? 0 : 10; - error = libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); + error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0); ASSERT(error == 0); - error = libxfs_trans_iget(mp, tp, ino, 0, 0, &ip); + error = -libxfs_trans_iget(mp, tp, ino, 0, 0, &ip); if (error) { if (!no_modify) @@ -101,7 +101,7 @@ update_inode_nlinks( * we're not allocating anything */ ASSERT(error == 0); - error = libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES | + error = -libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_SYNC); ASSERT(error == 0); -- 2.50.1