From: Nathan Scott Date: Thu, 12 Apr 2001 23:30:32 +0000 (+0000) Subject: sync with kernel, dirent -> xfs_dirent. X-Git-Tag: Release-1_0_0~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e2665707d3dcc38aeb73fe41085ce9425b4b18f;p=thirdparty%2Fxfsprogs-dev.git sync with kernel, dirent -> xfs_dirent. --- diff --git a/include/xfs_dir2.h b/include/xfs_dir2.h index a0aa60f51..10f0188cf 100644 --- a/include/xfs_dir2.h +++ b/include/xfs_dir2.h @@ -79,7 +79,7 @@ typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa); typedef struct xfs_dir2_put_args { xfs_off_t cook; /* cookie of (next) entry */ xfs_intino_t ino; /* inode number */ - struct dirent *dbp; /* buffer pointer */ + struct xfs_dirent *dbp; /* buffer pointer */ char *name; /* directory entry name */ int namelen; /* length of name */ int done; /* output: set if value was stored */ diff --git a/include/xfs_dir2_block.h b/include/xfs_dir2_block.h index 049f598da..0018607b1 100644 --- a/include/xfs_dir2_block.h +++ b/include/xfs_dir2_block.h @@ -106,7 +106,7 @@ extern int extern int xfs_dir2_block_getdents(struct xfs_trans *tp, struct xfs_inode *dp, - struct uio *uio, int *eofp, struct dirent *dbp, + struct uio *uio, int *eofp, struct xfs_dirent *dbp, xfs_dir2_put_t put); extern int diff --git a/include/xfs_dir2_leaf.h b/include/xfs_dir2_leaf.h index f7ef39678..0c044a456 100644 --- a/include/xfs_dir2_leaf.h +++ b/include/xfs_dir2_leaf.h @@ -319,7 +319,7 @@ extern void extern int xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp, - struct uio *uio, int *eofp, struct dirent *dbp, + struct uio *uio, int *eofp, struct xfs_dirent *dbp, xfs_dir2_put_t put); extern int diff --git a/include/xfs_dir2_sf.h b/include/xfs_dir2_sf.h index b74dd752e..a8a7fcc6b 100644 --- a/include/xfs_dir2_sf.h +++ b/include/xfs_dir2_sf.h @@ -242,7 +242,7 @@ extern int extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp, - struct dirent *dbp, xfs_dir2_put_t put); + struct xfs_dirent *dbp, xfs_dir2_put_t put); extern int xfs_dir2_sf_lookup(struct xfs_da_args *args); diff --git a/include/xfs_dir_leaf.h b/include/xfs_dir_leaf.h index f8bf1b576..0082b5cec 100644 --- a/include/xfs_dir_leaf.h +++ b/include/xfs_dir_leaf.h @@ -150,7 +150,7 @@ typedef struct xfs_dir_put_args { xfs_dircook_t cook; /* cookie of (next) entry */ xfs_intino_t ino; /* inode number */ - struct dirent *dbp; /* buffer pointer */ + struct xfs_dirent *dbp; /* buffer pointer */ char *name; /* directory entry name */ int namelen; /* length of name */ int done; /* output: set if value was stored */ @@ -196,7 +196,7 @@ int xfs_dir_shortform_lookup(struct xfs_da_args *args); int xfs_dir_shortform_to_leaf(struct xfs_da_args *args); int xfs_dir_shortform_removename(struct xfs_da_args *args); int xfs_dir_shortform_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp, - struct dirent *dbp, xfs_dir_put_t put); + struct xfs_dirent *dbp, xfs_dir_put_t put); int xfs_dir_shortform_replace(struct xfs_da_args *args); /* @@ -224,7 +224,7 @@ int xfs_dir_leaf_remove(struct xfs_trans *trans, int index_to_remove); int xfs_dir_leaf_getdents_int(struct xfs_dabuf *bp, struct xfs_inode *dp, xfs_dablk_t bno, struct uio *uio, - int *eobp, struct dirent *dbp, + int *eobp, struct xfs_dirent *dbp, xfs_dir_put_t put, xfs_daddr_t nextda); /* diff --git a/libxfs/Makefile b/libxfs/Makefile index 2f833d925..644137a60 100644 --- a/libxfs/Makefile +++ b/libxfs/Makefile @@ -52,7 +52,7 @@ CFILES = arch.c init.c logitem.c rdwr.c trans.c util.c \ # -DLI_DEBUG log item (ino/buf) manipulation # -DXACT_DEBUG transaction state changes # -LCFLAGS += -Wno-unknown-pragmas -Wno-unused -Wno-uninitialized -I. +LCFLAGS += -I. # don't try linking xfs_repair with a debug libxfs. DEBUG = -DNDEBUG diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 1e1d44ae4..3c9aa38dc 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -456,7 +456,6 @@ libxfs_iput(xfs_inode_t *ip, uint lock_flags) void libxfs_mod_sb(xfs_trans_t *tp, __int64_t fields) { - int fd; xfs_buf_t *bp; xfs_mount_t *mp; diff --git a/libxfs/trans.c b/libxfs/trans.c index 63c894ea2..4b2bce5bc 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -714,7 +714,6 @@ int libxfs_trans_commit(xfs_trans_t *tp, uint flags, xfs_lsn_t *commit_lsn_p) { xfs_sb_t *sbp; - int error; if (tp == NULL) return 0; diff --git a/libxfs/util.c b/libxfs/util.c index 71cfbad2b..74da15776 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -526,11 +526,11 @@ xfs_dir2_bogus_removename( */ if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) rval = xfs_dir2_sf_removename(&args); - else if (rval = xfs_dir2_isblock(tp, dp, &v)) + else if ((rval = xfs_dir2_isblock(tp, dp, &v))) return rval; else if (v) rval = xfs_dir2_block_removename(&args); - else if (rval = xfs_dir2_isleaf(tp, dp, &v)) + else if ((rval = xfs_dir2_isleaf(tp, dp, &v))) return rval; else if (v) rval = xfs_dir2_leaf_removename(&args); @@ -577,7 +577,6 @@ libxfs_bmap_finish( xfs_bmap_free_item_t *free; /* free extent list item */ xfs_bmap_free_item_t *next; /* next item on free list */ int error; - xfs_trans_t *ntp; if (flist->xbf_count == 0) { *committed = 0; @@ -586,8 +585,8 @@ libxfs_bmap_finish( for (free = flist->xbf_first; free != NULL; free = next) { next = free->xbfi_next; - if (error = xfs_free_extent(*tp, free->xbfi_startblock, - free->xbfi_blockcount)) + if ((error = xfs_free_extent(*tp, free->xbfi_startblock, + free->xbfi_blockcount))) return error; xfs_bmap_del_free(flist, NULL, free); } diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 9792416be..aa2000cc6 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -82,8 +82,8 @@ xfs_alloc_compute_diff( xfs_agblock_t freeend; /* end of freespace extent */ xfs_agblock_t newbno1; /* return block number */ xfs_agblock_t newbno2; /* other new block number */ - xfs_extlen_t newlen1; /* length with newbno1 */ - xfs_extlen_t newlen2; /* length with newbno2 */ + xfs_extlen_t newlen1=0; /* length with newbno1 */ + xfs_extlen_t newlen2=0; /* length with newbno2 */ xfs_agblock_t wantend; /* end of target extent */ ASSERT(freelen >= wantlen); @@ -209,21 +209,21 @@ xfs_alloc_fixup_trees( int i; /* operation results */ xfs_agblock_t nfbno1; /* first new free startblock */ xfs_agblock_t nfbno2; /* second new free startblock */ - xfs_extlen_t nflen1; /* first new free length */ - xfs_extlen_t nflen2; /* second new free length */ + xfs_extlen_t nflen1=0; /* first new free length */ + xfs_extlen_t nflen2=0; /* second new free length */ /* * Look up the record in the by-size tree if necessary. */ if (flags & XFSA_FIXUP_CNT_OK) { #ifdef DEBUG - if (error = xfs_alloc_get_rec(cnt_cur, &nfbno1, &nflen1, &i)) + if ((error = xfs_alloc_get_rec(cnt_cur, &nfbno1, &nflen1, &i))) return error; XFS_WANT_CORRUPTED_RETURN( i == 1 && nfbno1 == fbno && nflen1 == flen); #endif } else { - if (error = xfs_alloc_lookup_eq(cnt_cur, fbno, flen, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, fbno, flen, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } @@ -232,13 +232,13 @@ xfs_alloc_fixup_trees( */ if (flags & XFSA_FIXUP_BNO_OK) { #ifdef DEBUG - if (error = xfs_alloc_get_rec(bno_cur, &nfbno1, &nflen1, &i)) + if ((error = xfs_alloc_get_rec(bno_cur, &nfbno1, &nflen1, &i))) return error; XFS_WANT_CORRUPTED_RETURN( i == 1 && nfbno1 == fbno && nflen1 == flen); #endif } else { - if (error = xfs_alloc_lookup_eq(bno_cur, fbno, flen, &i)) + if ((error = xfs_alloc_lookup_eq(bno_cur, fbno, flen, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } @@ -280,25 +280,25 @@ xfs_alloc_fixup_trees( /* * Delete the entry from the by-size btree. */ - if (error = xfs_alloc_delete(cnt_cur, &i)) + if ((error = xfs_alloc_delete(cnt_cur, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); /* * Add new by-size btree entry(s). */ if (nfbno1 != NULLAGBLOCK) { - if (error = xfs_alloc_lookup_eq(cnt_cur, nfbno1, nflen1, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, nfbno1, nflen1, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 0); - if (error = xfs_alloc_insert(cnt_cur, &i)) + if ((error = xfs_alloc_insert(cnt_cur, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } if (nfbno2 != NULLAGBLOCK) { - if (error = xfs_alloc_lookup_eq(cnt_cur, nfbno2, nflen2, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, nfbno2, nflen2, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 0); - if (error = xfs_alloc_insert(cnt_cur, &i)) + if ((error = xfs_alloc_insert(cnt_cur, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } @@ -309,24 +309,24 @@ xfs_alloc_fixup_trees( /* * No remaining freespace, just delete the by-block tree entry. */ - if (error = xfs_alloc_delete(bno_cur, &i)) + if ((error = xfs_alloc_delete(bno_cur, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } else { /* * Update the by-block entry to start later|be shorter. */ - if (error = xfs_alloc_update(bno_cur, nfbno1, nflen1)) + if ((error = xfs_alloc_update(bno_cur, nfbno1, nflen1))) return error; } if (nfbno2 != NULLAGBLOCK) { /* * 2 resulting free entries, need to add one. */ - if (error = xfs_alloc_lookup_eq(bno_cur, nfbno2, nflen2, &i)) + if ((error = xfs_alloc_lookup_eq(bno_cur, nfbno2, nflen2, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 0); - if (error = xfs_alloc_insert(bno_cur, &i)) + if ((error = xfs_alloc_insert(bno_cur, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } @@ -349,7 +349,7 @@ xfs_alloc_read_agfl( ASSERT(agno != NULLAGNUMBER); d = XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR); - if (error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, 0, &bp)) + if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, 0, &bp))) return error; ASSERT(bp); ASSERT(!XFS_BUF_GETERROR(bp)); @@ -470,7 +470,7 @@ STATIC int /* error */ xfs_alloc_ag_vextent( xfs_alloc_arg_t *args) /* argument structure for allocation */ { - int error; + int error=0; #ifdef XFS_ALLOC_TRACE static char fname[] = "xfs_alloc_ag_vextent"; #endif @@ -573,8 +573,7 @@ xfs_alloc_ag_vextent_exact( * Look for the closest free block <= bno, it must contain bno * if any free block does. */ - if (error = xfs_alloc_lookup_le(bno_cur, args->agbno, args->minlen, - &i)) + if ((error = xfs_alloc_lookup_le(bno_cur, args->agbno, args->minlen, &i))) goto error0; if (!i) { /* @@ -587,7 +586,7 @@ xfs_alloc_ag_vextent_exact( /* * Grab the freespace record. */ - if (error = xfs_alloc_get_rec(bno_cur, &fbno, &flen, &i)) + if ((error = xfs_alloc_get_rec(bno_cur, &fbno, &flen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); ASSERT(fbno <= args->agbno); @@ -628,8 +627,8 @@ xfs_alloc_ag_vextent_exact( ASSERT(args->agbno + args->len <= INT_GET(XFS_BUF_TO_AGF(args->agbp)->agf_length, ARCH_CONVERT)); - if (error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen, - args->agbno, args->len, XFSA_FIXUP_BNO_OK)) { + if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen, + args->agbno, args->len, XFSA_FIXUP_BNO_OK))) { xfs_btree_del_cursor(cnt_cur, XFS_BTREE_ERROR); goto error0; } @@ -703,15 +702,15 @@ xfs_alloc_ag_vextent_near( /* * See if there are any free extents as big as maxlen. */ - if (error = xfs_alloc_lookup_ge(cnt_cur, 0, args->maxlen, &i)) + if ((error = xfs_alloc_lookup_ge(cnt_cur, 0, args->maxlen, &i))) goto error0; /* * If none, then pick up the last entry in the tree unless the * tree is empty. */ if (!i) { - if (error = xfs_alloc_ag_vextent_small(args, cnt_cur, <bno, - <len, &i)) + if ((error = xfs_alloc_ag_vextent_small(args, cnt_cur, <bno, + <len, &i))) goto error0; if (i == 0 || ltlen == 0) { xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); @@ -732,9 +731,9 @@ xfs_alloc_ag_vextent_near( */ while (xfs_btree_islastblock(cnt_cur, 0)) { xfs_extlen_t bdiff; - int besti; - xfs_extlen_t blen; - xfs_agblock_t bnew; + int besti=0; + xfs_extlen_t blen=0; + xfs_agblock_t bnew=0; #if defined(DEBUG) && defined(__KERNEL__) if (!dofirst) @@ -749,13 +748,13 @@ xfs_alloc_ag_vextent_near( if (ltlen || args->alignment > 1) { cnt_cur->bc_ptrs[0] = 1; do { - if (error = xfs_alloc_get_rec(cnt_cur, <bno, - <len, &i)) + if ((error = xfs_alloc_get_rec(cnt_cur, <bno, + <len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (ltlen >= args->minlen) break; - if (error = xfs_alloc_increment(cnt_cur, 0, &i)) + if ((error = xfs_alloc_increment(cnt_cur, 0, &i))) goto error0; } while (i); ASSERT(ltlen >= args->minlen); @@ -770,8 +769,7 @@ xfs_alloc_ag_vextent_near( * For each entry, decide if it's better than * the previous best entry. */ - if (error = xfs_alloc_get_rec(cnt_cur, <bno, <len, - &i)) + if ((error = xfs_alloc_get_rec(cnt_cur, <bno, <len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (!xfs_alloc_compute_aligned(ltbno, ltlen, @@ -803,7 +801,7 @@ xfs_alloc_ag_vextent_near( * Point at the best entry, and retrieve it again. */ cnt_cur->bc_ptrs[0] = besti; - if (error = xfs_alloc_get_rec(cnt_cur, <bno, <len, &i)) + if ((error = xfs_alloc_get_rec(cnt_cur, <bno, <len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); ltend = ltbno + ltlen; @@ -830,8 +828,8 @@ xfs_alloc_ag_vextent_near( /* * Fix up the btree entries. */ - if (error = xfs_alloc_fixup_trees(cnt_cur, bno_cur_lt, ltbno, - ltlen, bnew, blen, XFSA_FIXUP_CNT_OK)) + if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur_lt, ltbno, + ltlen, bnew, blen, XFSA_FIXUP_CNT_OK))) goto error0; xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); xfs_btree_del_cursor(bno_cur_lt, XFS_BTREE_NOERROR); @@ -858,8 +856,7 @@ xfs_alloc_ag_vextent_near( /* * Lookup <= bno to find the leftward search's starting point. */ - if (error = xfs_alloc_lookup_le(bno_cur_lt, args->agbno, args->maxlen, - &i)) + if ((error = xfs_alloc_lookup_le(bno_cur_lt, args->agbno, args->maxlen, &i))) goto error0; if (!i) { /* @@ -872,13 +869,13 @@ xfs_alloc_ag_vextent_near( /* * Found something. Duplicate the cursor for the rightward search. */ - else if (error = xfs_btree_dup_cursor(bno_cur_lt, &bno_cur_gt)) + else if ((error = xfs_btree_dup_cursor(bno_cur_lt, &bno_cur_gt))) goto error0; /* * Increment the cursor, so we will point at the entry just right * of the leftward entry if any, or to the leftmost entry. */ - if (error = xfs_alloc_increment(bno_cur_gt, 0, &i)) + if ((error = xfs_alloc_increment(bno_cur_gt, 0, &i))) goto error0; if (!i) { /* @@ -894,15 +891,14 @@ xfs_alloc_ag_vextent_near( */ do { if (bno_cur_lt) { - if (error = xfs_alloc_get_rec(bno_cur_lt, <bno, - <len, &i)) + if ((error = xfs_alloc_get_rec(bno_cur_lt, <bno, <len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment, args->minlen, <bnoa, <lena)) break; - if (error = xfs_alloc_decrement(bno_cur_lt, 0, &i)) + if ((error = xfs_alloc_decrement(bno_cur_lt, 0, &i))) goto error0; if (!i) { xfs_btree_del_cursor(bno_cur_lt, @@ -911,15 +907,14 @@ xfs_alloc_ag_vextent_near( } } if (bno_cur_gt) { - if (error = xfs_alloc_get_rec(bno_cur_gt, >bno, - >len, &i)) + if ((error = xfs_alloc_get_rec(bno_cur_gt, >bno, >len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (xfs_alloc_compute_aligned(gtbno, gtlen, args->alignment, args->minlen, >bnoa, >lena)) break; - if (error = xfs_alloc_increment(bno_cur_gt, 0, &i)) + if ((error = xfs_alloc_increment(bno_cur_gt, 0, &i))) goto error0; if (!i) { xfs_btree_del_cursor(bno_cur_gt, @@ -953,9 +948,9 @@ xfs_alloc_ag_vextent_near( * space, or run off the end. */ while (bno_cur_lt && bno_cur_gt) { - if (error = xfs_alloc_get_rec( + if ((error = xfs_alloc_get_rec( bno_cur_gt, >bno, - >len, &i)) + >len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); xfs_alloc_compute_aligned(gtbno, gtlen, @@ -1008,8 +1003,8 @@ xfs_alloc_ag_vextent_near( /* * Fell off the right end. */ - if (error = xfs_alloc_increment( - bno_cur_gt, 0, &i)) + if ((error = xfs_alloc_increment( + bno_cur_gt, 0, &i))) goto error0; if (!i) { xfs_btree_del_cursor( @@ -1050,9 +1045,9 @@ xfs_alloc_ag_vextent_near( * space, or run off the end. */ while (bno_cur_lt && bno_cur_gt) { - if (error = xfs_alloc_get_rec( + if ((error = xfs_alloc_get_rec( bno_cur_lt, <bno, - <len, &i)) + <len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); xfs_alloc_compute_aligned(ltbno, ltlen, @@ -1104,8 +1099,8 @@ xfs_alloc_ag_vextent_near( /* * Fell off the left end. */ - if (error = xfs_alloc_decrement( - bno_cur_lt, 0, &i)) + if ((error = xfs_alloc_decrement( + bno_cur_lt, 0, &i))) goto error0; if (!i) { xfs_btree_del_cursor(bno_cur_lt, @@ -1169,8 +1164,8 @@ xfs_alloc_ag_vextent_near( ASSERT(ltnew + rlen <= INT_GET(XFS_BUF_TO_AGF(args->agbp)->agf_length, ARCH_CONVERT)); args->agbno = ltnew; - if (error = xfs_alloc_fixup_trees(cnt_cur, bno_cur_lt, ltbno, ltlen, - ltnew, rlen, XFSA_FIXUP_BNO_OK)) + if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur_lt, ltbno, ltlen, + ltnew, rlen, XFSA_FIXUP_BNO_OK))) goto error0; TRACE_ALLOC(j ? "gt" : "lt", args); xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); @@ -1219,16 +1214,16 @@ xfs_alloc_ag_vextent_size( /* * Look for an entry >= maxlen+alignment-1 blocks. */ - if (error = xfs_alloc_lookup_ge(cnt_cur, 0, - args->maxlen + args->alignment - 1, &i)) + if ((error = xfs_alloc_lookup_ge(cnt_cur, 0, + args->maxlen + args->alignment - 1, &i))) goto error0; /* * If none, then pick up the last entry in the tree unless the * tree is empty. */ if (!i) { - if (error = xfs_alloc_ag_vextent_small(args, cnt_cur, &fbno, - &flen, &i)) + if ((error = xfs_alloc_ag_vextent_small(args, cnt_cur, &fbno, + &flen, &i))) goto error0; if (i == 0 || flen == 0) { xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); @@ -1241,7 +1236,7 @@ xfs_alloc_ag_vextent_size( * There's a freespace as big as maxlen+alignment-1, get it. */ else { - if (error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, &i)) + if ((error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); } @@ -1267,12 +1262,12 @@ xfs_alloc_ag_vextent_size( bestflen = flen; bestfbno = fbno; for (;;) { - if (error = xfs_alloc_decrement(cnt_cur, 0, &i)) + if ((error = xfs_alloc_decrement(cnt_cur, 0, &i))) goto error0; if (i == 0) break; - if (error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, - &i)) + if ((error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, + &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (flen < bestrlen) @@ -1292,8 +1287,8 @@ xfs_alloc_ag_vextent_size( break; } } - if (error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen, - &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen, + &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); rlen = bestrlen; @@ -1320,8 +1315,8 @@ xfs_alloc_ag_vextent_size( */ bno_cur = xfs_btree_init_cursor(args->mp, args->tp, args->agbp, args->agno, XFS_BTNUM_BNO, 0, 0); - if (error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen, - rbno, rlen, XFSA_FIXUP_CNT_OK)) + if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen, + rbno, rlen, XFSA_FIXUP_CNT_OK))) goto error0; xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); xfs_btree_del_cursor(bno_cur, XFS_BTREE_NOERROR); @@ -1366,10 +1361,10 @@ xfs_alloc_ag_vextent_small( #endif int i; - if (error = xfs_alloc_decrement(ccur, 0, &i)) + if ((error = xfs_alloc_decrement(ccur, 0, &i))) goto error0; if (i) { - if (error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i)) + if ((error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); } @@ -1381,7 +1376,7 @@ xfs_alloc_ag_vextent_small( else if (args->minlen == 1 && args->alignment == 1 && !args->isfl && (INT_GET(XFS_BUF_TO_AGF(args->agbp)->agf_flcount, ARCH_CONVERT) > args->minleft)) { - if (error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno)) + if ((error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno))) goto error0; if (fbno != NULLAGBLOCK) { if (args->userdata) { @@ -1484,13 +1479,13 @@ xfs_free_ag_extent( * Look for a neighboring block on the left (lower block numbers) * that is contiguous with this space. */ - if (error = xfs_alloc_lookup_le(bno_cur, bno, len, &haveleft)) + if ((error = xfs_alloc_lookup_le(bno_cur, bno, len, &haveleft))) goto error0; if (haveleft) { /* * There is a block to our left. */ - if (error = xfs_alloc_get_rec(bno_cur, <bno, <len, &i)) + if ((error = xfs_alloc_get_rec(bno_cur, <bno, <len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* @@ -1511,13 +1506,13 @@ xfs_free_ag_extent( * Look for a neighboring block on the right (higher block numbers) * that is contiguous with this space. */ - if (error = xfs_alloc_increment(bno_cur, 0, &haveright)) + if ((error = xfs_alloc_increment(bno_cur, 0, &haveright))) goto error0; if (haveright) { /* * There is a block to our right. */ - if (error = xfs_alloc_get_rec(bno_cur, >bno, >len, &i)) + if ((error = xfs_alloc_get_rec(bno_cur, >bno, >len, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* @@ -1547,31 +1542,31 @@ xfs_free_ag_extent( /* * Delete the old by-size entry on the left. */ - if (error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_delete(cnt_cur, &i)) + if ((error = xfs_alloc_delete(cnt_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* * Delete the old by-size entry on the right. */ - if (error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_delete(cnt_cur, &i)) + if ((error = xfs_alloc_delete(cnt_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* * Delete the old by-block entry for the right block. */ - if (error = xfs_alloc_delete(bno_cur, &i)) + if ((error = xfs_alloc_delete(bno_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* * Move the by-block cursor back to the left neighbor. */ - if (error = xfs_alloc_decrement(bno_cur, 0, &i)) + if ((error = xfs_alloc_decrement(bno_cur, 0, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); #ifdef DEBUG @@ -1583,8 +1578,8 @@ xfs_free_ag_extent( xfs_agblock_t xxbno; xfs_extlen_t xxlen; - if (error = xfs_alloc_get_rec(bno_cur, &xxbno, &xxlen, - &i)) + if ((error = xfs_alloc_get_rec(bno_cur, &xxbno, &xxlen, + &i))) goto error0; XFS_WANT_CORRUPTED_GOTO( i == 1 && xxbno == ltbno && xxlen == ltlen, @@ -1596,7 +1591,7 @@ xfs_free_ag_extent( */ nbno = ltbno; nlen = len + ltlen + gtlen; - if (error = xfs_alloc_update(bno_cur, nbno, nlen)) + if ((error = xfs_alloc_update(bno_cur, nbno, nlen))) goto error0; } /* @@ -1607,22 +1602,22 @@ xfs_free_ag_extent( /* * Delete the old by-size entry on the left. */ - if (error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_delete(cnt_cur, &i)) + if ((error = xfs_alloc_delete(cnt_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* * Back up the by-block cursor to the left neighbor, and * update its length. */ - if (error = xfs_alloc_decrement(bno_cur, 0, &i)) + if ((error = xfs_alloc_decrement(bno_cur, 0, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); nbno = ltbno; nlen = len + ltlen; - if (error = xfs_alloc_update(bno_cur, nbno, nlen)) + if ((error = xfs_alloc_update(bno_cur, nbno, nlen))) goto error0; } /* @@ -1633,10 +1628,10 @@ xfs_free_ag_extent( /* * Delete the old by-size entry on the right. */ - if (error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_delete(cnt_cur, &i)) + if ((error = xfs_alloc_delete(cnt_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); /* @@ -1645,7 +1640,7 @@ xfs_free_ag_extent( */ nbno = bno; nlen = len + gtlen; - if (error = xfs_alloc_update(bno_cur, nbno, nlen)) + if ((error = xfs_alloc_update(bno_cur, nbno, nlen))) goto error0; } /* @@ -1655,7 +1650,7 @@ xfs_free_ag_extent( else { nbno = bno; nlen = len; - if (error = xfs_alloc_insert(bno_cur, &i)) + if ((error = xfs_alloc_insert(bno_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); } @@ -1664,10 +1659,10 @@ xfs_free_ag_extent( /* * In all cases we need to insert the new freespace in the by-size tree. */ - if (error = xfs_alloc_lookup_eq(cnt_cur, nbno, nlen, &i)) + if ((error = xfs_alloc_lookup_eq(cnt_cur, nbno, nlen, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 0, error0); - if (error = xfs_alloc_insert(cnt_cur, &i)) + if ((error = xfs_alloc_insert(cnt_cur, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); @@ -1765,8 +1760,8 @@ xfs_alloc_fix_freelist( pag = args->pag; tp = args->tp; if (!pag->pagf_init) { - if (error = xfs_alloc_read_agf(mp, tp, args->agno, flags, - &agbp)) + if ((error = xfs_alloc_read_agf(mp, tp, args->agno, flags, + &agbp))) return error; if (!pag->pagf_init) { args->agbp = NULL; @@ -1798,8 +1793,8 @@ xfs_alloc_fix_freelist( * Can fail if we're not blocking on locks, and it's held. */ if (agbp == NULL) { - if (error = xfs_alloc_read_agf(mp, tp, args->agno, flags, - &agbp)) + if ((error = xfs_alloc_read_agf(mp, tp, args->agno, flags, + &agbp))) return error; if (agbp == NULL) { args->agbp = NULL; @@ -1834,9 +1829,9 @@ xfs_alloc_fix_freelist( while (INT_GET(agf->agf_flcount, ARCH_CONVERT) > need) { xfs_buf_t *bp; - if (error = xfs_alloc_get_freelist(tp, agbp, &bno)) + if ((error = xfs_alloc_get_freelist(tp, agbp, &bno))) return error; - if (error = xfs_free_ag_extent(tp, agbp, args->agno, bno, 1, 1)) + if ((error = xfs_free_ag_extent(tp, agbp, args->agno, bno, 1, 1))) return error; bp = xfs_btree_get_bufs(mp, tp, args->agno, bno, 0); xfs_trans_binval(tp, bp); @@ -1872,7 +1867,7 @@ xfs_alloc_fix_freelist( targs.alignment = targs.minlen = targs.prod = targs.isfl = 1; targs.type = XFS_ALLOCTYPE_THIS_AG; targs.pag = pag; - if (error = xfs_alloc_read_agfl(mp, tp, targs.agno, &agflbp)) + if ((error = xfs_alloc_read_agfl(mp, tp, targs.agno, &agflbp))) return error; /* * Make the freelist longer if it's too short. @@ -1883,7 +1878,7 @@ xfs_alloc_fix_freelist( /* * Allocate as many blocks as possible at once. */ - if (error = xfs_alloc_ag_vextent(&targs)) + if ((error = xfs_alloc_ag_vextent(&targs))) return error; /* * Stop if we run out. Won't happen if callers are obeying @@ -1896,8 +1891,8 @@ xfs_alloc_fix_freelist( * Put each allocated block on the list. */ for (bno = targs.agbno; bno < targs.agbno + targs.len; bno++) { - if (error = xfs_alloc_put_freelist(tp, agbp, agflbp, - bno)) + if ((error = xfs_alloc_put_freelist(tp, agbp, agflbp, + bno))) return error; } } @@ -1938,8 +1933,8 @@ xfs_alloc_get_freelist( * Read the array of free blocks. */ mp = tp->t_mountp; - if (error = xfs_alloc_read_agfl(mp, tp, - INT_GET(agf->agf_seqno, ARCH_CONVERT), &agflbp)) + if ((error = xfs_alloc_read_agfl(mp, tp, + INT_GET(agf->agf_seqno, ARCH_CONVERT), &agflbp))) return error; agfl = XFS_BUF_TO_AGFL(agflbp); /* @@ -2003,7 +1998,7 @@ xfs_alloc_pagf_init( xfs_buf_t *bp; int error; - if (error = xfs_alloc_read_agf(mp, tp, agno, flags, &bp)) + if ((error = xfs_alloc_read_agf(mp, tp, agno, flags, &bp))) return error; if (bp) xfs_trans_brelse(tp, bp); @@ -2076,9 +2071,9 @@ xfs_alloc_read_agf( ASSERT(agno != NULLAGNUMBER); d = XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR); - if (error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, + if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, (flags & XFS_ALLOC_FLAG_TRYLOCK) ? XFS_BUF_TRYLOCK : 0U, - &bp)) + &bp))) return error; ASSERT(!bp || !XFS_BUF_GETERROR(bp)); if (!bp) { @@ -2199,7 +2194,7 @@ xfs_alloc_vextent( break; } args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno); - if (error = xfs_alloc_ag_vextent(args)) + if ((error = xfs_alloc_ag_vextent(args))) goto error0; mrunlock(&mp->m_peraglock); break; @@ -2248,7 +2243,7 @@ xfs_alloc_vextent( for (;;) { mrlock(&mp->m_peraglock, MR_ACCESS, PINOD); args->pag = &mp->m_perag[args->agno]; - if (error = xfs_alloc_fix_freelist(args, flags)) { + if ((error = xfs_alloc_fix_freelist(args, flags))) { TRACE_ALLOC("nofix", args); goto error0; } @@ -2256,7 +2251,7 @@ xfs_alloc_vextent( * If we get a buffer back then the allocation will fly. */ if (args->agbp) { - if (error = xfs_alloc_ag_vextent(args)) + if ((error = xfs_alloc_ag_vextent(args))) goto error0; mrunlock(&mp->m_peraglock); break; @@ -2340,7 +2335,7 @@ xfs_free_extent( args.minlen = args.minleft = args.minalignslop = 0; mrlock(&args.mp->m_peraglock, MR_ACCESS, PINOD); args.pag = &args.mp->m_perag[args.agno]; - if (error = xfs_alloc_fix_freelist(&args, 0)) + if ((error = xfs_alloc_fix_freelist(&args, 0))) goto error0; #ifdef DEBUG ASSERT(args.agbp != NULL); diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c index c6d0e0fdd..a51c97bc8 100644 --- a/libxfs/xfs_alloc_btree.c +++ b/libxfs/xfs_alloc_btree.c @@ -58,9 +58,9 @@ xfs_alloc_delrec( xfs_agblock_t lbno; /* left block's block number */ xfs_buf_t *lbp; /* left block's buffer pointer */ xfs_alloc_block_t *left; /* left btree block */ - xfs_alloc_key_t *lkp; /* left block key pointer */ - xfs_alloc_ptr_t *lpp; /* left block address pointer */ - int lrecs; /* number of records in left block */ + xfs_alloc_key_t *lkp=NULL; /* left block key pointer */ + xfs_alloc_ptr_t *lpp=NULL; /* left block address pointer */ + int lrecs=0; /* number of records in left block */ xfs_alloc_rec_t *lrp; /* left block record pointer */ xfs_mount_t *mp; /* mount structure */ int ptr; /* index in btree block for this rec */ @@ -69,7 +69,7 @@ xfs_alloc_delrec( xfs_alloc_block_t *right; /* right btree block */ xfs_alloc_key_t *rkp; /* right block key pointer */ xfs_alloc_ptr_t *rpp; /* right block address pointer */ - int rrecs; /* number of records in right block */ + int rrecs=0; /* number of records in right block */ xfs_alloc_rec_t *rrp; /* right block record pointer */ xfs_btree_cur_t *tcur; /* temporary btree cursor */ @@ -87,7 +87,7 @@ xfs_alloc_delrec( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_ALLOC_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; #endif /* @@ -108,7 +108,7 @@ xfs_alloc_delrec( lpp = XFS_ALLOC_PTR_ADDR(block, 1, cur); #ifdef DEBUG for (i = ptr; i < INT_GET(block->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) return error; } #endif @@ -201,8 +201,8 @@ xfs_alloc_delrec( /* * Put this buffer/block on the ag's freelist. */ - if (error = xfs_alloc_put_freelist(cur->bc_tp, - cur->bc_private.a.agbp, NULL, bno)) + if ((error = xfs_alloc_put_freelist(cur->bc_tp, + cur->bc_private.a.agbp, NULL, bno))) return error; xfs_trans_agbtree_delta(cur->bc_tp, -1); xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp, @@ -247,7 +247,7 @@ xfs_alloc_delrec( * Duplicate the cursor so our btree manipulations here won't * disrupt the next level up. */ - if (error = xfs_btree_dup_cursor(cur, &tcur)) + if ((error = xfs_btree_dup_cursor(cur, &tcur))) return error; /* * If there's a right sibling, see if it's ok to shift an entry @@ -260,7 +260,7 @@ xfs_alloc_delrec( */ i = xfs_btree_lastrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_increment(tcur, level, &i)) + if ((error = xfs_alloc_increment(tcur, level, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); i = xfs_btree_lastrec(tcur, level); @@ -271,7 +271,7 @@ xfs_alloc_delrec( rbp = tcur->bc_bufs[level]; right = XFS_BUF_TO_ALLOC_BLOCK(rbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, right, level, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) goto error0; #endif /* @@ -285,7 +285,7 @@ xfs_alloc_delrec( */ if (INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1 >= XFS_ALLOC_BLOCK_MINRECS(level, cur)) { - if (error = xfs_alloc_lshift(tcur, level, &i)) + if ((error = xfs_alloc_lshift(tcur, level, &i))) goto error0; if (i) { ASSERT(INT_GET(block->bb_numrecs, ARCH_CONVERT) >= @@ -309,7 +309,7 @@ xfs_alloc_delrec( if (lbno != NULLAGBLOCK) { i = xfs_btree_firstrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_decrement(tcur, level, &i)) + if ((error = xfs_alloc_decrement(tcur, level, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); } @@ -325,7 +325,7 @@ xfs_alloc_delrec( */ i = xfs_btree_firstrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_alloc_decrement(tcur, level, &i)) + if ((error = xfs_alloc_decrement(tcur, level, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); xfs_btree_firstrec(tcur, level); @@ -335,7 +335,7 @@ xfs_alloc_delrec( lbp = tcur->bc_bufs[level]; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) goto error0; #endif /* @@ -349,7 +349,7 @@ xfs_alloc_delrec( */ if (INT_GET(left->bb_numrecs, ARCH_CONVERT) - 1 >= XFS_ALLOC_BLOCK_MINRECS(level, cur)) { - if (error = xfs_alloc_rshift(tcur, level, &i)) + if ((error = xfs_alloc_rshift(tcur, level, &i))) goto error0; if (i) { ASSERT(INT_GET(block->bb_numrecs, ARCH_CONVERT) >= @@ -388,12 +388,12 @@ xfs_alloc_delrec( rbno = bno; right = block; rbp = bp; - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, cur->bc_private.a.agno, lbno, 0, &lbp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; } /* @@ -409,12 +409,12 @@ xfs_alloc_delrec( lbno = bno; left = block; lbp = bp; - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, cur->bc_private.a.agno, rbno, 0, &rbp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; right = XFS_BUF_TO_ALLOC_BLOCK(rbp); - if (error = xfs_btree_check_sblock(cur, right, level, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) return error; } /* @@ -441,7 +441,7 @@ xfs_alloc_delrec( rpp = XFS_ALLOC_PTR_ADDR(right, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) return error; } #endif @@ -493,12 +493,12 @@ xfs_alloc_delrec( xfs_alloc_block_t *rrblock; xfs_buf_t *rrbp; - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, cur->bc_private.a.agno, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, - &rrbp, XFS_ALLOC_BTREE_REF)) + &rrbp, XFS_ALLOC_BTREE_REF))) return error; rrblock = XFS_BUF_TO_ALLOC_BLOCK(rrbp); - if (error = xfs_btree_check_sblock(cur, rrblock, level, rrbp)) + if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp))) return error; INT_SET(rrblock->bb_leftsib, ARCH_CONVERT, lbno); xfs_alloc_log_block(cur->bc_tp, rrbp, XFS_BB_LEFTSIB); @@ -506,8 +506,8 @@ xfs_alloc_delrec( /* * Free the deleting block by putting it on the freelist. */ - if (error = xfs_alloc_put_freelist(cur->bc_tp, cur->bc_private.a.agbp, - NULL, rbno)) + if ((error = xfs_alloc_put_freelist(cur->bc_tp, cur->bc_private.a.agbp, + NULL, rbno))) return error; xfs_trans_agbtree_delta(cur->bc_tp, -1); /* @@ -564,7 +564,7 @@ xfs_alloc_insrec( */ if (level >= cur->bc_nlevels) { XFS_STATS_INC(xs_abt_insrec); - if (error = xfs_alloc_newroot(cur, &i)) + if ((error = xfs_alloc_newroot(cur, &i))) return error; *bnop = NULLAGBLOCK; *stat = i; @@ -590,7 +590,7 @@ xfs_alloc_insrec( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_ALLOC_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; /* * Check that the new entry is being inserted in the right place. @@ -615,7 +615,7 @@ xfs_alloc_insrec( /* * First, try shifting an entry to the right neighbor. */ - if (error = xfs_alloc_rshift(cur, level, &i)) + if ((error = xfs_alloc_rshift(cur, level, &i))) return error; if (i) { /* nothing */ @@ -624,7 +624,7 @@ xfs_alloc_insrec( * Next, try shifting an entry to the left neighbor. */ else { - if (error = xfs_alloc_lshift(cur, level, &i)) + if ((error = xfs_alloc_lshift(cur, level, &i))) return error; if (i) optr = ptr = cur->bc_ptrs[level]; @@ -635,16 +635,16 @@ xfs_alloc_insrec( * variables because we could be in a * different block now. */ - if (error = xfs_alloc_split(cur, level, &nbno, - &nkey, &ncur, &i)) + if ((error = xfs_alloc_split(cur, level, &nbno, + &nkey, &ncur, &i))) return error; if (i) { bp = cur->bc_bufs[level]; block = XFS_BUF_TO_ALLOC_BLOCK(bp); #ifdef DEBUG - if (error = + if ((error = xfs_btree_check_sblock(cur, - block, level, bp)) + block, level, bp))) return error; #endif ptr = cur->bc_ptrs[level]; @@ -674,7 +674,7 @@ xfs_alloc_insrec( pp = XFS_ALLOC_PTR_ADDR(block, 1, cur); #ifdef DEBUG for (i = INT_GET(block->bb_numrecs, ARCH_CONVERT); i >= ptr; i--) { - if (error = xfs_btree_check_sptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), level))) return error; } #endif @@ -683,7 +683,7 @@ xfs_alloc_insrec( ovbcopy(&pp[ptr - 1], &pp[ptr], (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*pp)); /* INT_: copy */ #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, *bnop, level)) + if ((error = xfs_btree_check_sptr(cur, *bnop, level))) return error; #endif /* @@ -876,10 +876,10 @@ xfs_alloc_lookup( { xfs_agblock_t agbno; /* a.g. relative btree block number */ xfs_agnumber_t agno; /* allocation group number */ - xfs_alloc_block_t *block; /* current btree block */ + xfs_alloc_block_t *block=NULL; /* current btree block */ int diff; /* difference for the current key */ int error; /* error return value */ - int keyno; /* current key number */ + int keyno=0; /* current key number */ int level; /* level in the btree */ xfs_mount_t *mp; /* file system mount point */ @@ -922,16 +922,16 @@ xfs_alloc_lookup( * Need to get a new buffer. Read it, then * set it in the cursor, releasing the old one. */ - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, agno, - agbno, 0, &bp, XFS_ALLOC_BTREE_REF)) + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, agno, + agbno, 0, &bp, XFS_ALLOC_BTREE_REF))) return error; xfs_btree_setbuf(cur, level, bp); /* * Point to the btree block, now that we have the buffer */ block = XFS_BUF_TO_ALLOC_BLOCK(bp); - if (error = xfs_btree_check_sblock(cur, block, level, - bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, + bp))) return error; } else block = XFS_BUF_TO_ALLOC_BLOCK(bp); @@ -946,8 +946,8 @@ xfs_alloc_lookup( */ else { int high; /* high entry number */ - xfs_alloc_key_t *kkbase;/* base of keys in block */ - xfs_alloc_rec_t *krbase;/* base of records in block */ + xfs_alloc_key_t *kkbase=NULL;/* base of keys in block */ + xfs_alloc_rec_t *krbase=NULL;/* base of records in block */ int low; /* low entry number */ /* @@ -1039,7 +1039,7 @@ xfs_alloc_lookup( keyno = 1; agbno = INT_GET(*XFS_ALLOC_PTR_ADDR(block, keyno, cur), ARCH_CONVERT); #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, agbno, level)) + if ((error = xfs_btree_check_sptr(cur, agbno, level))) return error; #endif cur->bc_ptrs[level] = keyno; @@ -1061,7 +1061,7 @@ xfs_alloc_lookup( int i; cur->bc_ptrs[0] = keyno; - if (error = xfs_alloc_increment(cur, 0, &i)) + if ((error = xfs_alloc_increment(cur, 0, &i))) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); *stat = 1; @@ -1101,9 +1101,9 @@ xfs_alloc_lshift( int nrec; /* new number of left block entries */ xfs_buf_t *rbp; /* buffer for right (current) block */ xfs_alloc_block_t *right; /* right (current) btree block */ - xfs_alloc_key_t *rkp; /* key pointer for right block */ - xfs_alloc_ptr_t *rpp; /* address pointer for right block */ - xfs_alloc_rec_t *rrp; /* record pointer for right block */ + xfs_alloc_key_t *rkp=NULL; /* key pointer for right block */ + xfs_alloc_ptr_t *rpp=NULL; /* address pointer for right block */ + xfs_alloc_rec_t *rrp=NULL; /* record pointer for right block */ /* * Set up variables for this block as "right". @@ -1111,7 +1111,7 @@ xfs_alloc_lshift( rbp = cur->bc_bufs[level]; right = XFS_BUF_TO_ALLOC_BLOCK(rbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, right, level, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) return error; #endif /* @@ -1132,12 +1132,12 @@ xfs_alloc_lshift( /* * Set up the left neighbor as "left". */ - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.a.agno, INT_GET(right->bb_leftsib, ARCH_CONVERT), 0, &lbp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; /* * If it's full, it can't take another entry. @@ -1161,7 +1161,7 @@ xfs_alloc_lshift( lpp = XFS_ALLOC_PTR_ADDR(left, nrec, cur); rpp = XFS_ALLOC_PTR_ADDR(right, 1, cur); #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, INT_GET(*rpp, ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(*rpp, ARCH_CONVERT), level))) return error; #endif *lpp = *rpp; /* INT_: copy */ @@ -1193,8 +1193,8 @@ xfs_alloc_lshift( if (level > 0) { #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_sptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), - level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), + level))) return error; } #endif @@ -1212,7 +1212,7 @@ xfs_alloc_lshift( /* * Update the parent key values of right. */ - if (error = xfs_alloc_updkey(cur, rkp, level + 1)) + if ((error = xfs_alloc_updkey(cur, rkp, level + 1))) return error; /* * Slide the cursor value left one. @@ -1249,8 +1249,8 @@ xfs_alloc_newroot( /* * Get a buffer from the freelist blocks, for the new root. */ - if (error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_private.a.agbp, - &nbno)) + if ((error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_private.a.agbp, + &nbno))) return error; /* * None available, we fail. @@ -1287,7 +1287,7 @@ xfs_alloc_newroot( lbp = cur->bc_bufs[cur->bc_nlevels - 1]; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, left, cur->bc_nlevels - 1, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, cur->bc_nlevels - 1, lbp))) return error; #endif if (INT_GET(left->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) { @@ -1296,13 +1296,13 @@ xfs_alloc_newroot( */ lbno = XFS_DADDR_TO_AGBNO(mp, XFS_BUF_ADDR(lbp)); rbno = INT_GET(left->bb_rightsib, ARCH_CONVERT); - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, cur->bc_private.a.agno, rbno, 0, &rbp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; right = XFS_BUF_TO_ALLOC_BLOCK(rbp); - if (error = xfs_btree_check_sblock(cur, right, - cur->bc_nlevels - 1, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, + cur->bc_nlevels - 1, rbp))) return error; nptr = 1; } else { @@ -1313,13 +1313,13 @@ xfs_alloc_newroot( right = left; rbno = XFS_DADDR_TO_AGBNO(mp, XFS_BUF_ADDR(rbp)); lbno = INT_GET(right->bb_leftsib, ARCH_CONVERT); - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, cur->bc_private.a.agno, lbno, 0, &lbp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); - if (error = xfs_btree_check_sblock(cur, left, - cur->bc_nlevels - 1, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, + cur->bc_nlevels - 1, lbp))) return error; nptr = 2; } @@ -1402,7 +1402,7 @@ xfs_alloc_rshift( lbp = cur->bc_bufs[level]; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; #endif /* @@ -1423,12 +1423,12 @@ xfs_alloc_rshift( /* * Set up the right neighbor as "right". */ - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.a.agno, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, &rbp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; right = XFS_BUF_TO_ALLOC_BLOCK(rbp); - if (error = xfs_btree_check_sblock(cur, right, level, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) return error; /* * If it's full, it can't take another entry. @@ -1452,14 +1452,14 @@ xfs_alloc_rshift( rpp = XFS_ALLOC_PTR_ADDR(right, 1, cur); #ifdef DEBUG for (i = INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1; i >= 0; i--) { - if (error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) return error; } #endif ovbcopy(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); ovbcopy(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) return error; #endif *rkp = *lkp; /* INT_: copy */ @@ -1492,7 +1492,7 @@ xfs_alloc_rshift( * Using a temporary cursor, update the parent key values of the * block on the right. */ - if (error = xfs_btree_dup_cursor(cur, &tcur)) + if ((error = xfs_btree_dup_cursor(cur, &tcur))) return error; i = xfs_btree_lastrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); @@ -1533,8 +1533,8 @@ xfs_alloc_split( * Allocate the new block from the freelist. * If we can't do it, we're toast. Give up. */ - if (error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_private.a.agbp, - &rbno)) + if ((error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_private.a.agbp, + &rbno))) return error; if (rbno == NULLAGBLOCK) { *stat = 0; @@ -1553,7 +1553,7 @@ xfs_alloc_split( lbp = cur->bc_bufs[level]; left = XFS_BUF_TO_ALLOC_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; #endif /* @@ -1585,7 +1585,7 @@ xfs_alloc_split( rpp = XFS_ALLOC_PTR_ADDR(right, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) return error; } #endif @@ -1628,12 +1628,12 @@ xfs_alloc_split( xfs_alloc_block_t *rrblock; /* rr btree block */ xfs_buf_t *rrbp; /* buffer for rrblock */ - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.a.agno, INT_GET(right->bb_rightsib, ARCH_CONVERT), 0, - &rrbp, XFS_ALLOC_BTREE_REF)) + &rrbp, XFS_ALLOC_BTREE_REF))) return error; rrblock = XFS_BUF_TO_ALLOC_BLOCK(rrbp); - if (error = xfs_btree_check_sblock(cur, rrblock, level, rrbp)) + if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp))) return error; INT_SET(rrblock->bb_leftsib, ARCH_CONVERT, rbno); xfs_alloc_log_block(cur->bc_tp, rrbp, XFS_BB_LEFTSIB); @@ -1652,7 +1652,7 @@ xfs_alloc_split( * the right block, no matter where this cursor was. */ if (level + 1 < cur->bc_nlevels) { - if (error = xfs_btree_dup_cursor(cur, curp)) + if ((error = xfs_btree_dup_cursor(cur, curp))) return error; (*curp)->bc_ptrs[level + 1]++; } @@ -1689,7 +1689,7 @@ xfs_alloc_updkey( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_ALLOC_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; #endif ptr = cur->bc_ptrs[level]; @@ -1736,8 +1736,8 @@ xfs_alloc_decrement( */ block = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[level]); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, - cur->bc_bufs[level])) + if ((error = xfs_btree_check_sblock(cur, block, level, + cur->bc_bufs[level]))) return error; #endif /* @@ -1773,14 +1773,14 @@ xfs_alloc_decrement( xfs_buf_t *bp; /* buffer pointer for block */ agbno = INT_GET(*XFS_ALLOC_PTR_ADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.a.agno, agbno, 0, &bp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; lev--; xfs_btree_setbuf(cur, lev, bp); block = XFS_BUF_TO_ALLOC_BLOCK(bp); - if (error = xfs_btree_check_sblock(cur, block, lev, bp)) + if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) return error; cur->bc_ptrs[lev] = INT_GET(block->bb_numrecs, ARCH_CONVERT); } @@ -1808,13 +1808,13 @@ xfs_alloc_delete( * Otherwise we are done. */ for (level = 0, i = 2; i == 2; level++) { - if (error = xfs_alloc_delrec(cur, level, &i)) + if ((error = xfs_alloc_delrec(cur, level, &i))) return error; } if (i == 0) { for (level = 1; level < cur->bc_nlevels; level++) { if (cur->bc_ptrs[level] == 0) { - if (error = xfs_alloc_decrement(cur, level, &i)) + if ((error = xfs_alloc_decrement(cur, level, &i))) return error; break; } @@ -1843,7 +1843,7 @@ xfs_alloc_get_rec( ptr = cur->bc_ptrs[0]; block = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[0]); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, 0, cur->bc_bufs[0])) + if ((error = xfs_btree_check_sblock(cur, block, 0, cur->bc_bufs[0]))) return error; #endif /* @@ -1893,7 +1893,7 @@ xfs_alloc_increment( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_ALLOC_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; #endif /* @@ -1919,7 +1919,7 @@ xfs_alloc_increment( bp = cur->bc_bufs[lev]; block = XFS_BUF_TO_ALLOC_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, lev, bp)) + if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) return error; #endif if (++cur->bc_ptrs[lev] <= INT_GET(block->bb_numrecs, ARCH_CONVERT)) @@ -1943,14 +1943,14 @@ xfs_alloc_increment( xfs_agblock_t agbno; /* block number of btree block */ agbno = INT_GET(*XFS_ALLOC_PTR_ADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.a.agno, agbno, 0, &bp, - XFS_ALLOC_BTREE_REF)) + XFS_ALLOC_BTREE_REF))) return error; lev--; xfs_btree_setbuf(cur, lev, bp); block = XFS_BUF_TO_ALLOC_BLOCK(bp); - if (error = xfs_btree_check_sblock(cur, block, lev, bp)) + if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) return error; cur->bc_ptrs[lev] = 1; } @@ -1991,8 +1991,8 @@ xfs_alloc_insert( * Insert nrec/nbno into this level of the tree. * Note if we fail, nbno will be null. */ - if (error = xfs_alloc_insrec(pcur, level++, &nbno, &nrec, &ncur, - &i)) { + if ((error = xfs_alloc_insrec(pcur, level++, &nbno, &nrec, &ncur, + &i))) { if (pcur != cur) xfs_btree_del_cursor(pcur, XFS_BTREE_ERROR); return error; @@ -2085,7 +2085,7 @@ xfs_alloc_update( */ block = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[0]); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, 0, cur->bc_bufs[0])) + if ((error = xfs_btree_check_sblock(cur, block, 0, cur->bc_bufs[0]))) return error; #endif /* @@ -2129,7 +2129,7 @@ xfs_alloc_update( INT_SET(key.ar_startblock, ARCH_CONVERT, bno); INT_SET(key.ar_blockcount, ARCH_CONVERT, len); - if (error = xfs_alloc_updkey(cur, &key, 1)) + if ((error = xfs_alloc_updkey(cur, &key, 1))) return error; } return 0; diff --git a/libxfs/xfs_bit.c b/libxfs/xfs_bit.c index 52ab69a51..39dea3b69 100644 --- a/libxfs/xfs_bit.c +++ b/libxfs/xfs_bit.c @@ -211,7 +211,7 @@ xfs_lowbit64( #else __uint32_t vw; - if (vw = v) { + if ((vw = v)) { if (vw & 0x0000ffff) if (vw & 0x000000ff) i = 0; @@ -223,7 +223,7 @@ xfs_lowbit64( else i = 24; return i + xfs_lowbit[(vw >> i) & 0xff]; - } else if (vw = v >> 32) { + } else if ((vw = v >> 32)) { if (vw & 0x0000ffff) if (vw & 0x000000ff) i = 32; @@ -277,7 +277,7 @@ xfs_highbit64( #else __uint32_t vw; - if (vw = v >> 32) { + if ((vw = v >> 32)) { if (vw & 0xffff0000) if (vw & 0xff000000) i = 56; @@ -289,7 +289,7 @@ xfs_highbit64( else i = 32; return i + xfs_highbit[(vw >> (i - 32)) & 0xff]; - } else if (vw = v) { + } else if ((vw = v)) { if (vw & 0xffff0000) if (vw & 0xff000000) i = 24; diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 3e61ca9be..f32718e17 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -92,8 +92,8 @@ xfs_bmap_add_extent( if (cur) ASSERT((cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL) == 0); - if (error = xfs_bmap_add_extent_hole_delay(ip, idx, cur, new, - &logflags, rsvd)) + if ((error = xfs_bmap_add_extent_hole_delay(ip, idx, cur, new, + &logflags, rsvd))) goto done; } /* @@ -103,8 +103,8 @@ xfs_bmap_add_extent( if (cur) ASSERT((cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL) == 0); - if (error = xfs_bmap_add_extent_hole_real(ip, idx, cur, new, - &logflags, whichfork)) + if ((error = xfs_bmap_add_extent_hole_real(ip, idx, cur, new, + &logflags, whichfork))) goto done; } else { xfs_bmbt_irec_t prev; /* old extent at offset idx */ @@ -127,19 +127,19 @@ xfs_bmap_add_extent( if (cur) ASSERT(cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL); - if (error = xfs_bmap_add_extent_delay_real(ip, + if ((error = xfs_bmap_add_extent_delay_real(ip, idx, &cur, new, &da_new, first, flist, - &logflags, rsvd)) + &logflags, rsvd))) goto done; } else if (new->br_state == XFS_EXT_NORM) { ASSERT(new->br_state == XFS_EXT_NORM); - if (error = xfs_bmap_add_extent_unwritten_real( - ip, idx, &cur, new, &logflags)) + if ((error = xfs_bmap_add_extent_unwritten_real( + ip, idx, &cur, new, &logflags))) goto done; } else { ASSERT(new->br_state == XFS_EXT_UNWRITTEN); - if (error = xfs_bmap_add_extent_unwritten_real( - ip, idx, &cur, new, &logflags)) + if ((error = xfs_bmap_add_extent_unwritten_real( + ip, idx, &cur, new, &logflags))) goto done; } ASSERT(*curp == cur || *curp == NULL); @@ -151,8 +151,8 @@ xfs_bmap_add_extent( if (cur) ASSERT((cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL) == 0); - if (error = xfs_bmap_add_extent_hole_real(ip, idx, cur, - new, &logflags, whichfork)) + if ((error = xfs_bmap_add_extent_hole_real(ip, idx, cur, + new, &logflags, whichfork))) goto done; } } @@ -231,7 +231,7 @@ xfs_bmap_add_extent_delay_real( xfs_fileoff_t new_endoff; /* end offset of new entry */ xfs_bmbt_irec_t r[3]; /* neighbor extent entries */ /* left is 0, right is 1, prev is 2 */ - int rval; /* return value (logging flags) */ + int rval=0; /* return value (logging flags) */ int state = 0;/* state bits, accessed thru macros */ xfs_filblks_t temp; /* value for dnew calculations */ xfs_filblks_t temp2; /* value for dnew calculations */ @@ -337,22 +337,22 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, RIGHT.br_startblock, - RIGHT.br_blockcount, &i)) + RIGHT.br_blockcount, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_delete(cur, 0, &i)) + if ((error = xfs_bmbt_delete(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount + PREV.br_blockcount + - RIGHT.br_blockcount, LEFT.br_state)) + RIGHT.br_blockcount, LEFT.br_state))) goto done; } *dnew = 0; @@ -377,15 +377,15 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount + - PREV.br_blockcount, LEFT.br_state)) + PREV.br_blockcount, LEFT.br_state))) goto done; } *dnew = 0; @@ -411,15 +411,15 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, RIGHT.br_startblock, - RIGHT.br_blockcount, &i)) + RIGHT.br_blockcount, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, PREV.br_startoff, + if ((error = xfs_bmbt_update(cur, PREV.br_startoff, new->br_startblock, PREV.br_blockcount + - RIGHT.br_blockcount, PREV.br_state)) + RIGHT.br_blockcount, PREV.br_state))) goto done; } *dnew = 0; @@ -442,13 +442,13 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 0); cur->bc_rec.b.br_state = XFS_EXT_NORM; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -477,16 +477,16 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount + new->br_blockcount, - LEFT.br_state)) + LEFT.br_state))) goto done; } temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), @@ -515,13 +515,13 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 0); cur->bc_rec.b.br_state = XFS_EXT_NORM; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -566,16 +566,16 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, RIGHT.br_startblock, - RIGHT.br_blockcount, &i)) + RIGHT.br_blockcount, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, new->br_startoff, + if ((error = xfs_bmbt_update(cur, new->br_startoff, new->br_startblock, new->br_blockcount + RIGHT.br_blockcount, - RIGHT.br_state)) + RIGHT.br_state))) goto done; } temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), @@ -603,13 +603,13 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 0); cur->bc_rec.b.br_state = XFS_EXT_NORM; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -654,13 +654,13 @@ xfs_bmap_add_extent_delay_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 0); cur->bc_rec.b.br_state = XFS_EXT_NORM; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -768,7 +768,7 @@ xfs_bmap_add_extent_unwritten_real( xfs_exntst_t oldext; /* old extent state */ xfs_bmbt_irec_t r[3]; /* neighbor extent entries */ /* left is 0, right is 1, prev is 2 */ - int rval; /* return value (logging flags) */ + int rval=0; /* return value (logging flags) */ int state = 0;/* state bits, accessed thru macros */ enum { /* bit number definitions for state */ LEFT_CONTIG, RIGHT_CONTIG, @@ -875,27 +875,27 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, RIGHT.br_startblock, - RIGHT.br_blockcount, &i)) + RIGHT.br_blockcount, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_delete(cur, 0, &i)) + if ((error = xfs_bmbt_delete(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_delete(cur, 0, &i)) + if ((error = xfs_bmbt_delete(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount + PREV.br_blockcount + - RIGHT.br_blockcount, LEFT.br_state)) + RIGHT.br_blockcount, LEFT.br_state))) goto done; } break; @@ -920,21 +920,21 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_delete(cur, 0, &i)) + if ((error = xfs_bmbt_delete(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, LEFT.br_startoff, + if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, LEFT.br_startblock, LEFT.br_blockcount + PREV.br_blockcount, - LEFT.br_state)) + LEFT.br_state))) goto done; } break; @@ -960,21 +960,21 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, RIGHT.br_startoff, RIGHT.br_startblock, - RIGHT.br_blockcount, &i)) + RIGHT.br_blockcount, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_delete(cur, 0, &i)) + if ((error = xfs_bmbt_delete(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, new->br_startoff, + if ((error = xfs_bmbt_update(cur, new->br_startoff, new->br_startblock, new->br_blockcount + RIGHT.br_blockcount, - newext)) + newext))) goto done; } break; @@ -995,14 +995,14 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, new->br_startoff, + if ((error = xfs_bmbt_update(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - newext)) + newext))) goto done; } break; @@ -1033,18 +1033,18 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, + if ((error = xfs_bmbt_update(cur, PREV.br_startoff + new->br_blockcount, PREV.br_startblock + new->br_blockcount, PREV.br_blockcount - new->br_blockcount, - oldext)) + oldext))) goto done; - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) goto done; if (xfs_bmbt_update(cur, LEFT.br_startoff, LEFT.br_startblock, @@ -1076,19 +1076,19 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, + if ((error = xfs_bmbt_update(cur, PREV.br_startoff + new->br_blockcount, PREV.br_startblock + new->br_blockcount, PREV.br_blockcount - new->br_blockcount, - oldext)) + oldext))) goto done; cur->bc_rec.b = *new; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -1116,22 +1116,22 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_DEXT; else { rval = 0; - if (error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, PREV.br_startblock, - PREV.br_blockcount, &i)) + PREV.br_blockcount, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, PREV.br_startoff, + if ((error = xfs_bmbt_update(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount - new->br_blockcount, - oldext)) + oldext))) goto done; - if (error = xfs_bmbt_increment(cur, 0, &i)) + if ((error = xfs_bmbt_increment(cur, 0, &i))) goto done; - if (error = xfs_bmbt_update(cur, new->br_startoff, + if ((error = xfs_bmbt_update(cur, new->br_startoff, new->br_startblock, new->br_blockcount + RIGHT.br_blockcount, - newext)) + newext))) goto done; } break; @@ -1154,23 +1154,23 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_update(cur, PREV.br_startoff, + if ((error = xfs_bmbt_update(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount - new->br_blockcount, - oldext)) + oldext))) goto done; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, new->br_startblock, new->br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 0); cur->bc_rec.b.br_state = XFS_EXT_NORM; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -1201,29 +1201,29 @@ xfs_bmap_add_extent_unwritten_real( rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; else { rval = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, PREV.br_startoff, PREV.br_startblock, PREV.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); /* new right extent - oldext */ - if (error = xfs_bmbt_update(cur, r[1].br_startoff, + if ((error = xfs_bmbt_update(cur, r[1].br_startoff, r[1].br_startblock, r[1].br_blockcount, - r[1].br_state)) + r[1].br_state))) goto done; /* new left extent - oldext */ PREV.br_blockcount = new->br_startoff - PREV.br_startoff; cur->bc_rec.b = PREV; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); - if (error = xfs_bmbt_increment(cur, 0, &i)) + if ((error = xfs_bmbt_increment(cur, 0, &i))) goto done; ASSERT(i == 1); /* new middle extent - newext */ cur->bc_rec.b = *new; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) goto done; ASSERT(i == 1); } @@ -1278,8 +1278,8 @@ xfs_bmap_add_extent_hole_delay( static char fname[] = "xfs_bmap_add_extent_hole_delay"; #endif xfs_bmbt_irec_t left; /* left neighbor extent entry */ - xfs_filblks_t newlen; /* new indirect size */ - xfs_filblks_t oldlen; /* old indirect size */ + xfs_filblks_t newlen=0; /* new indirect size */ + xfs_filblks_t oldlen=0; /* old indirect size */ xfs_bmbt_irec_t right; /* right neighbor extent entry */ int state; /* state bits, accessed thru macros */ xfs_filblks_t temp; /* temp for indirect calculations */ @@ -1537,14 +1537,14 @@ xfs_bmap_add_extent_hole_real( return 0; } *logflagsp = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, right.br_startoff, - right.br_startblock, right.br_blockcount, &i)) + if ((error = xfs_bmbt_lookup_eq(cur, right.br_startoff, + right.br_startblock, right.br_blockcount, &i))) return error; ASSERT(i == 1); - if (error = xfs_bmbt_delete(cur, 0, &i)) + if ((error = xfs_bmbt_delete(cur, 0, &i))) return error; ASSERT(i == 1); - if (error = xfs_bmbt_decrement(cur, 0, &i)) + if ((error = xfs_bmbt_decrement(cur, 0, &i))) return error; ASSERT(i == 1); error = xfs_bmbt_update(cur, left.br_startoff, @@ -1569,8 +1569,8 @@ xfs_bmap_add_extent_hole_real( return 0; } *logflagsp = 0; - if (error = xfs_bmbt_lookup_eq(cur, left.br_startoff, - left.br_startblock, left.br_blockcount, &i)) + if ((error = xfs_bmbt_lookup_eq(cur, left.br_startoff, + left.br_startblock, left.br_blockcount, &i))) return error; ASSERT(i == 1); error = xfs_bmbt_update(cur, left.br_startoff, @@ -1596,8 +1596,8 @@ xfs_bmap_add_extent_hole_real( return 0; } *logflagsp = 0; - if (error = xfs_bmbt_lookup_eq(cur, right.br_startoff, - right.br_startblock, right.br_blockcount, &i)) + if ((error = xfs_bmbt_lookup_eq(cur, right.br_startoff, + right.br_startblock, right.br_blockcount, &i))) return error; ASSERT(i == 1); error = xfs_bmbt_update(cur, new->br_startoff, @@ -1623,12 +1623,12 @@ xfs_bmap_add_extent_hole_real( return 0; } *logflagsp = XFS_ILOG_CORE; - if (error = xfs_bmbt_lookup_eq(cur, new->br_startoff, - new->br_startblock, new->br_blockcount, &i)) + if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, + new->br_startblock, new->br_blockcount, &i))) return error; ASSERT(i == 0); cur->bc_rec.b.br_state = new->br_state; - if (error = xfs_bmbt_insert(cur, &i)) + if ((error = xfs_bmbt_insert(cur, &i))) return error; ASSERT(i == 1); return 0; @@ -1655,15 +1655,15 @@ xfs_bmap_alloc( xfs_bmalloca_t *ap) /* bmap alloc argument struct */ { xfs_fsblock_t adjust; /* adjustment to block numbers */ - xfs_alloctype_t atype; /* type for allocation routines */ + xfs_alloctype_t atype=0; /* type for allocation routines */ int error; /* error return value */ xfs_agnumber_t fb_agno; /* ag number of ap->firstblock */ xfs_mount_t *mp; /* mount point structure */ int nullfb; /* true if ap->firstblock isn't set */ int rt; /* true if inode is realtime */ #ifdef __KERNEL__ - xfs_extlen_t prod; /* product factor for allocators */ - xfs_extlen_t ralen; /* realtime allocation length */ + xfs_extlen_t prod=0; /* product factor for allocators */ + xfs_extlen_t ralen=0; /* realtime allocation length */ #endif #define ISLEGAL(x,y) \ @@ -1715,7 +1715,7 @@ xfs_bmap_alloc( /* * Same adjustment for the end of the requested area. */ - if (temp = (ap->alen % extsz)) + if ((temp = (ap->alen % extsz))) ap->alen += extsz - temp; /* * If the previous block overlaps with this proposed allocation @@ -1758,7 +1758,7 @@ xfs_bmap_alloc( * If the result isn't a multiple of rtextents we need to * remove blocks until it is. */ - if (temp = (ap->alen % mp->m_sb.sb_rextsize)) { + if ((temp = (ap->alen % mp->m_sb.sb_rextsize))) { /* * We're not covering the original request, or * we won't be able to once we fix the length. @@ -1858,9 +1858,9 @@ xfs_bmap_alloc( */ else if (!ap->eof) { xfs_fsblock_t gotbno; /* right side block number */ - xfs_fsblock_t gotdiff; /* right side difference */ + xfs_fsblock_t gotdiff=0; /* right side difference */ xfs_fsblock_t prevbno; /* left side block number */ - xfs_fsblock_t prevdiff; /* left side difference */ + xfs_fsblock_t prevdiff=0; /* left side difference */ /* * If there's a previous (left) block, select a requested @@ -1979,8 +1979,8 @@ xfs_bmap_alloc( do_div(ap->rval, mp->m_sb.sb_rextsize); rtb = ap->rval; ap->alen = ralen; - if (error = xfs_rtallocate_extent(ap->tp, ap->rval, 1, ap->alen, - &ralen, atype, ap->wasdel, prod, &rtb)) + if ((error = xfs_rtallocate_extent(ap->tp, ap->rval, 1, ap->alen, + &ralen, atype, ap->wasdel, prod, &rtb))) return error; if (rtb == NULLFSBLOCK && prod > 1 && (error = xfs_rtallocate_extent(ap->tp, ap->rval, 1, @@ -2023,7 +2023,7 @@ xfs_bmap_alloc( int isaligned; xfs_extlen_t longest; xfs_extlen_t need; - xfs_extlen_t nextminlen; + xfs_extlen_t nextminlen=0; int notinit; xfs_perag_t *pag; xfs_agnumber_t startag; @@ -2102,14 +2102,14 @@ xfs_bmap_alloc( } if (ap->ip->i_d.di_extsize) { args.prod = ap->ip->i_d.di_extsize; - if (args.mod = (xfs_extlen_t)do_mod(ap->off, args.prod)) + if ((args.mod = (xfs_extlen_t)do_mod(ap->off, args.prod))) args.mod = (xfs_extlen_t)(args.prod - args.mod); } else if (mp->m_sb.sb_blocksize >= NBPP) { args.prod = 1; args.mod = 0; } else { args.prod = NBPP >> mp->m_sb.sb_blocklog; - if (args.mod = (xfs_extlen_t)(do_mod(ap->off, args.prod))) + if ((args.mod = (xfs_extlen_t)(do_mod(ap->off, args.prod)))) args.mod = (xfs_extlen_t)(args.prod - args.mod); } /* @@ -2167,7 +2167,7 @@ xfs_bmap_alloc( args.wasdel = ap->wasdel; args.isfl = 0; args.userdata = ap->userdata; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; if (tryagain && args.fsbno == NULLFSBLOCK) { /* @@ -2180,7 +2180,7 @@ xfs_bmap_alloc( args.minlen = nextminlen; args.minalignslop = 0; isaligned = 1; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; } if (isaligned && args.fsbno == NULLFSBLOCK) { @@ -2191,7 +2191,7 @@ xfs_bmap_alloc( args.type = atype; args.fsbno = ap->rval; args.alignment = 0; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; } if (args.fsbno == NULLFSBLOCK && nullfb && @@ -2199,7 +2199,7 @@ xfs_bmap_alloc( args.minlen = ap->minlen; args.type = XFS_ALLOCTYPE_START_BNO; args.fsbno = ap->rval; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; } if (args.fsbno == NULLFSBLOCK && nullfb) { @@ -2207,7 +2207,7 @@ xfs_bmap_alloc( args.type = XFS_ALLOCTYPE_FIRST_AG; args.total = ap->minlen; args.minleft = 0; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; ap->low = 1; } @@ -2277,15 +2277,15 @@ xfs_bmap_btree_to_extents( pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes); *logflagsp = 0; #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), 1)) + if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), 1))) return error; #endif cbno = INT_GET(*pp, ARCH_CONVERT); - if (error = xfs_btree_read_bufl(mp, tp, cbno, 0, &cbp, - XFS_BMAP_BTREE_REF)) + if ((error = xfs_btree_read_bufl(mp, tp, cbno, 0, &cbp, + XFS_BMAP_BTREE_REF))) return error; cblock = XFS_BUF_TO_BMBT_BLOCK(cbp); - if (error = xfs_btree_check_lblock(cur, cblock, 0, cbp)) + if ((error = xfs_btree_check_lblock(cur, cblock, 0, cbp))) return error; xfs_bmap_add_free(cbno, 1, cur->bc_private.b.flist, mp); if (!async) @@ -2325,7 +2325,7 @@ xfs_bmap_del_extent( { xfs_filblks_t da_new; /* new delay-alloc indirect blocks */ xfs_filblks_t da_old; /* old delay-alloc indirect blocks */ - xfs_fsblock_t del_endblock; /* first block past del */ + xfs_fsblock_t del_endblock=0; /* first block past del */ xfs_fileoff_t del_endoff; /* first offset past del */ int delay; /* current block is delayed allocated */ int do_fx; /* free extent at end of routine */ @@ -2386,8 +2386,8 @@ xfs_bmap_del_extent( do_div(bno, mp->m_sb.sb_rextsize); len = del->br_blockcount; do_div(len, mp->m_sb.sb_rextsize); - if (error = xfs_rtfree_extent(ip->i_transp, bno, - (xfs_extlen_t)len)) + if ((error = xfs_rtfree_extent(ip->i_transp, bno, + (xfs_extlen_t)len))) goto done; do_fx = 0; nblks = len * mp->m_sb.sb_rextsize; @@ -2423,9 +2423,9 @@ xfs_bmap_del_extent( */ del_endblock = del->br_startblock + del->br_blockcount; if (cur) { - if (error = xfs_bmbt_lookup_eq(cur, got.br_startoff, + if ((error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock, got.br_blockcount, - &i)) + &i))) goto done; ASSERT(i == 1); } @@ -2458,7 +2458,7 @@ xfs_bmap_del_extent( flags |= XFS_ILOG_FEXT(whichfork); break; } - if (error = xfs_bmbt_delete(cur, iflags & XFS_BMAPI_ASYNC, &i)) + if ((error = xfs_bmbt_delete(cur, iflags & XFS_BMAPI_ASYNC, &i))) goto done; ASSERT(i == 1); break; @@ -2487,9 +2487,9 @@ xfs_bmap_del_extent( flags |= XFS_ILOG_FEXT(whichfork); break; } - if (error = xfs_bmbt_update(cur, del_endoff, del_endblock, + if ((error = xfs_bmbt_update(cur, del_endoff, del_endblock, got.br_blockcount - del->br_blockcount, - got.br_state)) + got.br_state))) goto done; break; @@ -2515,10 +2515,10 @@ xfs_bmap_del_extent( flags |= XFS_ILOG_FEXT(whichfork); break; } - if (error = xfs_bmbt_update(cur, got.br_startoff, + if ((error = xfs_bmbt_update(cur, got.br_startoff, got.br_startblock, got.br_blockcount - del->br_blockcount, - got.br_state)) + got.br_state))) goto done; break; @@ -2537,12 +2537,12 @@ xfs_bmap_del_extent( new.br_startblock = del_endblock; flags |= XFS_ILOG_CORE; if (cur) { - if (error = xfs_bmbt_update(cur, + if ((error = xfs_bmbt_update(cur, got.br_startoff, got.br_startblock, temp, - got.br_state)) + got.br_state))) goto done; - if (error = xfs_bmbt_increment(cur, 0, &i)) + if ((error = xfs_bmbt_increment(cur, 0, &i))) goto done; cur->bc_rec.b = new; error = xfs_bmbt_insert(cur, &i); @@ -2559,21 +2559,21 @@ xfs_bmap_del_extent( * Reset the cursor, don't trust * it after any insert operation. */ - if (error = xfs_bmbt_lookup_eq(cur, + if ((error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock, - temp, &i)) + temp, &i))) goto done; ASSERT(i == 1); /* * Update the btree record back * to the original value. */ - if (error = xfs_bmbt_update(cur, + if ((error = xfs_bmbt_update(cur, got.br_startoff, got.br_startblock, got.br_blockcount, - got.br_state)) + got.br_state))) goto done; /* * Reset the extent record back @@ -2771,7 +2771,7 @@ xfs_bmap_extents_to_btree( args.minalignslop = 0; args.wasdel = wasdel; *logflagsp = 0; - if (error = xfs_alloc_vextent(&args)) { + if ((error = xfs_alloc_vextent(&args))) { xfs_iroot_realloc(ip, -1, whichfork); xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); return error; @@ -2913,7 +2913,7 @@ xfs_bmap_local_to_extents( args.mod = args.minleft = args.alignment = args.wasdel = args.isfl = args.minalignslop = 0; args.minlen = args.maxlen = args.prod = 1; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) goto done; /* * Can't fail, the space was reserved. @@ -3424,8 +3424,8 @@ xfs_bmap_read_extents( * pointer (leftmost) at each level. */ while (level-- > 0) { - if (error = xfs_btree_read_bufl(mp, tp, bno, 0, &bp, - XFS_BMAP_BTREE_REF)) + if ((error = xfs_btree_read_bufl(mp, tp, bno, 0, &bp, + XFS_BMAP_BTREE_REF))) return error; block = XFS_BUF_TO_BMBT_BLOCK(bp); XFS_WANT_CORRUPTED_GOTO( @@ -3496,8 +3496,8 @@ xfs_bmap_read_extents( */ if (bno == NULLFSBLOCK) break; - if (error = xfs_btree_read_bufl(mp, tp, bno, 0, &bp, - XFS_BMAP_BTREE_REF)) + if ((error = xfs_btree_read_bufl(mp, tp, bno, 0, &bp, + XFS_BMAP_BTREE_REF))) return error; block = XFS_BUF_TO_BMBT_BLOCK(bp); } @@ -3598,7 +3598,7 @@ xfs_bmapi( ifp = XFS_IFORK_PTR(ip, whichfork); ASSERT(ifp->if_ext_max == XFS_IFORK_SIZE(ip, whichfork) / (uint)sizeof(xfs_bmbt_rec_t)); - if (wr = (flags & XFS_BMAPI_WRITE) != 0) + if ((wr = (flags & XFS_BMAPI_WRITE)) != 0) XFS_STATS_INC(xs_blk_mapw); else XFS_STATS_INC(xs_blk_mapr); @@ -3634,8 +3634,8 @@ xfs_bmapi( cur = NULL; if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { ASSERT(wr && tp); - if (error = xfs_bmap_local_to_extents(tp, ip, firstblock, total, - &logflags, whichfork)) + if ((error = xfs_bmap_local_to_extents(tp, ip, firstblock, total, + &logflags, whichfork))) goto error0; } if (wr && *firstblock == NULLFSBLOCK) { @@ -3760,21 +3760,21 @@ xfs_bmapi( */ if (mp->m_dalign && alen >= mp->m_dalign && userdata && whichfork == XFS_DATA_FORK) { - if (error = xfs_bmap_isaeof(ip, aoff, - whichfork, &bma.aeof)) + if ((error = xfs_bmap_isaeof(ip, aoff, + whichfork, &bma.aeof))) goto error0; } else bma.aeof = 0; /* * Call allocator. */ - if (error = xfs_bmap_alloc(&bma)) + if ((error = xfs_bmap_alloc(&bma))) goto error0; /* * Copy out result fields. */ abno = bma.rval; - if (flist->xbf_low = bma.low) + if ((flist->xbf_low = bma.low)) minleft = 0; alen = bma.alen; aoff = bma.off; diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index 68c187760..1e86fb44f 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -44,7 +44,7 @@ xfs_bmbt_delrec( { xfs_bmbt_block_t *block; /* bmap btree block */ xfs_fsblock_t bno; /* fs-relative block number */ - xfs_buf_t *bp; /* buffer for block */ + xfs_buf_t *bp; /* buffer for block */ int error; /* error return value */ #ifdef XFS_BMBT_TRACE static char fname[] = "xfs_bmbt_delrec"; @@ -52,26 +52,26 @@ xfs_bmbt_delrec( int i; /* loop counter */ int j; /* temp state */ xfs_bmbt_key_t key; /* bmap btree key */ - xfs_bmbt_key_t *kp; /* pointer to bmap btree key */ + xfs_bmbt_key_t *kp=NULL; /* pointer to bmap btree key */ xfs_fsblock_t lbno; /* left sibling block number */ - xfs_buf_t *lbp; /* left buffer pointer */ + xfs_buf_t *lbp; /* left buffer pointer */ xfs_bmbt_block_t *left; /* left btree block */ xfs_bmbt_key_t *lkp; /* left btree key */ xfs_bmbt_ptr_t *lpp; /* left address pointer */ - int lrecs; /* left record count */ + int lrecs=0; /* left record count */ xfs_bmbt_rec_t *lrp; /* left record pointer */ xfs_mount_t *mp; /* file system mount point */ xfs_bmbt_ptr_t *pp; /* pointer to bmap block addr */ int ptr; /* key/record index */ xfs_fsblock_t rbno; /* right sibling block number */ - xfs_buf_t *rbp; /* right buffer pointer */ + xfs_buf_t *rbp; /* right buffer pointer */ xfs_bmbt_block_t *right; /* right btree block */ xfs_bmbt_key_t *rkp; /* right btree key */ xfs_bmbt_rec_t *rp; /* pointer to bmap btree rec */ xfs_bmbt_ptr_t *rpp; /* right address pointer */ xfs_bmbt_block_t *rrblock; /* right-right btree block */ - xfs_buf_t *rrbp; /* right-right buffer pointer */ - int rrecs; /* right record count */ + xfs_buf_t *rrbp; /* right-right buffer pointer */ + int rrecs=0; /* right record count */ xfs_bmbt_rec_t *rrp; /* right record pointer */ xfs_btree_cur_t *tcur; /* temporary btree cursor */ @@ -86,7 +86,7 @@ xfs_bmbt_delrec( } block = xfs_bmbt_get_block(cur, level, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, level, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, level, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -102,7 +102,7 @@ xfs_bmbt_delrec( pp = XFS_BMAP_PTR_IADDR(block, 1, cur); #ifdef DEBUG for (i = ptr; i < INT_GET(block->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -139,7 +139,7 @@ xfs_bmbt_delrec( if (level == cur->bc_nlevels - 1) { xfs_iroot_realloc(cur->bc_private.b.ip, -1, cur->bc_private.b.whichfork); - if (error = xfs_bmbt_killroot(cur, async)) { + if ((error = xfs_bmbt_killroot(cur, async))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -173,7 +173,7 @@ xfs_bmbt_delrec( */ if (lbno == NULLFSBLOCK && rbno == NULLFSBLOCK && level == cur->bc_nlevels - 2) { - if (error = xfs_bmbt_killroot(cur, async)) { + if ((error = xfs_bmbt_killroot(cur, async))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -186,7 +186,7 @@ xfs_bmbt_delrec( return 0; } ASSERT(rbno != NULLFSBLOCK || lbno != NULLFSBLOCK); - if (error = xfs_btree_dup_cursor(cur, &tcur)) { + if ((error = xfs_btree_dup_cursor(cur, &tcur))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -194,7 +194,7 @@ xfs_bmbt_delrec( if (rbno != NULLFSBLOCK) { i = xfs_btree_lastrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_bmbt_increment(tcur, level, &i)) { + if ((error = xfs_bmbt_increment(tcur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -204,7 +204,7 @@ xfs_bmbt_delrec( rbp = tcur->bc_bufs[level]; right = XFS_BUF_TO_BMBT_BLOCK(rbp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, right, level, rbp)) { + if ((error = xfs_btree_check_lblock(cur, right, level, rbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -212,7 +212,7 @@ xfs_bmbt_delrec( bno = INT_GET(right->bb_leftsib, ARCH_CONVERT); if (INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1 >= XFS_BMAP_BLOCK_IMINRECS(level, cur)) { - if (error = xfs_bmbt_lshift(tcur, level, &i)) { + if ((error = xfs_bmbt_lshift(tcur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -222,8 +222,8 @@ xfs_bmbt_delrec( xfs_btree_del_cursor(tcur, XFS_BTREE_NOERROR); tcur = NULL; if (level > 0) { - if (error = xfs_bmbt_decrement(cur, - level, &i)) { + if ((error = xfs_bmbt_decrement(cur, + level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; @@ -238,7 +238,7 @@ xfs_bmbt_delrec( if (lbno != NULLFSBLOCK) { i = xfs_btree_firstrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_bmbt_decrement(tcur, level, &i)) { + if ((error = xfs_bmbt_decrement(tcur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -251,7 +251,7 @@ xfs_bmbt_delrec( /* * decrement to last in block */ - if (error = xfs_bmbt_decrement(tcur, level, &i)) { + if ((error = xfs_bmbt_decrement(tcur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -260,7 +260,7 @@ xfs_bmbt_delrec( lbp = tcur->bc_bufs[level]; left = XFS_BUF_TO_BMBT_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, left, level, lbp)) { + if ((error = xfs_btree_check_lblock(cur, left, level, lbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -268,7 +268,7 @@ xfs_bmbt_delrec( bno = INT_GET(left->bb_rightsib, ARCH_CONVERT); if (INT_GET(left->bb_numrecs, ARCH_CONVERT) - 1 >= XFS_BMAP_BLOCK_IMINRECS(level, cur)) { - if (error = xfs_bmbt_rshift(tcur, level, &i)) { + if ((error = xfs_bmbt_rshift(tcur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -295,13 +295,13 @@ xfs_bmbt_delrec( rbno = bno; right = block; rbp = bp; - if (error = xfs_btree_read_bufl(mp, cur->bc_tp, lbno, 0, &lbp, - XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, cur->bc_tp, lbno, 0, &lbp, + XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } left = XFS_BUF_TO_BMBT_BLOCK(lbp); - if (error = xfs_btree_check_lblock(cur, left, level, lbp)) { + if ((error = xfs_btree_check_lblock(cur, left, level, lbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -311,13 +311,13 @@ xfs_bmbt_delrec( lbno = bno; left = block; lbp = bp; - if (error = xfs_btree_read_bufl(mp, cur->bc_tp, rbno, 0, &rbp, - XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, cur->bc_tp, rbno, 0, &rbp, + XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } right = XFS_BUF_TO_BMBT_BLOCK(rbp); - if (error = xfs_btree_check_lblock(cur, right, level, rbp)) { + if ((error = xfs_btree_check_lblock(cur, right, level, rbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -338,7 +338,7 @@ xfs_bmbt_delrec( rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -361,14 +361,14 @@ xfs_bmbt_delrec( left->bb_rightsib = right->bb_rightsib; /* INT_: direct copy */ xfs_bmbt_log_block(cur, lbp, XFS_BB_RIGHTSIB | XFS_BB_NUMRECS); if (INT_GET(left->bb_rightsib, ARCH_CONVERT) != NULLDFSBNO) { - if (error = xfs_btree_read_bufl(mp, cur->bc_tp, + if ((error = xfs_btree_read_bufl(mp, cur->bc_tp, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, &rrbp, - XFS_BMAP_BTREE_REF)) { + XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } rrblock = XFS_BUF_TO_BMBT_BLOCK(rrbp); - if (error = xfs_btree_check_lblock(cur, rrblock, level, rrbp)) { + if ((error = xfs_btree_check_lblock(cur, rrblock, level, rrbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -391,7 +391,7 @@ xfs_bmbt_delrec( cur->bc_bufs[level] = lbp; cur->bc_ptrs[level] += lrecs; cur->bc_ra[level] = 0; - } else if (error = xfs_bmbt_increment(cur, level + 1, &i)) { + } else if ((error = xfs_bmbt_increment(cur, level + 1, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); goto error0; } @@ -421,14 +421,14 @@ xfs_bmbt_insrec( int *stat) /* no-go/done/continue */ { xfs_bmbt_block_t *block; /* bmap btree block */ - xfs_buf_t *bp; /* buffer for block */ + xfs_buf_t *bp; /* buffer for block */ int error; /* error return value */ #ifdef XFS_BMBT_TRACE static char fname[] = "xfs_bmbt_insrec"; #endif int i; /* loop index */ xfs_bmbt_key_t key; /* bmap btree key */ - xfs_bmbt_key_t *kp; /* pointer to bmap btree key */ + xfs_bmbt_key_t *kp=NULL; /* pointer to bmap btree key */ int logflags; /* inode logging flags */ xfs_fsblock_t nbno; /* new block number */ struct xfs_btree_cur *ncur; /* new btree cursor */ @@ -437,7 +437,7 @@ xfs_bmbt_insrec( int optr; /* old key/record index */ xfs_bmbt_ptr_t *pp; /* pointer to bmap block addr */ int ptr; /* key/record index */ - xfs_bmbt_rec_t *rp; /* pointer to bmap btree rec */ + xfs_bmbt_rec_t *rp=NULL; /* pointer to bmap btree rec */ ASSERT(level < cur->bc_nlevels); XFS_BMBT_TRACE_CURSOR(cur, ENTRY); @@ -453,7 +453,7 @@ xfs_bmbt_insrec( XFS_STATS_INC(xs_bmbt_insrec); block = xfs_bmbt_get_block(cur, level, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, level, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, level, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -486,23 +486,23 @@ xfs_bmbt_insrec( logflags); block = xfs_bmbt_get_block(cur, level, &bp); } else { - if (error = xfs_bmbt_rshift(cur, level, &i)) { + if ((error = xfs_bmbt_rshift(cur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } if (i) { /* nothing */ } else { - if (error = xfs_bmbt_lshift(cur, level, &i)) { + if ((error = xfs_bmbt_lshift(cur, level, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } if (i) { optr = ptr = cur->bc_ptrs[level]; } else { - if (error = xfs_bmbt_split(cur, level, + if ((error = xfs_bmbt_split(cur, level, &nbno, &nkey, &ncur, - &i)) { + &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; @@ -511,9 +511,9 @@ xfs_bmbt_insrec( block = xfs_bmbt_get_block( cur, level, &bp); #ifdef DEBUG - if (error = + if ((error = xfs_btree_check_lblock(cur, - block, level, bp)) { + block, level, bp))) { XFS_BMBT_TRACE_CURSOR( cur, ERROR); return error; @@ -538,8 +538,8 @@ xfs_bmbt_insrec( pp = XFS_BMAP_PTR_IADDR(block, 1, cur); #ifdef DEBUG for (i = INT_GET(block->bb_numrecs, ARCH_CONVERT); i >= ptr; i--) { - if (error = xfs_btree_check_lptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), - level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), + level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -550,8 +550,8 @@ xfs_bmbt_insrec( ovbcopy(&pp[ptr - 1], &pp[ptr], /* INT_: direct copy */ (INT_GET(block->bb_numrecs, ARCH_CONVERT) - ptr + 1) * sizeof(*pp)); #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)*bnop, - level)) { + if ((error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)*bnop, + level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -601,7 +601,7 @@ xfs_bmbt_killroot( { xfs_bmbt_block_t *block; xfs_bmbt_block_t *cblock; - xfs_buf_t *cbp; + xfs_buf_t *cbp; xfs_bmbt_key_t *ckp; xfs_bmbt_ptr_t *cpp; #ifdef DEBUG @@ -667,7 +667,7 @@ xfs_bmbt_killroot( cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(cblock->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_lptr(cur, INT_GET(cpp[i], ARCH_CONVERT), level - 1)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(cpp[i], ARCH_CONVERT), level - 1))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -700,7 +700,7 @@ xfs_bmbt_killroot( STATIC void xfs_bmbt_log_keys( xfs_btree_cur_t *cur, - xfs_buf_t *bp, + xfs_buf_t *bp, int kfirst, int klast) { @@ -739,7 +739,7 @@ xfs_bmbt_log_keys( STATIC void xfs_bmbt_log_ptrs( xfs_btree_cur_t *cur, - xfs_buf_t *bp, + xfs_buf_t *bp, int pfirst, int plast) { @@ -781,21 +781,21 @@ xfs_bmbt_lookup( xfs_lookup_t dir, int *stat) /* success/failure */ { - xfs_bmbt_block_t *block; - xfs_buf_t *bp; - xfs_daddr_t d; + xfs_bmbt_block_t *block=NULL; + xfs_buf_t *bp; + xfs_daddr_t d; xfs_sfiloff_t diff; int error; /* error return value */ #ifdef XFS_BMBT_TRACE static char fname[] = "xfs_bmbt_lookup"; #endif - xfs_fsblock_t fsbno; + xfs_fsblock_t fsbno=0; int high; int i; - int keyno; - xfs_bmbt_key_t *kkbase; + int keyno=0; + xfs_bmbt_key_t *kkbase=NULL; xfs_bmbt_key_t *kkp; - xfs_bmbt_rec_t *krbase; + xfs_bmbt_rec_t *krbase=NULL; xfs_bmbt_rec_t *krp; int level; int low; @@ -818,15 +818,15 @@ xfs_bmbt_lookup( if (bp && XFS_BUF_ADDR(bp) != d) bp = (xfs_buf_t *)0; if (!bp) { - if (error = xfs_btree_read_bufl(mp, tp, fsbno, - 0, &bp, XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, tp, fsbno, + 0, &bp, XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } xfs_btree_setbuf(cur, level, bp); block = XFS_BUF_TO_BMBT_BLOCK(bp); - if (error = xfs_btree_check_lblock(cur, block, - level, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, + level, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -874,7 +874,7 @@ xfs_bmbt_lookup( keyno = 1; pp = XFS_BMAP_PTR_IADDR(block, keyno, cur); #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -892,7 +892,7 @@ xfs_bmbt_lookup( if (dir == XFS_LOOKUP_GE && keyno > INT_GET(block->bb_numrecs, ARCH_CONVERT) && INT_GET(block->bb_rightsib, ARCH_CONVERT) != NULLDFSBNO) { cur->bc_ptrs[0] = keyno; - if (error = xfs_bmbt_increment(cur, 0, &i)) { + if ((error = xfs_bmbt_increment(cur, 0, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -933,18 +933,18 @@ xfs_bmbt_lshift( int i; /* loop counter */ #endif xfs_bmbt_key_t key; /* bmap btree key */ - xfs_buf_t *lbp; /* left buffer pointer */ + xfs_buf_t *lbp; /* left buffer pointer */ xfs_bmbt_block_t *left; /* left btree block */ - xfs_bmbt_key_t *lkp; /* left btree key */ + xfs_bmbt_key_t *lkp=NULL; /* left btree key */ xfs_bmbt_ptr_t *lpp; /* left address pointer */ int lrecs; /* left record count */ - xfs_bmbt_rec_t *lrp; /* left record pointer */ + xfs_bmbt_rec_t *lrp=NULL; /* left record pointer */ xfs_mount_t *mp; /* file system mount point */ - xfs_buf_t *rbp; /* right buffer pointer */ + xfs_buf_t *rbp; /* right buffer pointer */ xfs_bmbt_block_t *right; /* right btree block */ - xfs_bmbt_key_t *rkp; /* right btree key */ - xfs_bmbt_ptr_t *rpp; /* right address pointer */ - xfs_bmbt_rec_t *rrp; /* right record pointer */ + xfs_bmbt_key_t *rkp=NULL; /* right btree key */ + xfs_bmbt_ptr_t *rpp=NULL; /* right address pointer */ + xfs_bmbt_rec_t *rrp=NULL; /* right record pointer */ XFS_BMBT_TRACE_CURSOR(cur, ENTRY); XFS_BMBT_TRACE_ARGI(cur, level); @@ -956,7 +956,7 @@ xfs_bmbt_lshift( rbp = cur->bc_bufs[level]; right = XFS_BUF_TO_BMBT_BLOCK(rbp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, right, level, rbp)) { + if ((error = xfs_btree_check_lblock(cur, right, level, rbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -972,13 +972,13 @@ xfs_bmbt_lshift( return 0; } mp = cur->bc_mp; - if (error = xfs_btree_read_bufl(mp, cur->bc_tp, INT_GET(right->bb_leftsib, ARCH_CONVERT), 0, - &lbp, XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, cur->bc_tp, INT_GET(right->bb_leftsib, ARCH_CONVERT), 0, + &lbp, XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } left = XFS_BUF_TO_BMBT_BLOCK(lbp); - if (error = xfs_btree_check_lblock(cur, left, level, lbp)) { + if ((error = xfs_btree_check_lblock(cur, left, level, lbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -996,7 +996,7 @@ xfs_bmbt_lshift( lpp = XFS_BMAP_PTR_IADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, cur); rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, INT_GET(*rpp, ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(*rpp, ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1022,8 +1022,8 @@ xfs_bmbt_lshift( if (level > 0) { #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_lptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), - level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), + level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1039,7 +1039,7 @@ xfs_bmbt_lshift( INT_SET(key.br_startoff, ARCH_CONVERT, xfs_bmbt_get_startoff(rrp)); rkp = &key; } - if (error = xfs_bmbt_updkey(cur, rkp, level + 1)) { + if ((error = xfs_bmbt_updkey(cur, rkp, level + 1))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1065,17 +1065,17 @@ xfs_bmbt_rshift( #endif int i; /* loop counter */ xfs_bmbt_key_t key; /* bmap btree key */ - xfs_buf_t *lbp; /* left buffer pointer */ + xfs_buf_t *lbp; /* left buffer pointer */ xfs_bmbt_block_t *left; /* left btree block */ xfs_bmbt_key_t *lkp; /* left btree key */ xfs_bmbt_ptr_t *lpp; /* left address pointer */ xfs_bmbt_rec_t *lrp; /* left record pointer */ xfs_mount_t *mp; /* file system mount point */ - xfs_buf_t *rbp; /* right buffer pointer */ + xfs_buf_t *rbp; /* right buffer pointer */ xfs_bmbt_block_t *right; /* right btree block */ xfs_bmbt_key_t *rkp; /* right btree key */ xfs_bmbt_ptr_t *rpp; /* right address pointer */ - xfs_bmbt_rec_t *rrp; /* right record pointer */ + xfs_bmbt_rec_t *rrp=NULL; /* right record pointer */ struct xfs_btree_cur *tcur; /* temporary btree cursor */ XFS_BMBT_TRACE_CURSOR(cur, ENTRY); @@ -1088,7 +1088,7 @@ xfs_bmbt_rshift( lbp = cur->bc_bufs[level]; left = XFS_BUF_TO_BMBT_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, left, level, lbp)) { + if ((error = xfs_btree_check_lblock(cur, left, level, lbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1104,13 +1104,13 @@ xfs_bmbt_rshift( return 0; } mp = cur->bc_mp; - if (error = xfs_btree_read_bufl(mp, cur->bc_tp, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, - &rbp, XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, cur->bc_tp, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, + &rbp, XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } right = XFS_BUF_TO_BMBT_BLOCK(rbp); - if (error = xfs_btree_check_lblock(cur, right, level, rbp)) { + if ((error = xfs_btree_check_lblock(cur, right, level, rbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1126,7 +1126,7 @@ xfs_bmbt_rshift( rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); #ifdef DEBUG for (i = INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1; i >= 0; i--) { - if (error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1135,7 +1135,7 @@ xfs_bmbt_rshift( ovbcopy(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); ovbcopy(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, INT_GET(*lpp, ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1163,18 +1163,18 @@ xfs_bmbt_rshift( xfs_btree_check_rec(XFS_BTNUM_BMAP, rrp, rrp + 1); #endif xfs_bmbt_log_block(cur, rbp, XFS_BB_NUMRECS); - if (error = xfs_btree_dup_cursor(cur, &tcur)) { + if ((error = xfs_btree_dup_cursor(cur, &tcur))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } i = xfs_btree_lastrec(tcur, level); XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_bmbt_increment(tcur, level, &i)) { + if ((error = xfs_bmbt_increment(tcur, level, &i))) { XFS_BMBT_TRACE_CURSOR(tcur, ERROR); goto error1; } XFS_WANT_CORRUPTED_GOTO(i == 1, error0); - if (error = xfs_bmbt_updkey(tcur, rkp, level + 1)) { + if ((error = xfs_bmbt_updkey(tcur, rkp, level + 1))) { XFS_BMBT_TRACE_CURSOR(tcur, ERROR); goto error1; } @@ -1226,17 +1226,17 @@ xfs_bmbt_split( #endif int i; /* loop counter */ xfs_fsblock_t lbno; /* left sibling block number */ - xfs_buf_t *lbp; /* left buffer pointer */ + xfs_buf_t *lbp; /* left buffer pointer */ xfs_bmbt_block_t *left; /* left btree block */ xfs_bmbt_key_t *lkp; /* left btree key */ xfs_bmbt_ptr_t *lpp; /* left address pointer */ xfs_bmbt_rec_t *lrp; /* left record pointer */ - xfs_buf_t *rbp; /* right buffer pointer */ + xfs_buf_t *rbp; /* right buffer pointer */ xfs_bmbt_block_t *right; /* right btree block */ xfs_bmbt_key_t *rkp; /* right btree key */ xfs_bmbt_ptr_t *rpp; /* right address pointer */ xfs_bmbt_block_t *rrblock; /* right-right btree block */ - xfs_buf_t *rrbp; /* right-right buffer pointer */ + xfs_buf_t *rrbp; /* right-right buffer pointer */ xfs_bmbt_rec_t *rrp; /* right record pointer */ XFS_BMBT_TRACE_CURSOR(cur, ENTRY); @@ -1262,7 +1262,7 @@ xfs_bmbt_split( XFS_BMBT_TRACE_CURSOR(cur, ERROR); return XFS_ERROR(ENOSPC); } - if (error = xfs_alloc_vextent(&args)) { + if ((error = xfs_alloc_vextent(&args))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1284,7 +1284,7 @@ xfs_bmbt_split( rbp = xfs_btree_get_bufl(args.mp, args.tp, args.fsbno, 0); right = XFS_BUF_TO_BMBT_BLOCK(rbp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, left, level, rbp)) { + if ((error = xfs_btree_check_lblock(cur, left, level, rbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1303,7 +1303,7 @@ xfs_bmbt_split( rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_lptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1328,14 +1328,14 @@ xfs_bmbt_split( xfs_bmbt_log_block(cur, rbp, XFS_BB_ALL_BITS); xfs_bmbt_log_block(cur, lbp, XFS_BB_NUMRECS | XFS_BB_RIGHTSIB); if (INT_GET(right->bb_rightsib, ARCH_CONVERT) != NULLDFSBNO) { - if (error = xfs_btree_read_bufl(args.mp, args.tp, + if ((error = xfs_btree_read_bufl(args.mp, args.tp, INT_GET(right->bb_rightsib, ARCH_CONVERT), 0, &rrbp, - XFS_BMAP_BTREE_REF)) { + XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } rrblock = XFS_BUF_TO_BMBT_BLOCK(rrbp); - if (error = xfs_btree_check_lblock(cur, rrblock, level, rrbp)) { + if ((error = xfs_btree_check_lblock(cur, rrblock, level, rrbp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1347,7 +1347,7 @@ xfs_bmbt_split( cur->bc_ptrs[level] -= INT_GET(left->bb_numrecs, ARCH_CONVERT); } if (level + 1 < cur->bc_nlevels) { - if (error = xfs_btree_dup_cursor(cur, curp)) { + if ((error = xfs_btree_dup_cursor(cur, curp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1369,7 +1369,7 @@ xfs_bmbt_updkey( int level) { xfs_bmbt_block_t *block; - xfs_buf_t *bp; + xfs_buf_t *bp; #ifdef DEBUG int error; #endif @@ -1385,7 +1385,7 @@ xfs_bmbt_updkey( for (ptr = 1; ptr == 1 && level < cur->bc_nlevels; level++) { block = xfs_bmbt_get_block(cur, level, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, level, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, level, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1442,7 +1442,7 @@ xfs_bmbt_decrement( int *stat) /* success/failure */ { xfs_bmbt_block_t *block; - xfs_buf_t *bp; + xfs_buf_t *bp; int error; /* error return value */ #ifdef XFS_BMBT_TRACE static char fname[] = "xfs_bmbt_decrement"; @@ -1464,7 +1464,7 @@ xfs_bmbt_decrement( } block = xfs_bmbt_get_block(cur, level, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, level, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, level, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1489,15 +1489,15 @@ xfs_bmbt_decrement( mp = cur->bc_mp; for (block = xfs_bmbt_get_block(cur, lev, &bp); lev > level; ) { fsbno = INT_GET(*XFS_BMAP_PTR_IADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); - if (error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp, - XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp, + XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } lev--; xfs_btree_setbuf(cur, lev, bp); block = XFS_BUF_TO_BMBT_BLOCK(bp); - if (error = xfs_btree_check_lblock(cur, block, lev, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, lev, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1526,7 +1526,7 @@ xfs_bmbt_delete( XFS_BMBT_TRACE_CURSOR(cur, ENTRY); for (level = 0, i = 2; i == 2; level++) { - if (error = xfs_bmbt_delrec(cur, level, async, &i)) { + if ((error = xfs_bmbt_delrec(cur, level, async, &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1534,8 +1534,8 @@ xfs_bmbt_delete( if (i == 0) { for (level = 1; level < cur->bc_nlevels; level++) { if (cur->bc_ptrs[level] == 0) { - if (error = xfs_bmbt_decrement(cur, level, - &i)) { + if ((error = xfs_bmbt_decrement(cur, level, + &i))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1657,7 +1657,7 @@ xfs_bmbt_block_t * xfs_bmbt_get_block( xfs_btree_cur_t *cur, int level, - xfs_buf_t **bpp) + xfs_buf_t **bpp) { xfs_ifork_t *ifp; xfs_bmbt_block_t *rval; @@ -1802,7 +1802,7 @@ xfs_bmbt_increment( int *stat) /* success/failure */ { xfs_bmbt_block_t *block; - xfs_buf_t *bp; + xfs_buf_t *bp; int error; /* error return value */ #ifdef XFS_BMBT_TRACE static char fname[] = "xfs_bmbt_increment"; @@ -1819,7 +1819,7 @@ xfs_bmbt_increment( xfs_btree_readahead(cur, level, XFS_BTCUR_RIGHTRA); block = xfs_bmbt_get_block(cur, level, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, level, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, level, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1837,7 +1837,7 @@ xfs_bmbt_increment( for (lev = level + 1; lev < cur->bc_nlevels; lev++) { block = xfs_bmbt_get_block(cur, lev, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, lev, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, lev, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1856,15 +1856,15 @@ xfs_bmbt_increment( mp = cur->bc_mp; for (block = xfs_bmbt_get_block(cur, lev, &bp); lev > level; ) { fsbno = INT_GET(*XFS_BMAP_PTR_IADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); - if (error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp, - XFS_BMAP_BTREE_REF)) { + if ((error = xfs_btree_read_bufl(mp, tp, fsbno, 0, &bp, + XFS_BMAP_BTREE_REF))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } lev--; xfs_btree_setbuf(cur, lev, bp); block = XFS_BUF_TO_BMBT_BLOCK(bp); - if (error = xfs_btree_check_lblock(cur, block, lev, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, lev, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -1901,8 +1901,8 @@ xfs_bmbt_insert( ncur = (xfs_btree_cur_t *)0; pcur = cur; do { - if (error = xfs_bmbt_insrec(pcur, level++, &nbno, &nrec, &ncur, - &i)) { + if ((error = xfs_bmbt_insrec(pcur, level++, &nbno, &nrec, &ncur, + &i))) { if (pcur != cur) xfs_btree_del_cursor(pcur, XFS_BTREE_ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR); @@ -1942,7 +1942,7 @@ error0: void xfs_bmbt_log_block( xfs_btree_cur_t *cur, - xfs_buf_t *bp, + xfs_buf_t *bp, int fields) { int first; @@ -1979,7 +1979,7 @@ xfs_bmbt_log_block( void xfs_bmbt_log_recs( xfs_btree_cur_t *cur, - xfs_buf_t *bp, + xfs_buf_t *bp, int rfirst, int rlast) { @@ -2058,7 +2058,7 @@ xfs_bmbt_newroot( { xfs_alloc_arg_t args; /* allocation arguments */ xfs_bmbt_block_t *block; /* bmap btree block */ - xfs_buf_t *bp; /* buffer for block */ + xfs_buf_t *bp; /* buffer for block */ xfs_bmbt_block_t *cblock; /* child btree block */ xfs_bmbt_key_t *ckp; /* child key pointer */ xfs_bmbt_ptr_t *cpp; /* child ptr pointer */ @@ -2089,7 +2089,7 @@ xfs_bmbt_newroot( args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL; if (args.fsbno == NULLFSBLOCK) { #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -2100,7 +2100,7 @@ xfs_bmbt_newroot( args.type = XFS_ALLOCTYPE_FIRST_AG; else args.type = XFS_ALLOCTYPE_NEAR_BNO; - if (error = xfs_alloc_vextent(&args)) { + if ((error = xfs_alloc_vextent(&args))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -2131,7 +2131,7 @@ xfs_bmbt_newroot( cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(cblock->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level)) { + if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -2139,8 +2139,8 @@ xfs_bmbt_newroot( #endif bcopy(pp, cpp, INT_GET(cblock->bb_numrecs, ARCH_CONVERT) * sizeof(*pp)); #ifdef DEBUG - if (error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)args.fsbno, - level)) { + if ((error = xfs_btree_check_lptr(cur, (xfs_bmbt_ptr_t)args.fsbno, + level))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -2464,7 +2464,7 @@ xfs_bmbt_update( xfs_exntst_t state) { xfs_bmbt_block_t *block; - xfs_buf_t *bp; + xfs_buf_t *bp; int error; #ifdef XFS_BMBT_TRACE static char fname[] = "xfs_bmbt_update"; @@ -2478,7 +2478,7 @@ xfs_bmbt_update( (xfs_dfilblks_t)len, (int)state); block = xfs_bmbt_get_block(cur, 0, &bp); #ifdef DEBUG - if (error = xfs_btree_check_lblock(cur, block, 0, bp)) { + if ((error = xfs_btree_check_lblock(cur, block, 0, bp))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } @@ -2492,7 +2492,7 @@ xfs_bmbt_update( return 0; } INT_SET(key.br_startoff, ARCH_CONVERT, off); - if (error = xfs_bmbt_updkey(cur, &key, 1)) { + if ((error = xfs_bmbt_updkey(cur, &key, 1))) { XFS_BMBT_TRACE_CURSOR(cur, ERROR); return error; } diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c index bbb06dbb2..6f654b223 100644 --- a/libxfs/xfs_btree.c +++ b/libxfs/xfs_btree.c @@ -192,7 +192,6 @@ xfs_btree_check_lblock( XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_rightsib, ARCH_CONVERT))); if (XFS_TEST_ERROR(!lblock_ok, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK, XFS_RANDOM_BTREE_CHECK_LBLOCK)) { -#pragma mips_frequency_hint NEVER if (bp) xfs_buftrace("LBTREE ERROR", bp); return XFS_ERROR(EFSCORRUPTED); @@ -311,7 +310,6 @@ xfs_btree_check_sblock( if (XFS_TEST_ERROR(!sblock_ok, cur->bc_mp, XFS_ERRTAG_BTREE_CHECK_SBLOCK, XFS_RANDOM_BTREE_CHECK_SBLOCK)) { -#pragma mips_frequency_hint NEVER if (bp) xfs_buftrace("SBTREE ERROR", bp); return XFS_ERROR(EFSCORRUPTED); @@ -412,10 +410,9 @@ xfs_btree_dup_cursor( for (i = 0; i < new->bc_nlevels; i++) { new->bc_ptrs[i] = cur->bc_ptrs[i]; new->bc_ra[i] = cur->bc_ra[i]; - if (bp = cur->bc_bufs[i]) { - if (error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, - XFS_BUF_ADDR(bp), mp->m_bsize, 0, &bp)) { -#pragma mips_frequency_hint NEVER + if ((bp = cur->bc_bufs[i])) { + if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, + XFS_BUF_ADDR(bp), mp->m_bsize, 0, &bp))) { xfs_btree_del_cursor(new, error); *ncur = NULL; return error; @@ -562,7 +559,7 @@ xfs_btree_init_cursor( xfs_agi_t *agi; /* (I) allocation group inodespace */ xfs_btree_cur_t *cur; /* return value */ xfs_ifork_t *ifp; /* (I) inode fork pointer */ - int nlevels; /* number of levels in the btree */ + int nlevels=0; /* number of levels in the btree */ ASSERT(xfs_btree_cur_zone != NULL); /* @@ -737,9 +734,8 @@ xfs_btree_read_bufl( ASSERT(fsbno != NULLFSBLOCK); d = XFS_FSB_TO_DADDR(mp, fsbno); - if (error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, - mp->m_bsize, lock, &bp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, + mp->m_bsize, lock, &bp))) { return error; } ASSERT(!bp || !XFS_BUF_GETERROR(bp)); @@ -765,15 +761,14 @@ xfs_btree_read_bufs( int refval) /* ref count value for buffer */ { xfs_buf_t *bp; /* return value */ - xfs_daddr_t d; /* real disk block address */ + xfs_daddr_t d; /* real disk block address */ int error; ASSERT(agno != NULLAGNUMBER); ASSERT(agbno != NULLAGBLOCK); d = XFS_AGB_TO_DADDR(mp, agno, agbno); - if (error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, - mp->m_bsize, lock, &bp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, + mp->m_bsize, lock, &bp))) { return error; } ASSERT(!bp || !XFS_BUF_GETERROR(bp)); diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 37ad6269d..51a4d5b20 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -885,7 +885,7 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) xfs_da_state_blk_t *blk; xfs_da_intnode_t *node; xfs_da_node_entry_t *btree; - xfs_dahash_t lasthash; + xfs_dahash_t lasthash=0; int level, count; level = path->active-1; @@ -1217,7 +1217,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, { xfs_da_blkinfo_t *old_info, *new_info, *tmp_info; xfs_da_args_t *args; - int before, error; + int before=0, error; xfs_dabuf_t *bp; /* @@ -1441,7 +1441,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, xfs_da_blkinfo_t *info; xfs_da_intnode_t *node; xfs_da_args_t *args; - xfs_dablk_t blkno; + xfs_dablk_t blkno=0; int level, error; /* @@ -1625,8 +1625,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) /* * Find a spot in the file space to put the new block. */ - if (error = xfs_bmap_first_unused(tp, dp, count, &bno, w)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_bmap_first_unused(tp, dp, count, &bno, w))) { return error; } if (w == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) @@ -1636,12 +1635,11 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) */ nmap = 1; ASSERT(args->firstblock != NULL); - if (error = xfs_bmapi(tp, dp, bno, count, + if ((error = xfs_bmapi(tp, dp, bno, count, XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA| XFS_BMAPI_CONTIG, args->firstblock, args->total, &map, &nmap, - args->flist)) { -#pragma mips_frequency_hint NEVER + args->flist))) { return error; } ASSERT(nmap <= 1); @@ -1654,16 +1652,15 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) * try without the CONTIG flag. Loop until we get it all. */ else if (nmap == 0 && count > 1) { -#pragma mips_frequency_hint NEVER mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP); for (b = bno, mapi = 0; b < bno + count; ) { nmap = MIN(XFS_BMAP_MAX_NMAP, count); c = (int)(bno + count - b); - if (error = xfs_bmapi(tp, dp, b, c, + if ((error = xfs_bmapi(tp, dp, b, c, XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE| XFS_BMAPI_METADATA, args->firstblock, args->total, - &mapp[mapi], &nmap, args->flist)) { + &mapp[mapi], &nmap, args->flist))) { kmem_free(mapp, sizeof(*mapp) * count); return error; } @@ -1674,7 +1671,6 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) mapp[mapi - 1].br_blockcount; } } else { -#pragma mips_frequency_hint NEVER mapi = 0; mapp = NULL; } @@ -1686,7 +1682,6 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) if (got != count || mapp[0].br_startoff != bno || mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount != bno + count) { -#pragma mips_frequency_hint NEVER if (mapp != &map) kmem_free(mapp, sizeof(*mapp) * count); return XFS_ERROR(ENOSPC); @@ -1699,7 +1694,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) */ if (w == XFS_DATA_FORK && XFS_DIR_IS_V1(mp)) { ASSERT(mapi == 1); - if (error = xfs_bmap_last_offset(tp, dp, &bno, w)) + if ((error = xfs_bmap_last_offset(tp, dp, &bno, w))) return error; size = XFS_FSB_TO_B(mp, bno); if (size != dp->i_d.di_size) { @@ -1756,7 +1751,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, * Read the last block in the btree space. */ last_blkno = (xfs_dablk_t)lastoff - mp->m_dirblkfsbs; - if (error = xfs_da_read_buf(tp, ip, last_blkno, -1, &last_buf, w)) + if ((error = xfs_da_read_buf(tp, ip, last_blkno, -1, &last_buf, w))) return error; /* * Copy the last block into the dead buffer and log it. @@ -1788,8 +1783,8 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, /* * If the moved block has a left sibling, fix up the pointers. */ - if (sib_blkno = INT_GET(dead_info->back, ARCH_CONVERT)) { - if (error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w)) + if ((sib_blkno = INT_GET(dead_info->back, ARCH_CONVERT))) { + if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) goto done; sib_info = sib_buf->data; if (INT_GET(sib_info->forw, ARCH_CONVERT) != last_blkno || @@ -1807,8 +1802,8 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, /* * If the moved block has a right sibling, fix up the pointers. */ - if (sib_blkno = INT_GET(dead_info->forw, ARCH_CONVERT)) { - if (error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w)) + if ((sib_blkno = INT_GET(dead_info->forw, ARCH_CONVERT))) { + if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) goto done; sib_info = sib_buf->data; if ( INT_GET(sib_info->back, ARCH_CONVERT) != last_blkno @@ -1830,7 +1825,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, * Walk down the tree looking for the parent of the moved block. */ for (;;) { - if (error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w)) + if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w))) goto done; par_node = par_buf->data; if (INT_GET(par_node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC || @@ -1873,7 +1868,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, error = XFS_ERROR(EFSCORRUPTED); goto done; } - if (error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w)) + if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w))) goto done; par_node = par_buf->data; if (INT_GET(par_node->hdr.level, ARCH_CONVERT) != level || @@ -1937,8 +1932,8 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, &done)) == ENOSPC) { if (w != XFS_DATA_FORK) goto done; - if (error = xfs_da_swap_lastblock(args, &dead_blkno, - &dead_buf)) + if ((error = xfs_da_swap_lastblock(args, &dead_blkno, + &dead_buf))) goto done; } else if (error) goto done; @@ -1951,7 +1946,7 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, * Adjust the directory size for version 1. */ if (w == XFS_DATA_FORK && XFS_DIR_IS_V1(mp)) { - if (error = xfs_bmap_last_offset(tp, dp, &bno, w)) + if ((error = xfs_bmap_last_offset(tp, dp, &bno, w))) return error; size = XFS_FSB_TO_B(dp->i_mount, bno); if (size != dp->i_d.di_size) { @@ -1982,11 +1977,9 @@ xfs_da_map_covers_blocks( for (i = 0, off = bno; i < nmap; i++) { if (mapp[i].br_startblock == HOLESTARTBLOCK || mapp[i].br_startblock == DELAYSTARTBLOCK) { -#pragma mips_frequency_hint NEVER return 0; } if (off != mapp[i].br_startoff) { -#pragma mips_frequency_hint NEVER return 0; } off += mapp[i].br_blockcount; @@ -2009,15 +2002,15 @@ xfs_da_do_buf( int caller, inst_t *ra) { - xfs_buf_t *bp = 0; - xfs_buf_t **bplist; - int error; + xfs_buf_t *bp = 0; + xfs_buf_t **bplist; + int error=0; int i; xfs_bmbt_irec_t map; xfs_bmbt_irec_t *mapp; xfs_daddr_t mappedbno; xfs_mount_t *mp; - int nbplist; + int nbplist=0; int nfsb; int nmap; xfs_dabuf_t *rbp; @@ -2039,15 +2032,13 @@ xfs_da_do_buf( if (nfsb == 1) { xfs_fsblock_t fsb; - if (error = + if ((error = xfs_bmapi_single(trans, dp, whichfork, &fsb, - (xfs_fileoff_t)bno)) { -#pragma mips_frequency_hint NEVER + (xfs_fileoff_t)bno))) { return error; } mapp = ↦ if (fsb == NULLFSBLOCK) { -#pragma mips_frequency_hint NEVER nmap = 0; } else { map.br_startblock = fsb; @@ -2056,17 +2047,16 @@ xfs_da_do_buf( nmap = 1; } } else { -#pragma mips_frequency_hint NEVER xfs_fsblock_t firstblock; firstblock = NULLFSBLOCK; mapp = kmem_alloc(sizeof(*mapp) * nfsb, KM_SLEEP); nmap = nfsb; - if (error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno, + if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno, nfsb, XFS_BMAPI_METADATA | XFS_BMAPI_AFLAG(whichfork), - &firstblock, 0, mapp, &nmap, NULL)) + &firstblock, 0, mapp, &nmap, NULL))) goto exit0; } } else { @@ -2077,12 +2067,10 @@ xfs_da_do_buf( nmap = 1; } if (!xfs_da_map_covers_blocks(nmap, mapp, bno, nfsb)) { -#pragma mips_frequency_hint NEVER error = mappedbno == -2 ? 0 : XFS_ERROR(EFSCORRUPTED); goto exit0; } if (caller != 3 && nmap > 1) { -#pragma mips_frequency_hint NEVER bplist = kmem_alloc(sizeof(*bplist) * nmap, KM_SLEEP); nbplist = 0; } else @@ -2120,7 +2108,6 @@ xfs_da_do_buf( #endif } if (error) { -#pragma mips_frequency_hint NEVER if (bp) xfs_trans_brelse(trans, bp); goto exit1; @@ -2137,7 +2124,6 @@ xfs_da_do_buf( } } if (bplist) { -#pragma mips_frequency_hint NEVER bplist[nbplist++] = bp; } } @@ -2145,7 +2131,6 @@ xfs_da_do_buf( * Build a dabuf structure. */ if (bplist) { -#pragma mips_frequency_hint NEVER rbp = xfs_da_buf_make(nbplist, bplist, ra); } else if (bp) rbp = xfs_da_buf_make(1, &bp, ra); @@ -2172,7 +2157,6 @@ xfs_da_do_buf( (INT_GET(free->hdr.magic, ARCH_CONVERT) != XFS_DIR2_FREE_MAGIC), mp, XFS_ERRTAG_DA_READ_BUF, XFS_RANDOM_DA_READ_BUF)) { -#pragma mips_frequency_hint NEVER xfs_buftrace("DA READ ERROR", rbp->bps[0]); error = XFS_ERROR(EFSCORRUPTED); xfs_da_brelse(trans, rbp); @@ -2181,11 +2165,9 @@ xfs_da_do_buf( } } if (bplist) { -#pragma mips_frequency_hint NEVER kmem_free(bplist, sizeof(*bplist) * nmap); } if (mapp != &map) { -#pragma mips_frequency_hint NEVER kmem_free(mapp, sizeof(*mapp) * nfsb); } if (bpp) diff --git a/libxfs/xfs_dir.c b/libxfs/xfs_dir.c index b13d24642..7d28b25d5 100644 --- a/libxfs/xfs_dir.c +++ b/libxfs/xfs_dir.c @@ -90,7 +90,7 @@ xfs_dir_init(xfs_trans_t *trans, xfs_inode_t *dir, xfs_inode_t *parent_dir) args.trans = trans; ASSERT((dir->i_d.di_mode & IFMT) == IFDIR); - if (error = xfs_dir_ino_validate(trans->t_mountp, parent_dir->i_ino)) + if ((error = xfs_dir_ino_validate(trans->t_mountp, parent_dir->i_ino))) return error; return(xfs_dir_shortform_create(&args, parent_dir->i_ino)); @@ -110,7 +110,7 @@ xfs_dir_createname(xfs_trans_t *trans, xfs_inode_t *dp, char *name, ASSERT((dp->i_d.di_mode & IFMT) == IFDIR); - if (retval = xfs_dir_ino_validate(trans->t_mountp, inum)) + if ((retval = xfs_dir_ino_validate(trans->t_mountp, inum))) return (retval); XFS_STATS_INC(xs_dir_create); @@ -268,7 +268,7 @@ xfs_dir_replace(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen, return(XFS_ERROR(EINVAL)); } - if (retval = xfs_dir_ino_validate(trans->t_mountp, inum)) + if ((retval = xfs_dir_ino_validate(trans->t_mountp, inum))) return retval; /* diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index 72acbb35d..0dfece9ef 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -75,8 +75,7 @@ xfs_dir2_init( args.dp = dp; args.trans = tp; ASSERT((dp->i_d.di_mode & IFMT) == IFDIR); - if (error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) { return error; } return xfs_dir2_sf_create(&args, pdp->i_ino); @@ -101,8 +100,7 @@ xfs_dir2_createname( int v; /* type-checking value */ ASSERT((dp->i_d.di_mode & IFMT) == IFDIR); - if (rval = xfs_dir_ino_validate(tp->t_mountp, inum)) { -#pragma mips_frequency_hint NEVER + if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) { return rval; } XFS_STATS_INC(xs_dir_create); @@ -126,13 +124,11 @@ xfs_dir2_createname( */ if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) rval = xfs_dir2_sf_addname(&args); - else if (rval = xfs_dir2_isblock(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isblock(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_block_addname(&args); - else if (rval = xfs_dir2_isleaf(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isleaf(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_leaf_addname(&args); @@ -158,7 +154,6 @@ xfs_dir2_lookup( ASSERT((dp->i_d.di_mode & IFMT) == IFDIR); if (namelen >= MAXNAMELEN) { -#pragma mips_frequency_hint NEVER return XFS_ERROR(EINVAL); } XFS_STATS_INC(xs_dir_lookup); @@ -182,13 +177,11 @@ xfs_dir2_lookup( */ if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) rval = xfs_dir2_sf_lookup(&args); - else if (rval = xfs_dir2_isblock(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isblock(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_block_lookup(&args); - else if (rval = xfs_dir2_isleaf(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isleaf(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_leaf_lookup(&args); @@ -240,13 +233,11 @@ xfs_dir2_removename( */ if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) rval = xfs_dir2_sf_removename(&args); - else if (rval = xfs_dir2_isblock(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isblock(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_block_removename(&args); - else if (rval = xfs_dir2_isleaf(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isleaf(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_leaf_removename(&args); @@ -275,11 +266,9 @@ xfs_dir2_replace( ASSERT((dp->i_d.di_mode & IFMT) == IFDIR); if (namelen >= MAXNAMELEN) { -#pragma mips_frequency_hint NEVER return XFS_ERROR(EINVAL); } - if (rval = xfs_dir_ino_validate(tp->t_mountp, inum)) { -#pragma mips_frequency_hint NEVER + if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) { return rval; } /* @@ -301,13 +290,11 @@ xfs_dir2_replace( */ if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) rval = xfs_dir2_sf_replace(&args); - else if (rval = xfs_dir2_isblock(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isblock(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_block_replace(&args); - else if (rval = xfs_dir2_isleaf(tp, dp, &v)) { -#pragma mips_frequency_hint NEVER + else if ((rval = xfs_dir2_isleaf(tp, dp, &v))) { return rval; } else if (v) rval = xfs_dir2_leaf_replace(&args); @@ -356,8 +343,7 @@ xfs_dir2_grow_inode( /* * Find the first hole for our block. */ - if (error = xfs_bmap_first_unused(tp, dp, count, &bno, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_bmap_first_unused(tp, dp, count, &bno, XFS_DATA_FORK))) { return error; } nmap = 1; @@ -365,11 +351,10 @@ xfs_dir2_grow_inode( /* * Try mapping the new block contiguously (one extent). */ - if (error = xfs_bmapi(tp, dp, bno, count, + if ((error = xfs_bmapi(tp, dp, bno, count, XFS_BMAPI_WRITE|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG, args->firstblock, args->total, &map, &nmap, - args->flist)) { -#pragma mips_frequency_hint NEVER + args->flist))) { return error; } ASSERT(nmap <= 1); @@ -385,7 +370,6 @@ xfs_dir2_grow_inode( * Try again with contiguous flag turned on. */ else if (nmap == 0 && count > 1) { -#pragma mips_frequency_hint NEVER xfs_fileoff_t b; /* current file offset */ /* @@ -403,10 +387,10 @@ xfs_dir2_grow_inode( */ nmap = MIN(XFS_BMAP_MAX_NMAP, count); c = (int)(bno + count - b); - if (error = xfs_bmapi(tp, dp, b, c, + if ((error = xfs_bmapi(tp, dp, b, c, XFS_BMAPI_WRITE|XFS_BMAPI_METADATA, args->firstblock, args->total, - &mapp[mapi], &nmap, args->flist)) { + &mapp[mapi], &nmap, args->flist))) { kmem_free(mapp, sizeof(*mapp) * count); return error; } @@ -424,7 +408,6 @@ xfs_dir2_grow_inode( * Didn't work. */ else { -#pragma mips_frequency_hint NEVER mapi = 0; mapp = NULL; } @@ -439,7 +422,6 @@ xfs_dir2_grow_inode( if (got != count || mapp[0].br_startoff != bno || mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount != bno + count) { -#pragma mips_frequency_hint NEVER if (mapp != &map) kmem_free(mapp, sizeof(*mapp) * count); return XFS_ERROR(ENOSPC); @@ -479,8 +461,7 @@ xfs_dir2_isblock( int rval; /* return value */ mp = dp->i_mount; - if (rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK))) { return rval; } rval = XFS_FSB_TO_B(mp, last) == mp->m_dirblksize; @@ -503,8 +484,7 @@ xfs_dir2_isleaf( int rval; /* return value */ mp = dp->i_mount; - if (rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK))) { return rval; } *vp = last == mp->m_dirleafblk + (1 << mp->m_sb.sb_dirblklog); @@ -538,10 +518,9 @@ xfs_dir2_shrink_inode( /* * Unmap the fsblock(s). */ - if (error = xfs_bunmapi(tp, dp, da, mp->m_dirblkfsbs, + if ((error = xfs_bunmapi(tp, dp, da, mp->m_dirblkfsbs, XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, - &done)) { -#pragma mips_frequency_hint NEVER + &done))) { /* * ENOSPC actually can happen if we're in a removename with * no space reservation, and the resulting block removal @@ -574,8 +553,7 @@ xfs_dir2_shrink_inode( if (dp->i_d.di_size > XFS_DIR2_DB_OFF_TO_BYTE(mp, db + 1, 0)) return 0; bno = da; - if (error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK))) { /* * This can't really happen unless there's kernel corruption. */ diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index 9cf677314..6508475da 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -55,16 +55,16 @@ xfs_dir2_block_addname( xfs_inode_t *dp; /* directory inode */ xfs_dir2_data_unused_t *dup; /* block unused entry */ int error; /* error return value */ - xfs_dir2_data_unused_t *enddup; /* unused at end of data */ + xfs_dir2_data_unused_t *enddup=NULL; /* unused at end of data */ xfs_dahash_t hash; /* hash value of found entry */ int high; /* high index for binary srch */ int highstale; /* high stale index */ - int lfloghigh; /* last final leaf to log */ - int lfloglow; /* first final leaf to log */ + int lfloghigh=0; /* last final leaf to log */ + int lfloglow=0; /* first final leaf to log */ int len; /* length of the new entry */ int low; /* low index for binary srch */ int lowstale; /* low stale index */ - int mid; /* midpoint for binary srch */ + int mid=0; /* midpoint for binary srch */ xfs_mount_t *mp; /* filesystem mount point */ int needlog; /* need to log header */ int needscan; /* need to rescan freespace */ @@ -78,9 +78,8 @@ xfs_dir2_block_addname( /* * Read the (one and only) directory block into dabuf bp. */ - if (error = - xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = + xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK))) { return error; } ASSERT(bp != NULL); @@ -89,7 +88,6 @@ xfs_dir2_block_addname( * Check the magic number, corrupted if wrong. */ if (INT_GET(block->hdr.magic, ARCH_CONVERT) != XFS_DIR2_BLOCK_MAGIC) { -#pragma mips_frequency_hint NEVER xfs_da_brelse(tp, bp); return XFS_ERROR(EFSCORRUPTED); } @@ -131,7 +129,6 @@ xfs_dir2_block_addname( * to hold the new leaf too? */ if (INT_GET(dup->length, ARCH_CONVERT) < len + (uint)sizeof(*blp)) { -#pragma mips_frequency_hint NEVER /* * Yes, we use the second-largest * entry instead if it works. @@ -149,7 +146,6 @@ xfs_dir2_block_addname( * just check its length. */ if (INT_GET(dup->length, ARCH_CONVERT) < len) { -#pragma mips_frequency_hint NEVER dup = NULL; } } @@ -169,7 +165,6 @@ xfs_dir2_block_addname( * Will need to compact to make this work. */ else { -#pragma mips_frequency_hint NEVER /* * Tag just before the first leaf entry. */ @@ -201,7 +196,6 @@ xfs_dir2_block_addname( * If we don't have space for the new entry & leaf ... */ if (!dup) { -#pragma mips_frequency_hint NEVER /* * Not trying to actually do anything, or don't have * a space reservation: return no-space. @@ -230,7 +224,6 @@ xfs_dir2_block_addname( * XXX should be the one closest to mid but mid is not yet computed. */ if (compact) { -#pragma mips_frequency_hint NEVER int fromidx; /* source leaf index */ int toidx; /* target leaf index */ @@ -291,7 +284,6 @@ xfs_dir2_block_addname( high = mid - 1; } while (mid >= 0 && INT_GET(blp[mid].hashval, ARCH_CONVERT) >= args->hashval) { -#pragma mips_frequency_hint NEVER mid--; } /* @@ -477,7 +469,7 @@ xfs_dir2_block_lookup( * Get the buffer, look up the entry. * If not found (ENOENT) then return, have no buffer. */ - if (error = xfs_dir2_block_lookup_int(args, &bp, &ent)) + if ((error = xfs_dir2_block_lookup_int(args, &bp, &ent))) return error; dp = args->dp; mp = dp->i_mount; @@ -528,9 +520,8 @@ xfs_dir2_block_lookup_int( /* * Read the buffer, return error if we can't get it. */ - if (error = - xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = + xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK))) { return error; } ASSERT(bp != NULL); @@ -561,7 +552,6 @@ xfs_dir2_block_lookup_int( * Back up to the first one with the right hash value. */ while (mid > 0 && INT_GET(blp[mid - 1].hashval, ARCH_CONVERT) == args->hashval) { -#pragma mips_frequency_hint NEVER mid--; } /* @@ -623,8 +613,7 @@ xfs_dir2_block_removename( * Look up the entry in the block. Gets the buffer and entry index. * It will always be there, the vnodeops level does a lookup first. */ - if (error = xfs_dir2_block_lookup_int(args, &bp, &ent)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_block_lookup_int(args, &bp, &ent))) { return error; } dp = args->dp; @@ -701,8 +690,7 @@ xfs_dir2_block_replace( * Lookup the entry in the directory. Get buffer and entry index. * This will always succeed since the caller has already done a lookup. */ - if (error = xfs_dir2_block_lookup_int(args, &bp, &ent)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_block_lookup_int(args, &bp, &ent))) { return error; } dp = args->dp; @@ -788,10 +776,9 @@ xfs_dir2_leaf_to_block( bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); if (INT_GET(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1], ARCH_CONVERT) == mp->m_dirblksize - (uint)sizeof(block->hdr)) { -#pragma mips_frequency_hint NEVER - if (error = + if ((error = xfs_dir2_leaf_trim_data(args, lbp, - (xfs_dir2_db_t)(INT_GET(ltp->bestcount, ARCH_CONVERT) - 1))) + (xfs_dir2_db_t)(INT_GET(ltp->bestcount, ARCH_CONVERT) - 1)))) goto out; } else { error = 0; @@ -804,7 +791,6 @@ xfs_dir2_leaf_to_block( if (dbp == NULL && (error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &dbp, XFS_DATA_FORK))) { -#pragma mips_frequency_hint NEVER goto out; } block = dbp->data; @@ -869,7 +855,6 @@ xfs_dir2_leaf_to_block( error = xfs_da_shrink_inode(args, mp->m_dirleafblk, lbp); lbp = NULL; if (error) { -#pragma mips_frequency_hint NEVER goto out; } /* @@ -928,7 +913,6 @@ xfs_dir2_sf_to_block( * Bomb out if the shortform directory is way too short. */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(mp)); return XFS_ERROR(EIO); } @@ -953,7 +937,6 @@ xfs_dir2_sf_to_block( */ error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, &blkno); if (error) { -#pragma mips_frequency_hint NEVER return error; } /* @@ -961,7 +944,6 @@ xfs_dir2_sf_to_block( */ error = xfs_dir2_data_init(args, blkno, &bp); if (error) { -#pragma mips_frequency_hint NEVER return error; } block = bp->data; diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index d921a21cc..9ef50b90a 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -50,7 +50,7 @@ xfs_dir2_data_check( { xfs_dir2_dataptr_t addr; /* addr for leaf lookup */ xfs_dir2_data_free_t *bf; /* bestfree table */ - xfs_dir2_block_tail_t *btp; /* block tail */ + xfs_dir2_block_tail_t *btp=NULL; /* block tail */ int count; /* count of entries found */ xfs_dir2_data_t *d; /* data block pointer */ xfs_dir2_data_entry_t *dep; /* data entry */ @@ -61,7 +61,7 @@ xfs_dir2_data_check( xfs_dahash_t hash; /* hash of current name */ int i; /* leaf index */ int lastfree; /* last entry was unused */ - xfs_dir2_leaf_entry_t *lep; /* block leaf entries */ + xfs_dir2_leaf_entry_t *lep=NULL; /* block leaf entries */ xfs_mount_t *mp; /* filesystem mount point */ char *p; /* current data position */ int stale; /* count of stale leaves */ @@ -406,7 +406,6 @@ xfs_dir2_data_init( error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, blkno), -1, &bp, XFS_DATA_FORK); if (error) { -#pragma mips_frequency_hint NEVER return error; } ASSERT(bp != NULL); diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index 89761db5e..19a68b208 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -74,8 +74,7 @@ xfs_dir2_block_to_leaf( * This interface will only put blocks in the leaf/node range. * Since that's empty now, we'll get the root (block 0 in range). */ - if (error = xfs_da_grow_inode(args, &blkno)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_grow_inode(args, &blkno))) { return error; } ldb = XFS_DIR2_DA_TO_DB(mp, blkno); @@ -83,8 +82,7 @@ xfs_dir2_block_to_leaf( /* * Initialize the leaf block, get a buffer for it. */ - if (error = xfs_dir2_leaf_init(args, ldb, &lbp, XFS_DIR2_LEAF1_MAGIC)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_leaf_init(args, ldb, &lbp, XFS_DIR2_LEAF1_MAGIC))) { return error; } ASSERT(lbp != NULL); @@ -186,7 +184,6 @@ xfs_dir2_leaf_addname( error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp, XFS_DATA_FORK); if (error) { -#pragma mips_frequency_hint NEVER return error; } ASSERT(lbp != NULL); @@ -254,7 +251,6 @@ xfs_dir2_leaf_addname( */ if ((char *)bestsp - (char *)&leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT)] < needbytes && INT_GET(leaf->hdr.stale, ARCH_CONVERT) > 1) { -#pragma mips_frequency_hint NEVER compact = 1; } /* @@ -263,7 +259,6 @@ xfs_dir2_leaf_addname( */ else if ((char *)bestsp - (char *)&leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT)] < needbytes) { -#pragma mips_frequency_hint NEVER /* * Just checking or no space reservation, give up. */ @@ -301,7 +296,6 @@ xfs_dir2_leaf_addname( * changed anything. */ if (args->total == 0 && use_block == -1) { -#pragma mips_frequency_hint NEVER xfs_da_brelse(tp, lbp); return XFS_ERROR(ENOSPC); } @@ -312,7 +306,6 @@ xfs_dir2_leaf_addname( * point later. */ if (compact) { -#pragma mips_frequency_hint NEVER xfs_dir2_leaf_compact_x1(lbp, &index, &lowstale, &highstale, &lfloglow, &lfloghigh); } @@ -329,19 +322,18 @@ xfs_dir2_leaf_addname( * a new one. */ if (use_block == -1) { -#pragma mips_frequency_hint NEVER /* * Add the new data block. */ - if (error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, - &use_block)) { + if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, + &use_block))) { xfs_da_brelse(tp, lbp); return error; } /* * Initialize the block. */ - if (error = xfs_dir2_data_init(args, use_block, &dbp)) { + if ((error = xfs_dir2_data_init(args, use_block, &dbp))) { xfs_da_brelse(tp, lbp); return error; } @@ -371,10 +363,9 @@ xfs_dir2_leaf_addname( * Just read that one in. */ else { - if (error = + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, use_block), - -1, &dbp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + -1, &dbp, XFS_DATA_FORK))) { xfs_da_brelse(tp, lbp); return error; } @@ -599,7 +590,6 @@ xfs_dir2_leaf_compact( leaf = bp->data; if (INT_GET(leaf->hdr.stale, ARCH_CONVERT) == 0) { -#pragma mips_frequency_hint NEVER return; } /* @@ -652,7 +642,7 @@ xfs_dir2_leaf_compact_x1( int keepstale; /* source index of kept stale */ xfs_dir2_leaf_t *leaf; /* leaf structure */ int lowstale; /* stale entry before index */ - int newindex; /* new insertion index */ + int newindex=0; /* new insertion index */ int to; /* destination copy index */ leaf = bp->data; @@ -769,7 +759,6 @@ xfs_dir2_leaf_init( error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, bno), -1, &bp, XFS_DATA_FORK); if (error) { -#pragma mips_frequency_hint NEVER return error; } ASSERT(bp != NULL); @@ -904,8 +893,7 @@ xfs_dir2_leaf_lookup( /* * Look up name in the leaf block, returning both buffers and index. */ - if (error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp))) { return error; } tp = args->trans; @@ -963,10 +951,9 @@ xfs_dir2_leaf_lookup_int( /* * Read the leaf block into the buffer. */ - if (error = + if ((error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + XFS_DATA_FORK))) { return error; } *lbpp = lbp; @@ -999,11 +986,10 @@ xfs_dir2_leaf_lookup_int( if (newdb != curdb) { if (dbp) xfs_da_brelse(tp, dbp); - if (error = + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, newdb), -1, &dbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + XFS_DATA_FORK))) { xfs_da_brelse(tp, lbp); return error; } @@ -1067,8 +1053,7 @@ xfs_dir2_leaf_removename( /* * Lookup the leaf entry, get the leaf and data blocks read in. */ - if (error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp))) { return error; } dp = args->dp; @@ -1124,9 +1109,8 @@ xfs_dir2_leaf_removename( */ if (INT_GET(data->hdr.bestfree[0].length, ARCH_CONVERT) == mp->m_dirblksize - (uint)sizeof(data->hdr)) { -#pragma mips_frequency_hint NEVER ASSERT(db != mp->m_dirdatablk); - if (error = xfs_dir2_shrink_inode(args, db, dbp)) { + if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { /* * Nope, can't get rid of it because it caused * allocation of a bmap btree block to do so. @@ -1201,8 +1185,7 @@ xfs_dir2_leaf_replace( /* * Look up the entry. */ - if (error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp))) { return error; } dp = args->dp; @@ -1240,13 +1223,13 @@ xfs_dir2_leaf_search_hash( xfs_da_args_t *args, /* operation arguments */ xfs_dabuf_t *lbp) /* leaf buffer */ { - xfs_dahash_t hash; /* hash from this entry */ + xfs_dahash_t hash=0; /* hash from this entry */ xfs_dahash_t hashwant; /* hash value looking for */ int high; /* high leaf index */ int low; /* low leaf index */ xfs_dir2_leaf_t *leaf; /* leaf structure */ xfs_dir2_leaf_entry_t *lep; /* leaf entry */ - int mid; /* current leaf index */ + int mid=0; /* current leaf index */ leaf = lbp->data; #ifndef __KERNEL__ @@ -1273,7 +1256,6 @@ xfs_dir2_leaf_search_hash( */ if (hash == hashwant) { while (mid > 0 && INT_GET(lep[mid - 1].hashval, ARCH_CONVERT) == hashwant) { -#pragma mips_frequency_hint NEVER mid--; } } @@ -1313,9 +1295,8 @@ xfs_dir2_leaf_trim_data( /* * Read the offending data block. We need its buffer. */ - if (error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, db), -1, &dbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, db), -1, &dbp, + XFS_DATA_FORK))) { return error; } #ifdef DEBUG @@ -1335,8 +1316,7 @@ xfs_dir2_leaf_trim_data( /* * Get rid of the data block. */ - if (error = xfs_dir2_shrink_inode(args, db, dbp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { ASSERT(error != ENOSPC); xfs_da_brelse(tp, dbp); return error; @@ -1388,8 +1368,7 @@ xfs_dir2_node_to_leaf( /* * Get the last offset in the file. */ - if (error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) { return error; } fo -= mp->m_dirblkfsbs; @@ -1400,8 +1379,7 @@ xfs_dir2_node_to_leaf( * operations. */ while (fo > mp->m_dirfreeblk) { - if (error = xfs_dir2_node_trim_free(args, fo, &rval)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_node_trim_free(args, fo, &rval))) { return error; } if (rval) @@ -1412,8 +1390,7 @@ xfs_dir2_node_to_leaf( /* * Now find the block just before the freespace block. */ - if (error = xfs_bmap_last_before(tp, dp, &fo, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_bmap_last_before(tp, dp, &fo, XFS_DATA_FORK))) { return error; } /* @@ -1427,9 +1404,8 @@ xfs_dir2_node_to_leaf( /* * Read the freespace block. */ - if (error = xfs_da_read_buf(tp, dp, mp->m_dirfreeblk, -1, &fbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_read_buf(tp, dp, mp->m_dirfreeblk, -1, &fbp, + XFS_DATA_FORK))) { return error; } free = fbp->data; @@ -1474,7 +1450,6 @@ xfs_dir2_node_to_leaf( */ error = xfs_dir2_shrink_inode(args, XFS_DIR2_FREE_FIRSTDB(mp), fbp); if (error) { -#pragma mips_frequency_hint NEVER /* * This can't fail here because it can only happen when * punching out the middle of an extent, and this is an diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index b6050ba6a..6754cb8d1 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -106,17 +106,15 @@ xfs_dir2_leaf_to_node( /* * Add a freespace block to the directory. */ - if (error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, &fdb)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, &fdb))) { return error; } ASSERT(fdb == XFS_DIR2_FREE_FIRSTDB(mp)); /* * Get the buffer for the new freespace block. */ - if (error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fdb), -1, &fbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fdb), -1, &fbp, + XFS_DATA_FORK))) { return error; } ASSERT(fbp != NULL); @@ -186,7 +184,6 @@ xfs_dir2_leafn_add( * a compact. */ if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == XFS_DIR2_MAX_LEAF_ENTS(mp)) { -#pragma mips_frequency_hint NEVER if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) return XFS_ERROR(ENOSPC); compact = INT_GET(leaf->hdr.stale, ARCH_CONVERT) > 1; @@ -204,7 +201,6 @@ xfs_dir2_leafn_add( * the entry closest to index. */ if (compact) { -#pragma mips_frequency_hint NEVER xfs_dir2_leaf_compact_x1(bp, &index, &lowstale, &highstale, &lfloglow, &lfloghigh); } @@ -375,10 +371,10 @@ xfs_dir2_leafn_lookup_int( xfs_inode_t *dp; /* incore directory inode */ int error; /* error return value */ int fi; /* free entry index */ - xfs_dir2_free_t *free; /* free block structure */ + xfs_dir2_free_t *free=NULL; /* free block structure */ int index; /* leaf entry index */ xfs_dir2_leaf_t *leaf; /* leaf structure */ - int length; /* length of new data entry */ + int length=0; /* length of new data entry */ xfs_dir2_leaf_entry_t *lep; /* leaf entry */ xfs_mount_t *mp; /* filesystem mount point */ xfs_dir2_db_t newdb; /* new data block number */ @@ -412,7 +408,7 @@ xfs_dir2_leafn_lookup_int( curfdb = curbp ? state->extrablk.blkno : -1; curdb = -1; length = XFS_DIR2_DATA_ENTSIZE(args->namelen); - if (free = (curbp ? curbp->data : NULL)) + if ((free = (curbp ? curbp->data : NULL))) ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC); } /* @@ -467,12 +463,11 @@ xfs_dir2_leafn_lookup_int( /* * Read the free block. */ - if (error = xfs_da_read_buf(tp, dp, + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, newfdb), -1, &curbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + XFS_DATA_FORK))) { return error; } curfdb = newfdb; @@ -495,7 +490,6 @@ xfs_dir2_leafn_lookup_int( * If it has room, return it. */ if (INT_GET(free->bests[fi], ARCH_CONVERT) == NULLDATAOFF) { -#pragma mips_frequency_hint NEVER return XFS_ERROR(EFSCORRUPTED); } if (INT_GET(free->bests[fi], ARCH_CONVERT) >= length) { @@ -528,11 +522,10 @@ xfs_dir2_leafn_lookup_int( /* * Read the data block. */ - if (error = + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, newdb), -1, - &curbp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + &curbp, XFS_DATA_FORK))) { return error; } xfs_dir2_data_check(dp, curbp); @@ -568,7 +561,7 @@ xfs_dir2_leafn_lookup_int( * If we are holding a buffer, give it back in case our caller * finds it useful. */ - if (state->extravalid = (curbp != NULL)) { + if ((state->extravalid = (curbp != NULL))) { state->extrablk.bp = curbp; state->extrablk.index = -1; /* @@ -618,7 +611,6 @@ xfs_dir2_leafn_moveents( * Silently return if nothing to do. */ if (count == 0) { -#pragma mips_frequency_hint NEVER return; } tp = args->trans; @@ -731,8 +723,7 @@ xfs_dir2_leafn_rebalance( /* * If the block order is wrong, swap the arguments. */ - if (swap = xfs_dir2_leafn_order(blk1->bp, blk2->bp)) { -#pragma mips_frequency_hint NEVER + if ((swap = xfs_dir2_leafn_order(blk1->bp, blk2->bp))) { xfs_da_state_blk_t *tmp; /* temp for block swap */ tmp = blk1; @@ -885,9 +876,8 @@ xfs_dir2_leafn_remove( * read in the free block. */ fdb = XFS_DIR2_DB_TO_FDB(mp, db); - if (error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fdb), - -1, &fbp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fdb), + -1, &fbp, XFS_DATA_FORK))) { return error; } free = fbp->data; @@ -905,7 +895,6 @@ xfs_dir2_leafn_remove( * (usually). */ if (longest == mp->m_dirblksize - (uint)sizeof(data->hdr)) { -#pragma mips_frequency_hint NEVER /* * Try to punch out the data block. */ @@ -929,7 +918,6 @@ xfs_dir2_leafn_remove( * in the free block. */ if (data == NULL) { -#pragma mips_frequency_hint NEVER /* * One less used entry in the free table. */ @@ -1031,7 +1019,6 @@ xfs_dir2_leafn_split( ASSERT(oldblk->magic == XFS_DIR2_LEAFN_MAGIC); error = xfs_da_grow_inode(args, &blkno); if (error) { -#pragma mips_frequency_hint NEVER return error; } /* @@ -1040,7 +1027,6 @@ xfs_dir2_leafn_split( error = xfs_dir2_leaf_init(args, XFS_DIR2_DA_TO_DB(mp, blkno), &newblk->bp, XFS_DIR2_LEAFN_MAGIC); if (error) { -#pragma mips_frequency_hint NEVER return error; } newblk->blkno = blkno; @@ -1052,7 +1038,6 @@ xfs_dir2_leafn_split( xfs_dir2_leafn_rebalance(state, oldblk, newblk); error = xfs_da_blk_link(state, oldblk, newblk); if (error) { -#pragma mips_frequency_hint NEVER return error; } /* @@ -1123,7 +1108,6 @@ xfs_dir2_leafn_toosmall( * to merge with the forward block unless it is NULL. */ if (count == 0) { -#pragma mips_frequency_hint NEVER /* * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). @@ -1152,10 +1136,9 @@ xfs_dir2_leafn_toosmall( /* * Read the sibling leaf block. */ - if (error = + if ((error = xfs_da_read_buf(state->args->trans, state->args->dp, blkno, - -1, &bp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + -1, &bp, XFS_DATA_FORK))) { return error; } ASSERT(bp != NULL); @@ -1200,7 +1183,6 @@ xfs_dir2_leafn_toosmall( error = xfs_da_path_shift(state, &state->path, forward, 0, &rval); if (error) { -#pragma mips_frequency_hint NEVER return error; } *action = rval ? 0 : 1; @@ -1278,7 +1260,6 @@ xfs_dir2_node_addname( if (error) rval = error; if (rval != ENOENT) { -#pragma mips_frequency_hint NEVER goto done; } /* @@ -1288,7 +1269,6 @@ xfs_dir2_node_addname( rval = xfs_dir2_node_addname_int(args, state->extravalid ? &state->extrablk : NULL); if (rval) { -#pragma mips_frequency_hint NEVER goto done; } blk = &state->path.blk[state->path.active - 1]; @@ -1304,7 +1284,6 @@ xfs_dir2_node_addname( if (!args->justcheck) xfs_da_fixhashpath(state, &state->path); } else { -#pragma mips_frequency_hint NEVER /* * It didn't work, we need to split the leaf block. */ @@ -1343,9 +1322,9 @@ xfs_dir2_node_addname_int( xfs_dir2_db_t fbno; /* freespace block number */ xfs_dabuf_t *fbp; /* freespace buffer */ int findex; /* freespace entry index */ - xfs_dir2_db_t foundbno; /* found freespace block no */ + xfs_dir2_db_t foundbno=0; /* found freespace block no */ int foundindex; /* found freespace entry idx */ - xfs_dir2_free_t *free; /* freespace block structure */ + xfs_dir2_free_t *free=NULL; /* freespace block structure */ xfs_dir2_db_t ifbno; /* initial freespace block no */ xfs_dir2_db_t lastfbno; /* highest freespace block no */ int length; /* length of the new entry */ @@ -1410,7 +1389,7 @@ xfs_dir2_node_addname_int( if (dbno == -1) { xfs_fileoff_t fo; /* freespace block number */ - if (error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK)) + if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) return error; lastfbno = XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)fo); fbno = ifbno; @@ -1448,14 +1427,12 @@ xfs_dir2_node_addname_int( * This should be really rare, so there's no reason * to avoid it. */ - if (error = xfs_da_read_buf(tp, dp, + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fbno), -1, &fbp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + XFS_DATA_FORK))) { return error; } if (fbp == NULL) { -#pragma mips_frequency_hint NEVER continue; } free = fbp->data; @@ -1507,7 +1484,6 @@ xfs_dir2_node_addname_int( * freeblock, we need to add a new freeblock. */ if (dbno == -1 && foundindex == -1) { -#pragma mips_frequency_hint NEVER /* * Not allowed to allocate, so return failure. */ @@ -1517,15 +1493,15 @@ xfs_dir2_node_addname_int( /* * Add the new freeblock. */ - if (error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, - &fbno)) { + if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, + &fbno))) { return error; } /* * Get a buffer for the new block. */ - if (error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fbno), - -1, &fbp, XFS_DATA_FORK)) { + if ((error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fbno), + -1, &fbp, XFS_DATA_FORK))) { return error; } ASSERT(fbp != NULL); @@ -1548,14 +1524,13 @@ xfs_dir2_node_addname_int( * go read the freeblock again. */ if (dbno == -1 && fbp == NULL) { -#pragma mips_frequency_hint NEVER /* * We're going to use the empty slot we found before. */ findex = foundindex; fbno = foundbno; - if (error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fbno), - -1, &fbp, XFS_DATA_FORK)) { + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fbno), + -1, &fbp, XFS_DATA_FORK))) { return error; } ASSERT(fbp != NULL); @@ -1567,7 +1542,6 @@ xfs_dir2_node_addname_int( * the freespace entries refer to it. */ if (dbno == -1) { -#pragma mips_frequency_hint NEVER /* * Not allowed to allocate, return failure. */ @@ -1604,9 +1578,9 @@ xfs_dir2_node_addname_int( if (fblk && fblk->bp) fblk->bp = NULL; fbno = XFS_DIR2_DB_TO_FDB(mp, dbno); - if (error = xfs_da_read_buf(tp, dp, + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fbno), -1, &fbp, - XFS_DATA_FORK)) { + XFS_DATA_FORK))) { xfs_da_buf_done(dbp); return error; } @@ -1662,9 +1636,8 @@ xfs_dir2_node_addname_int( /* * Read the data block in. */ - if (error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, dbno), - -1, &dbp, XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, dbno), + -1, &dbp, XFS_DATA_FORK))) { if (fblk == NULL || fblk->bp == NULL) xfs_da_buf_done(fbp); return error; @@ -1802,14 +1775,12 @@ xfs_dir2_node_removename( */ error = xfs_da_node_lookup_int(state, &rval); if (error) { -#pragma mips_frequency_hint NEVER rval = error; } /* * Didn't find it, upper layer screwed up. */ if (rval != EEXIST) { -#pragma mips_frequency_hint NEVER xfs_da_state_free(state); return rval; } @@ -1823,7 +1794,6 @@ xfs_dir2_node_removename( error = xfs_dir2_leafn_remove(args, blk->bp, blk->index, &state->extrablk, &rval); if (error) { -#pragma mips_frequency_hint NEVER return error; } /* @@ -1876,7 +1846,6 @@ xfs_dir2_node_replace( */ error = xfs_da_node_lookup_int(state, &rval); if (error) { -#pragma mips_frequency_hint NEVER rval = error; } /* @@ -1912,7 +1881,6 @@ xfs_dir2_node_replace( * Didn't find it, and we're holding a data block. Drop it. */ else if (state->extravalid) { -#pragma mips_frequency_hint NEVER xfs_da_brelse(args->trans, state->extrablk.bp); state->extrablk.bp = NULL; } @@ -1950,9 +1918,8 @@ xfs_dir2_node_trim_free( /* * Read the freespace block. */ - if (error = xfs_da_read_buf(tp, dp, (xfs_dablk_t)fo, -1, &bp, - XFS_DATA_FORK)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_da_read_buf(tp, dp, (xfs_dablk_t)fo, -1, &bp, + XFS_DATA_FORK))) { return error; } free = bp->data; @@ -1968,9 +1935,9 @@ xfs_dir2_node_trim_free( /* * Blow the block away. */ - if (error = + if ((error = xfs_dir2_shrink_inode(args, XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)fo), - bp)) { + bp))) { /* * Can't fail with ENOSPC since that only happens with no * space reservation, when breaking up an extent into two diff --git a/libxfs/xfs_dir2_sf.c b/libxfs/xfs_dir2_sf.c index a021822b2..a2944698e 100644 --- a/libxfs/xfs_dir2_sf.c +++ b/libxfs/xfs_dir2_sf.c @@ -62,7 +62,7 @@ xfs_dir2_block_sfsize( xfs_mount_t *mp; /* mount structure pointer */ int namelen; /* total name bytes */ xfs_ino_t parent; /* parent inode number */ - int size; /* total computed size */ + int size=0; /* total computed size */ mp = dp->i_mount; @@ -157,8 +157,7 @@ xfs_dir2_block_to_sf( block = kmem_alloc(mp->m_dirblksize, KM_SLEEP); bcopy(bp->data, block, mp->m_dirblksize); logflags = XFS_ILOG_CORE; - if (error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp)) { -#pragma mips_frequency_hint NEVER + if ((error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp))) { ASSERT(error != ENOSPC); goto out; } @@ -267,7 +266,6 @@ xfs_dir2_sf_addname( * Make sure the shortform value has some of its header. */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -285,7 +283,6 @@ xfs_dir2_sf_addname( * Do we have to change to 8 byte inodes? */ if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->hdr.i8count == 0) { -#pragma mips_frequency_hint NEVER /* * Yes, adjust the entry size and the total size. */ @@ -311,7 +308,6 @@ xfs_dir2_sf_addname( if (new_isize > XFS_IFORK_DSIZE(dp) || (pick = xfs_dir2_sf_addname_pick(args, objchange, &sfep, &offset)) == 0) { -#pragma mips_frequency_hint NEVER /* * Just checking or no space reservation, it doesn't fit. */ @@ -561,7 +557,6 @@ xfs_dir2_sf_addname_pick( */ #if XFS_BIG_FILESYSTEMS if (objchange) { -#pragma mips_frequency_hint NEVER return 2; } #else @@ -699,7 +694,6 @@ xfs_dir2_sf_lookup( * Bail out if the directory is way too short. */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -769,7 +763,6 @@ xfs_dir2_sf_removename( * Bail out if the directory is way too short. */ if (oldsize < offsetof(xfs_dir2_sf_hdr_t, parent)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -797,7 +790,6 @@ xfs_dir2_sf_removename( * Didn't find it. */ if (i == sfp->hdr.count) { -#pragma mips_frequency_hint NEVER return XFS_ERROR(ENOENT); } /* @@ -827,7 +819,6 @@ xfs_dir2_sf_removename( * Are we changing inode number size? */ if (args->inumber > XFS_DIR2_MAX_SHORT_INUM) { -#pragma mips_frequency_hint NEVER if (sfp->hdr.i8count == 1) xfs_dir2_sf_toino4(args); else @@ -849,7 +840,7 @@ xfs_dir2_sf_replace( xfs_inode_t *dp; /* incore directory inode */ int i; /* entry index */ #if XFS_BIG_FILESYSTEMS || defined(DEBUG) - xfs_ino_t ino; /* entry old inode number */ + xfs_ino_t ino=0; /* entry old inode number */ #endif xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */ xfs_dir2_sf_t *sfp; /* shortform structure */ @@ -862,7 +853,6 @@ xfs_dir2_sf_replace( * Bail out if the shortform directory is way too small. */ if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -875,7 +865,6 @@ xfs_dir2_sf_replace( * New inode number is large, and need to convert to 8-byte inodes. */ if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->hdr.i8count == 0) { -#pragma mips_frequency_hint NEVER int error; /* error return value */ int newsize; /* new inode size */ @@ -937,7 +926,6 @@ xfs_dir2_sf_replace( * Didn't find it. */ if (i == sfp->hdr.count) { -#pragma mips_frequency_hint NEVER ASSERT(args->oknoent); return XFS_ERROR(ENOENT); } @@ -948,7 +936,6 @@ xfs_dir2_sf_replace( */ if (ino > XFS_DIR2_MAX_SHORT_INUM && args->inumber <= XFS_DIR2_MAX_SHORT_INUM) { -#pragma mips_frequency_hint NEVER /* * And the old count was one, so need to convert to small. */ diff --git a/libxfs/xfs_dir_leaf.c b/libxfs/xfs_dir_leaf.c index 40c12148e..fd5c9d671 100644 --- a/libxfs/xfs_dir_leaf.c +++ b/libxfs/xfs_dir_leaf.c @@ -118,7 +118,6 @@ xfs_dir_shortform_addname(xfs_da_args_t *args) * failed part way through. */ if (dp->i_d.di_size < sizeof(xfs_dir_sf_hdr_t)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -169,7 +168,6 @@ xfs_dir_shortform_removename(xfs_da_args_t *args) * failed part way through. */ if (dp->i_d.di_size < sizeof(xfs_dir_sf_hdr_t)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -223,7 +221,6 @@ xfs_dir_shortform_lookup(xfs_da_args_t *args) * failed part way through. */ if (dp->i_d.di_size < sizeof(xfs_dir_sf_hdr_t)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -275,7 +272,6 @@ xfs_dir_shortform_to_leaf(xfs_da_args_t *iargs) * failed part way through. */ if (dp->i_d.di_size < sizeof(xfs_dir_sf_hdr_t)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -364,7 +360,6 @@ xfs_dir_shortform_replace(xfs_da_args_t *args) * failed part way through. */ if (dp->i_d.di_size < sizeof(xfs_dir_sf_hdr_t)) { -#pragma mips_frequency_hint NEVER ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); return XFS_ERROR(EIO); } @@ -793,7 +788,7 @@ xfs_dir_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp, int musthave, xfs_dir_leaf_hdr_t *hdr_s, *hdr_d; xfs_mount_t *mp; char *tmpbuffer; - char *tmpbuffer2; + char *tmpbuffer2=NULL; int rval; int lbsize; @@ -809,7 +804,7 @@ xfs_dir_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp, int musthave, */ if (musthave || justcheck) { tmpbuffer2 = kmem_alloc(lbsize, KM_SLEEP); - bcopy(bp->data, tmpbuffer2, lbsize); + bcopy(bp->data, tmpbuffer2, lbsize); } bzero(bp->data, lbsize); diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 92e2818cb..59dffcdcb 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -117,7 +117,7 @@ xfs_ialloc_ag_alloc( xfs_alloc_arg_t args; /* allocation argument structure */ int blks_per_cluster; /* fs blocks per inode cluster */ xfs_btree_cur_t *cur; /* inode btree cursor */ - xfs_daddr_t d; /* disk addr of buffer */ + xfs_daddr_t d; /* disk addr of buffer */ int error; xfs_buf_t *fbuf; /* new free inodes' buffer */ xfs_dinode_t *free; /* new free inode structure */ @@ -186,7 +186,7 @@ xfs_ialloc_ag_alloc( * Allow space for the inode btree to split. */ args.minleft = XFS_IN_MAXLEVELS(args.mp) - 1; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; /* @@ -204,7 +204,7 @@ xfs_ialloc_ag_alloc( args.alignment = args.mp->m_sb.sb_inoalignmt; else args.alignment = 1; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; } @@ -312,13 +312,13 @@ xfs_ialloc_ag_alloc( for (thisino = newino; thisino < newino + newlen; thisino += XFS_INODES_PER_CHUNK) { - if (error = xfs_inobt_lookup_eq(cur, thisino, - XFS_INODES_PER_CHUNK, XFS_INOBT_ALL_FREE, &i)) { + if ((error = xfs_inobt_lookup_eq(cur, thisino, + XFS_INODES_PER_CHUNK, XFS_INOBT_ALL_FREE, &i))) { xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); return error; } ASSERT(i == 0); - if (error = xfs_inobt_insert(cur, &i)) { + if ((error = xfs_inobt_insert(cur, &i))) { xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); return error; } @@ -568,7 +568,7 @@ xfs_dialloc( * Try to allocate some new inodes in the allocation * group. */ - if (error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced)) { + if ((error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced))) { xfs_trans_brelse(tp, agbp); if (error == ENOSPC) { *inop = NULLFSINO; @@ -631,16 +631,16 @@ nextag: if (cur->bc_nlevels == 1) { int freecount = 0; - if (error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i)) + if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); do { - if (error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT)) + if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, + &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); freecount += rec.ir_freecount; - if (error = xfs_inobt_increment(cur, 0, &i)) + if ((error = xfs_inobt_increment(cur, 0, &i))) goto error0; } while (i == 1); @@ -652,7 +652,7 @@ nextag: * If in the same a.g. as the parent, try to get near the parent. */ if (pagno == agno) { - if (error = xfs_inobt_lookup_le(cur, pagino, 0, 0, &i)) + if ((error = xfs_inobt_lookup_le(cur, pagino, 0, 0, &i))) goto error0; if (i != 0 && (error = xfs_inobt_get_rec(cur, &rec.ir_startino, @@ -679,33 +679,33 @@ nextag: * Duplicate the cursor, search left & right * simultaneously. */ - if (error = xfs_btree_dup_cursor(cur, &tcur)) + if ((error = xfs_btree_dup_cursor(cur, &tcur))) goto error0; /* * Search left with tcur, back up 1 record. */ - if (error = xfs_inobt_decrement(tcur, 0, &i)) + if ((error = xfs_inobt_decrement(tcur, 0, &i))) goto error1; doneleft = !i; if (!doneleft) { - if (error = xfs_inobt_get_rec(tcur, + if ((error = xfs_inobt_get_rec(tcur, &trec.ir_startino, &trec.ir_freecount, - &trec.ir_free, &i, ARCH_NOCONVERT)) + &trec.ir_free, &i, ARCH_NOCONVERT))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); } /* * Search right with cur, go forward 1 record. */ - if (error = xfs_inobt_increment(cur, 0, &i)) + if ((error = xfs_inobt_increment(cur, 0, &i))) goto error1; doneright = !i; if (!doneright) { - if (error = xfs_inobt_get_rec(cur, + if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT)) + &rec.ir_free, &i, ARCH_NOCONVERT))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); } @@ -760,16 +760,16 @@ nextag: * further left. */ if (useleft) { - if (error = xfs_inobt_decrement(tcur, 0, - &i)) + if ((error = xfs_inobt_decrement(tcur, 0, + &i))) goto error1; doneleft = !i; if (!doneleft) { - if (error = xfs_inobt_get_rec( + if ((error = xfs_inobt_get_rec( tcur, &trec.ir_startino, &trec.ir_freecount, - &trec.ir_free, &i, ARCH_NOCONVERT)) + &trec.ir_free, &i, ARCH_NOCONVERT))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); @@ -780,16 +780,16 @@ nextag: * further right. */ else { - if (error = xfs_inobt_increment(cur, 0, - &i)) + if ((error = xfs_inobt_increment(cur, 0, + &i))) goto error1; doneright = !i; if (!doneright) { - if (error = xfs_inobt_get_rec( + if ((error = xfs_inobt_get_rec( cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT)) + &rec.ir_free, &i, ARCH_NOCONVERT))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); @@ -804,8 +804,8 @@ nextag: * See if the most recently allocated block has any free. */ else if (INT_GET(agi->agi_newino, ARCH_CONVERT) != NULLAGINO) { - if (error = xfs_inobt_lookup_eq(cur, - INT_GET(agi->agi_newino, ARCH_CONVERT), 0, 0, &i)) + if ((error = xfs_inobt_lookup_eq(cur, + INT_GET(agi->agi_newino, ARCH_CONVERT), 0, 0, &i))) goto error0; if (i == 1 && (error = xfs_inobt_get_rec(cur, &rec.ir_startino, @@ -823,19 +823,19 @@ nextag: else { if (error) goto error0; - if (error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i)) + if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i))) goto error0; ASSERT(i == 1); for (;;) { - if (error = xfs_inobt_get_rec(cur, + if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, &rec.ir_free, - &i, ARCH_NOCONVERT)) + &i, ARCH_NOCONVERT))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (rec.ir_freecount > 0) break; - if (error = xfs_inobt_increment(cur, 0, &i)) + if ((error = xfs_inobt_increment(cur, 0, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); } @@ -849,8 +849,8 @@ nextag: ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino + offset); XFS_INOBT_CLR_FREE(&rec, offset, ARCH_NOCONVERT); rec.ir_freecount--; - if (error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount, - rec.ir_free)) + if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount, + rec.ir_free))) goto error0; INT_MOD(agi->agi_freecount, ARCH_CONVERT, -1); xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT); @@ -861,15 +861,15 @@ nextag: if (cur->bc_nlevels == 1) { int freecount = 0; - if (error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i)) + if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i))) goto error0; do { - if (error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT)) + if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, + &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); freecount += rec.ir_freecount; - if (error = xfs_inobt_increment(cur, 0, &i)) + if ((error = xfs_inobt_increment(cur, 0, &i))) goto error0; } while (i == 1); ASSERT(freecount == INT_GET(agi->agi_freecount, ARCH_CONVERT) || @@ -958,10 +958,10 @@ xfs_dilocate( return error; cur = xfs_btree_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_INO, (xfs_inode_t *)0, 0); - if (error = xfs_inobt_lookup_le(cur, agino, 0, 0, &i)) + if ((error = xfs_inobt_lookup_le(cur, agino, 0, 0, &i))) goto error0; - if (error = xfs_inobt_get_rec(cur, &chunk_agino, &chunk_cnt, - &chunk_free, &i, ARCH_NOCONVERT)) + if ((error = xfs_inobt_get_rec(cur, &chunk_agino, &chunk_cnt, + &chunk_free, &i, ARCH_NOCONVERT))) goto error0; if (i == 0) error = XFS_ERROR(EINVAL); @@ -1076,7 +1076,7 @@ xfs_ialloc_read_agi( ASSERT(agno != NULLAGNUMBER); d = XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR); - if (error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, 0, &bp)) + if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, 0, &bp))) return error; ASSERT(bp && !XFS_BUF_GETERROR(bp)); /* diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index bdf2dae48..eabe38669 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -53,7 +53,7 @@ xfs_inobt_insrec( int error; /* error return value */ int i; /* loop index */ xfs_inobt_key_t key; /* key value being inserted */ - xfs_inobt_key_t *kp; /* pointer to btree keys */ + xfs_inobt_key_t *kp=NULL; /* pointer to btree keys */ xfs_agblock_t nbno; /* block number of allocated block */ xfs_btree_cur_t *ncur; /* new cursor to be used at next lvl */ xfs_inobt_key_t nkey; /* new key value, from split */ @@ -61,7 +61,7 @@ xfs_inobt_insrec( int optr; /* old ptr value */ xfs_inobt_ptr_t *pp; /* pointer to btree addresses */ int ptr; /* index in btree block for this rec */ - xfs_inobt_rec_t *rp; /* pointer to btree records */ + xfs_inobt_rec_t *rp=NULL; /* pointer to btree records */ /* * If we made it to the root level, allocate a new root block @@ -91,7 +91,7 @@ xfs_inobt_insrec( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; /* * Check that the new entry is being inserted in the right place. @@ -116,7 +116,7 @@ xfs_inobt_insrec( /* * First, try shifting an entry to the right neighbor. */ - if (error = xfs_inobt_rshift(cur, level, &i)) + if ((error = xfs_inobt_rshift(cur, level, &i))) return error; if (i) { /* nothing */ @@ -125,7 +125,7 @@ xfs_inobt_insrec( * Next, try shifting an entry to the left neighbor. */ else { - if (error = xfs_inobt_lshift(cur, level, &i)) + if ((error = xfs_inobt_lshift(cur, level, &i))) return error; if (i) { optr = ptr = cur->bc_ptrs[level]; @@ -136,15 +136,15 @@ xfs_inobt_insrec( * re-set our variables because * we could be in a different block now. */ - if (error = xfs_inobt_split(cur, level, &nbno, - &nkey, &ncur, &i)) + if ((error = xfs_inobt_split(cur, level, &nbno, + &nkey, &ncur, &i))) return error; if (i) { bp = cur->bc_bufs[level]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, - block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, + block, level, bp))) return error; #endif ptr = cur->bc_ptrs[level]; @@ -172,7 +172,7 @@ xfs_inobt_insrec( pp = XFS_INOBT_PTR_ADDR(block, 1, cur); #ifdef DEBUG for (i = INT_GET(block->bb_numrecs, ARCH_CONVERT); i >= ptr; i--) { - if (error = xfs_btree_check_sptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), level))) return error; } #endif @@ -184,7 +184,7 @@ xfs_inobt_insrec( * Now stuff the new data in, bump numrecs and log the new data. */ #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, *bnop, level)) + if ((error = xfs_btree_check_sptr(cur, *bnop, level))) return error; #endif kp[ptr - 1] = key; /* INT_: struct copy */ @@ -344,10 +344,10 @@ xfs_inobt_lookup( { xfs_agblock_t agbno; /* a.g. relative btree block number */ xfs_agnumber_t agno; /* allocation group number */ - xfs_inobt_block_t *block; /* current btree block */ + xfs_inobt_block_t *block=NULL; /* current btree block */ int diff; /* difference for the current key */ int error; /* error return value */ - int keyno; /* current key number */ + int keyno=0; /* current key number */ int level; /* level in the btree */ xfs_mount_t *mp; /* file system mount point */ @@ -388,16 +388,16 @@ xfs_inobt_lookup( * Need to get a new buffer. Read it, then * set it in the cursor, releasing the old one. */ - if (error = xfs_btree_read_bufs(mp, cur->bc_tp, - agno, agbno, 0, &bp, XFS_INO_BTREE_REF)) + if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, + agno, agbno, 0, &bp, XFS_INO_BTREE_REF))) return error; xfs_btree_setbuf(cur, level, bp); /* * Point to the btree block, now that we have the buffer */ block = XFS_BUF_TO_INOBT_BLOCK(bp); - if (error = xfs_btree_check_sblock(cur, block, level, - bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, + bp))) return error; } else block = XFS_BUF_TO_INOBT_BLOCK(bp); @@ -412,8 +412,8 @@ xfs_inobt_lookup( */ else { int high; /* high entry number */ - xfs_inobt_key_t *kkbase;/* base of keys in block */ - xfs_inobt_rec_t *krbase;/* base of records in block */ + xfs_inobt_key_t *kkbase=NULL;/* base of keys in block */ + xfs_inobt_rec_t *krbase=NULL;/* base of records in block */ int low; /* low entry number */ /* @@ -495,7 +495,7 @@ xfs_inobt_lookup( keyno = 1; agbno = INT_GET(*XFS_INOBT_PTR_ADDR(block, keyno, cur), ARCH_CONVERT); #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, agbno, level)) + if ((error = xfs_btree_check_sptr(cur, agbno, level))) return error; #endif cur->bc_ptrs[level] = keyno; @@ -517,7 +517,7 @@ xfs_inobt_lookup( int i; cur->bc_ptrs[0] = keyno; - if (error = xfs_inobt_increment(cur, 0, &i)) + if ((error = xfs_inobt_increment(cur, 0, &i))) return error; ASSERT(i == 1); *stat = 1; @@ -554,15 +554,15 @@ xfs_inobt_lshift( xfs_inobt_key_t key; /* key value for leaf level upward */ xfs_buf_t *lbp; /* buffer for left neighbor block */ xfs_inobt_block_t *left; /* left neighbor btree block */ - xfs_inobt_key_t *lkp; /* key pointer for left block */ + xfs_inobt_key_t *lkp=NULL; /* key pointer for left block */ xfs_inobt_ptr_t *lpp; /* address pointer for left block */ - xfs_inobt_rec_t *lrp; /* record pointer for left block */ + xfs_inobt_rec_t *lrp=NULL; /* record pointer for left block */ int nrec; /* new number of left block entries */ xfs_buf_t *rbp; /* buffer for right (current) block */ xfs_inobt_block_t *right; /* right (current) btree block */ - xfs_inobt_key_t *rkp; /* key pointer for right block */ - xfs_inobt_ptr_t *rpp; /* address pointer for right block */ - xfs_inobt_rec_t *rrp; /* record pointer for right block */ + xfs_inobt_key_t *rkp=NULL; /* key pointer for right block */ + xfs_inobt_ptr_t *rpp=NULL; /* address pointer for right block */ + xfs_inobt_rec_t *rrp=NULL; /* record pointer for right block */ /* * Set up variables for this block as "right". @@ -570,7 +570,7 @@ xfs_inobt_lshift( rbp = cur->bc_bufs[level]; right = XFS_BUF_TO_INOBT_BLOCK(rbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, right, level, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) return error; #endif /* @@ -591,12 +591,12 @@ xfs_inobt_lshift( /* * Set up the left neighbor as "left". */ - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.i.agno, INT_GET(right->bb_leftsib, ARCH_CONVERT), 0, &lbp, - XFS_INO_BTREE_REF)) + XFS_INO_BTREE_REF))) return error; left = XFS_BUF_TO_INOBT_BLOCK(lbp); - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; /* * If it's full, it can't take another entry. @@ -617,7 +617,7 @@ xfs_inobt_lshift( lpp = XFS_INOBT_PTR_ADDR(left, nrec, cur); rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, INT_GET(*rpp, ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(*rpp, ARCH_CONVERT), level))) return error; #endif *lpp = *rpp; /* INT_: no-change copy */ @@ -651,8 +651,8 @@ xfs_inobt_lshift( if (level > 0) { #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_sptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), - level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), + level))) return error; } #endif @@ -669,7 +669,7 @@ xfs_inobt_lshift( /* * Update the parent key values of right. */ - if (error = xfs_inobt_updkey(cur, rkp, level + 1)) + if ((error = xfs_inobt_updkey(cur, rkp, level + 1))) return error; /* * Slide the cursor value left one. @@ -719,7 +719,7 @@ xfs_inobt_newroot( args.isfl = args.userdata = args.minalignslop = 0; args.minlen = args.maxlen = args.prod = 1; args.type = XFS_ALLOCTYPE_NEAR_BNO; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; /* * None available, we fail. @@ -747,7 +747,7 @@ xfs_inobt_newroot( bp = cur->bc_bufs[cur->bc_nlevels - 1]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, cur->bc_nlevels - 1, bp)) + if ((error = xfs_btree_check_sblock(cur, block, cur->bc_nlevels - 1, bp))) return error; #endif if (INT_GET(block->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) { @@ -758,13 +758,13 @@ xfs_inobt_newroot( lbno = XFS_DADDR_TO_AGBNO(args.mp, XFS_BUF_ADDR(lbp)); left = block; rbno = INT_GET(left->bb_rightsib, ARCH_CONVERT); - if (error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, - rbno, 0, &rbp, XFS_INO_BTREE_REF)) + if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, + rbno, 0, &rbp, XFS_INO_BTREE_REF))) return error; bp = rbp; right = XFS_BUF_TO_INOBT_BLOCK(rbp); - if (error = xfs_btree_check_sblock(cur, right, - cur->bc_nlevels - 1, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, + cur->bc_nlevels - 1, rbp))) return error; nptr = 1; } else { @@ -775,13 +775,13 @@ xfs_inobt_newroot( rbno = XFS_DADDR_TO_AGBNO(args.mp, XFS_BUF_ADDR(rbp)); right = block; lbno = INT_GET(right->bb_leftsib, ARCH_CONVERT); - if (error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, - lbno, 0, &lbp, XFS_INO_BTREE_REF)) + if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, + lbno, 0, &lbp, XFS_INO_BTREE_REF))) return error; bp = lbp; left = XFS_BUF_TO_INOBT_BLOCK(lbp); - if (error = xfs_btree_check_sblock(cur, left, - cur->bc_nlevels - 1, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, + cur->bc_nlevels - 1, lbp))) return error; nptr = 2; } @@ -848,7 +848,7 @@ xfs_inobt_rshift( xfs_inobt_block_t *right; /* right neighbor btree block */ xfs_inobt_key_t *rkp; /* key pointer for right block */ xfs_inobt_ptr_t *rpp; /* address pointer for right block */ - xfs_inobt_rec_t *rrp; /* record pointer for right block */ + xfs_inobt_rec_t *rrp=NULL; /* record pointer for right block */ xfs_btree_cur_t *tcur; /* temporary cursor */ /* @@ -857,7 +857,7 @@ xfs_inobt_rshift( lbp = cur->bc_bufs[level]; left = XFS_BUF_TO_INOBT_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; #endif /* @@ -878,12 +878,12 @@ xfs_inobt_rshift( /* * Set up the right neighbor as "right". */ - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.i.agno, INT_GET(left->bb_rightsib, ARCH_CONVERT), 0, &rbp, - XFS_INO_BTREE_REF)) + XFS_INO_BTREE_REF))) return error; right = XFS_BUF_TO_INOBT_BLOCK(rbp); - if (error = xfs_btree_check_sblock(cur, right, level, rbp)) + if ((error = xfs_btree_check_sblock(cur, right, level, rbp))) return error; /* * If it's full, it can't take another entry. @@ -903,14 +903,14 @@ xfs_inobt_rshift( rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); #ifdef DEBUG for (i = INT_GET(right->bb_numrecs, ARCH_CONVERT) - 1; i >= 0; i--) { - if (error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) return error; } #endif ovbcopy(rkp, rkp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rkp)); ovbcopy(rpp, rpp + 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) * sizeof(*rpp)); #ifdef DEBUG - if (error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) return error; #endif *rkp = *lkp; /* INT_: no change copy */ @@ -943,7 +943,7 @@ xfs_inobt_rshift( * Using a temporary cursor, update the parent key values of the * block on the right. */ - if (error = xfs_btree_dup_cursor(cur, &tcur)) + if ((error = xfs_btree_dup_cursor(cur, &tcur))) return error; xfs_btree_lastrec(tcur, level); if ((error = xfs_inobt_increment(tcur, level, &i)) || @@ -1000,7 +1000,7 @@ xfs_inobt_split( args.isfl = args.userdata = args.minalignslop = 0; args.minlen = args.maxlen = args.prod = 1; args.type = XFS_ALLOCTYPE_NEAR_BNO; - if (error = xfs_alloc_vextent(&args)) + if ((error = xfs_alloc_vextent(&args))) return error; if (args.fsbno == NULLFSBLOCK) { *stat = 0; @@ -1017,7 +1017,7 @@ xfs_inobt_split( */ left = XFS_BUF_TO_INOBT_BLOCK(lbp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, left, level, lbp)) + if ((error = xfs_btree_check_sblock(cur, left, level, lbp))) return error; #endif /* @@ -1044,7 +1044,7 @@ xfs_inobt_split( rpp = XFS_INOBT_PTR_ADDR(right, 1, cur); #ifdef DEBUG for (i = 0; i < INT_GET(right->bb_numrecs, ARCH_CONVERT); i++) { - if (error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level)) + if ((error = xfs_btree_check_sptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) return error; } #endif @@ -1082,12 +1082,12 @@ xfs_inobt_split( xfs_inobt_block_t *rrblock; /* rr btree block */ xfs_buf_t *rrbp; /* buffer for rrblock */ - if (error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, + if ((error = xfs_btree_read_bufs(args.mp, args.tp, args.agno, INT_GET(right->bb_rightsib, ARCH_CONVERT), 0, &rrbp, - XFS_INO_BTREE_REF)) + XFS_INO_BTREE_REF))) return error; rrblock = XFS_BUF_TO_INOBT_BLOCK(rrbp); - if (error = xfs_btree_check_sblock(cur, rrblock, level, rrbp)) + if ((error = xfs_btree_check_sblock(cur, rrblock, level, rrbp))) return error; INT_SET(rrblock->bb_leftsib, ARCH_CONVERT, args.agbno); xfs_inobt_log_block(args.tp, rrbp, XFS_BB_LEFTSIB); @@ -1106,7 +1106,7 @@ xfs_inobt_split( * the right block, no matter where this cursor was. */ if (level + 1 < cur->bc_nlevels) { - if (error = xfs_btree_dup_cursor(cur, curp)) + if ((error = xfs_btree_dup_cursor(cur, curp))) return error; (*curp)->bc_ptrs[level + 1]++; } @@ -1143,7 +1143,7 @@ xfs_inobt_updkey( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; #endif ptr = cur->bc_ptrs[level]; @@ -1190,8 +1190,8 @@ xfs_inobt_decrement( */ block = XFS_BUF_TO_INOBT_BLOCK(cur->bc_bufs[level]); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, - cur->bc_bufs[level])) + if ((error = xfs_btree_check_sblock(cur, block, level, + cur->bc_bufs[level]))) return error; #endif /* @@ -1227,14 +1227,14 @@ xfs_inobt_decrement( xfs_buf_t *bp; /* buffer containing btree block */ agbno = INT_GET(*XFS_INOBT_PTR_ADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.i.agno, agbno, 0, &bp, - XFS_INO_BTREE_REF)) + XFS_INO_BTREE_REF))) return error; lev--; xfs_btree_setbuf(cur, lev, bp); block = XFS_BUF_TO_INOBT_BLOCK(bp); - if (error = xfs_btree_check_sblock(cur, block, lev, bp)) + if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) return error; cur->bc_ptrs[lev] = INT_GET(block->bb_numrecs, ARCH_CONVERT); } @@ -1266,7 +1266,7 @@ xfs_inobt_get_rec( ptr = cur->bc_ptrs[0]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, 0, bp)) + if ((error = xfs_btree_check_sblock(cur, block, 0, bp))) return error; #endif /* @@ -1320,7 +1320,7 @@ xfs_inobt_increment( bp = cur->bc_bufs[level]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, level, bp)) + if ((error = xfs_btree_check_sblock(cur, block, level, bp))) return error; #endif /* @@ -1346,7 +1346,7 @@ xfs_inobt_increment( bp = cur->bc_bufs[lev]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, lev, bp)) + if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) return error; #endif if (++cur->bc_ptrs[lev] <= INT_GET(block->bb_numrecs, ARCH_CONVERT)) @@ -1370,14 +1370,14 @@ xfs_inobt_increment( xfs_agblock_t agbno; /* block number of btree block */ agbno = INT_GET(*XFS_INOBT_PTR_ADDR(block, cur->bc_ptrs[lev], cur), ARCH_CONVERT); - if (error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, + if ((error = xfs_btree_read_bufs(cur->bc_mp, cur->bc_tp, cur->bc_private.i.agno, agbno, 0, &bp, - XFS_INO_BTREE_REF)) + XFS_INO_BTREE_REF))) return error; lev--; xfs_btree_setbuf(cur, lev, bp); block = XFS_BUF_TO_INOBT_BLOCK(bp); - if (error = xfs_btree_check_sblock(cur, block, lev, bp)) + if ((error = xfs_btree_check_sblock(cur, block, lev, bp))) return error; cur->bc_ptrs[lev] = 1; } @@ -1419,8 +1419,8 @@ xfs_inobt_insert( * Insert nrec/nbno into this level of the tree. * Note if we fail, nbno will be null. */ - if (error = xfs_inobt_insrec(pcur, level++, &nbno, &nrec, &ncur, - &i)) { + if ((error = xfs_inobt_insrec(pcur, level++, &nbno, &nrec, &ncur, + &i))) { if (pcur != cur) xfs_btree_del_cursor(pcur, XFS_BTREE_ERROR); return error; @@ -1523,7 +1523,7 @@ xfs_inobt_update( bp = cur->bc_bufs[0]; block = XFS_BUF_TO_INOBT_BLOCK(bp); #ifdef DEBUG - if (error = xfs_btree_check_sblock(cur, block, 0, bp)) + if ((error = xfs_btree_check_sblock(cur, block, 0, bp))) return error; #endif /* @@ -1545,7 +1545,7 @@ xfs_inobt_update( xfs_inobt_key_t key; /* key containing [ino] */ INT_SET(key.ir_startino, ARCH_CONVERT, ino); - if (error = xfs_inobt_updkey(cur, &key, 1)) + if ((error = xfs_inobt_updkey(cur, &key, 1))) return error; } return 0; diff --git a/libxfs/xfs_rtalloc.c b/libxfs/xfs_rtalloc.c index 18b2e7bb4..16ece268c 100644 --- a/libxfs/xfs_rtalloc.c +++ b/libxfs/xfs_rtalloc.c @@ -144,7 +144,7 @@ xfs_rtfind_back( * Calculate the difference between the value there * and what we're looking for. */ - if (wdiff = (*b ^ want) & mask) { + if ((wdiff = (*b ^ want) & mask)) { /* * Different. Mark where we are and return. */ @@ -190,7 +190,7 @@ xfs_rtfind_back( /* * Compute difference between actual and desired value. */ - if (wdiff = *b ^ want) { + if ((wdiff = *b ^ want)) { /* * Different, mark where we are and return. */ @@ -237,7 +237,7 @@ xfs_rtfind_back( /* * Compute difference between actual and desired value. */ - if (wdiff = (*b ^ want) & mask) { + if ((wdiff = (*b ^ want) & mask)) { /* * Different, mark where we are and return. */ @@ -318,7 +318,7 @@ xfs_rtfind_forw( * Calculate the difference between the value there * and what we're looking for. */ - if (wdiff = (*b ^ want) & mask) { + if ((wdiff = (*b ^ want) & mask)) { /* * Different. Mark where we are and return. */ @@ -363,7 +363,7 @@ xfs_rtfind_forw( /* * Compute difference between actual and desired value. */ - if (wdiff = *b ^ want) { + if ((wdiff = *b ^ want)) { /* * Different, mark where we are and return. */ @@ -399,7 +399,7 @@ xfs_rtfind_forw( * If not ending on a word boundary, deal with the last * (partial) word. */ - if (lastbit = len - i) { + if ((lastbit = len - i)) { /* * Calculate mask for all the relevant bits in this word. */ @@ -407,7 +407,7 @@ xfs_rtfind_forw( /* * Compute difference between actual and desired value. */ - if (wdiff = (*b ^ want) & mask) { + if ((wdiff = (*b ^ want) & mask)) { /* * Different, mark where we are and return. */ @@ -633,7 +633,7 @@ xfs_rtmodify_range( * If not ending on a word boundary, deal with the last * (partial) word. */ - if (lastbit = len - i) { + if ((lastbit = len - i)) { /* * Compute a mask of relevant bits. */