Commit 6a178100 authored by Barry Naujok's avatar Barry Naujok Committed by Niv Sardi

[XFS] Add op_flags field and helpers to xfs_da_args

The end of the xfs_da_args structure has 4 unsigned char fields for
true/false information on directory and attr operations using the
xfs_da_args structure.

The following converts these 4 into a op_flags field that uses the first 4
bits for these fields and allows expansion for future operation
information (eg. case-insensitive lookup request).

SGI-PV: 981520
SGI-Modid: xfs-linux-melb:xfs-kern:31206a
Signed-off-by: default avatarBarry Naujok <bnaujok@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
parent 5163f95a
...@@ -241,8 +241,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name, ...@@ -241,8 +241,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name,
args.firstblock = &firstblock; args.firstblock = &firstblock;
args.flist = &flist; args.flist = &flist;
args.whichfork = XFS_ATTR_FORK; args.whichfork = XFS_ATTR_FORK;
args.addname = 1; args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
args.oknoent = 1;
/* /*
* Determine space new attribute will use, and if it would be * Determine space new attribute will use, and if it would be
...@@ -974,7 +973,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -974,7 +973,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
xfs_da_brelse(args->trans, bp); xfs_da_brelse(args->trans, bp);
return(retval); return(retval);
} }
args->rename = 1; /* an atomic rename */ args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */
args->blkno2 = args->blkno; /* set 2nd entry info*/ args->blkno2 = args->blkno; /* set 2nd entry info*/
args->index2 = args->index; args->index2 = args->index;
args->rmtblkno2 = args->rmtblkno; args->rmtblkno2 = args->rmtblkno;
...@@ -1054,7 +1053,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -1054,7 +1053,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
* so that one disappears and one appears atomically. Then we * so that one disappears and one appears atomically. Then we
* must remove the "old" attribute/value pair. * must remove the "old" attribute/value pair.
*/ */
if (args->rename) { if (args->op_flags & XFS_DA_OP_RENAME) {
/* /*
* In a separate transaction, set the incomplete flag on the * In a separate transaction, set the incomplete flag on the
* "old" attr and clear the incomplete flag on the "new" attr. * "old" attr and clear the incomplete flag on the "new" attr.
...@@ -1307,7 +1306,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1307,7 +1306,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
} else if (retval == EEXIST) { } else if (retval == EEXIST) {
if (args->flags & ATTR_CREATE) if (args->flags & ATTR_CREATE)
goto out; goto out;
args->rename = 1; /* atomic rename op */ args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */
args->blkno2 = args->blkno; /* set 2nd entry info*/ args->blkno2 = args->blkno; /* set 2nd entry info*/
args->index2 = args->index; args->index2 = args->index;
args->rmtblkno2 = args->rmtblkno; args->rmtblkno2 = args->rmtblkno;
...@@ -1425,7 +1424,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1425,7 +1424,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
* so that one disappears and one appears atomically. Then we * so that one disappears and one appears atomically. Then we
* must remove the "old" attribute/value pair. * must remove the "old" attribute/value pair.
*/ */
if (args->rename) { if (args->op_flags & XFS_DA_OP_RENAME) {
/* /*
* In a separate transaction, set the incomplete flag on the * In a separate transaction, set the incomplete flag on the
* "old" attr and clear the incomplete flag on the "new" attr. * "old" attr and clear the incomplete flag on the "new" attr.
......
...@@ -369,9 +369,10 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) ...@@ -369,9 +369,10 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
* Fix up the start offset of the attribute fork * Fix up the start offset of the attribute fork
*/ */
totsize -= size; totsize -= size;
if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname && if (totsize == sizeof(xfs_attr_sf_hdr_t) &&
(mp->m_flags & XFS_MOUNT_ATTR2) && !(args->op_flags & XFS_DA_OP_ADDNAME) &&
(dp->i_d.di_format != XFS_DINODE_FMT_BTREE)) { (mp->m_flags & XFS_MOUNT_ATTR2) &&
(dp->i_d.di_format != XFS_DINODE_FMT_BTREE)) {
/* /*
* Last attribute now removed, revert to original * Last attribute now removed, revert to original
* inode format making all literal area available * inode format making all literal area available
...@@ -389,9 +390,10 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) ...@@ -389,9 +390,10 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); xfs_idata_realloc(dp, -size, XFS_ATTR_FORK);
dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize);
ASSERT(dp->i_d.di_forkoff); ASSERT(dp->i_d.di_forkoff);
ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname || ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) ||
!(mp->m_flags & XFS_MOUNT_ATTR2) || (args->op_flags & XFS_DA_OP_ADDNAME) ||
dp->i_d.di_format == XFS_DINODE_FMT_BTREE); !(mp->m_flags & XFS_MOUNT_ATTR2) ||
dp->i_d.di_format == XFS_DINODE_FMT_BTREE);
dp->i_afp->if_ext_max = dp->i_afp->if_ext_max =
XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t); XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t);
dp->i_df.if_ext_max = dp->i_df.if_ext_max =
...@@ -531,7 +533,7 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) ...@@ -531,7 +533,7 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
nargs.total = args->total; nargs.total = args->total;
nargs.whichfork = XFS_ATTR_FORK; nargs.whichfork = XFS_ATTR_FORK;
nargs.trans = args->trans; nargs.trans = args->trans;
nargs.oknoent = 1; nargs.op_flags = XFS_DA_OP_OKNOENT;
sfe = &sf->list[0]; sfe = &sf->list[0];
for (i = 0; i < sf->hdr.count; i++) { for (i = 0; i < sf->hdr.count; i++) {
...@@ -853,7 +855,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff) ...@@ -853,7 +855,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
nargs.total = args->total; nargs.total = args->total;
nargs.whichfork = XFS_ATTR_FORK; nargs.whichfork = XFS_ATTR_FORK;
nargs.trans = args->trans; nargs.trans = args->trans;
nargs.oknoent = 1; nargs.op_flags = XFS_DA_OP_OKNOENT;
entry = &leaf->entries[0]; entry = &leaf->entries[0];
for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
if (entry->flags & XFS_ATTR_INCOMPLETE) if (entry->flags & XFS_ATTR_INCOMPLETE)
...@@ -1155,7 +1157,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) ...@@ -1155,7 +1157,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
entry->hashval = cpu_to_be32(args->hashval); entry->hashval = cpu_to_be32(args->hashval);
entry->flags = tmp ? XFS_ATTR_LOCAL : 0; entry->flags = tmp ? XFS_ATTR_LOCAL : 0;
entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags); entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
if (args->rename) { if (args->op_flags & XFS_DA_OP_RENAME) {
entry->flags |= XFS_ATTR_INCOMPLETE; entry->flags |= XFS_ATTR_INCOMPLETE;
if ((args->blkno2 == args->blkno) && if ((args->blkno2 == args->blkno) &&
(args->index2 <= args->index)) { (args->index2 <= args->index)) {
......
...@@ -1431,7 +1431,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, ...@@ -1431,7 +1431,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
} }
if (level < 0) { if (level < 0) {
*result = XFS_ERROR(ENOENT); /* we're out of our tree */ *result = XFS_ERROR(ENOENT); /* we're out of our tree */
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
return(0); return(0);
} }
......
...@@ -132,13 +132,18 @@ typedef struct xfs_da_args { ...@@ -132,13 +132,18 @@ typedef struct xfs_da_args {
int index2; /* index of 2nd attr in blk */ int index2; /* index of 2nd attr in blk */
xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */ xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */
int rmtblkcnt2; /* remote attr value block count */ int rmtblkcnt2; /* remote attr value block count */
unsigned char justcheck; /* T/F: check for ok with no space */ int op_flags; /* operation flags */
unsigned char rename; /* T/F: this is an atomic rename op */
unsigned char addname; /* T/F: this is an add operation */
unsigned char oknoent; /* T/F: ok to return ENOENT, else die */
enum xfs_dacmp cmpresult; /* name compare result for lookups */ enum xfs_dacmp cmpresult; /* name compare result for lookups */
} xfs_da_args_t; } xfs_da_args_t;
/*
* Operation flags:
*/
#define XFS_DA_OP_JUSTCHECK 0x0001 /* check for ok with no space */
#define XFS_DA_OP_RENAME 0x0002 /* this is an atomic rename op */
#define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */
#define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else die */
/* /*
* Structure to describe buffer(s) for a block. * Structure to describe buffer(s) for a block.
* This is needed in the directory version 2 format case, when * This is needed in the directory version 2 format case, when
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
struct xfs_name xfs_name_dotdot = {"..", 2}; struct xfs_name xfs_name_dotdot = {"..", 2};
extern const struct xfs_nameops xfs_default_nameops;
void void
xfs_dir_mount( xfs_dir_mount(
xfs_mount_t *mp) xfs_mount_t *mp)
...@@ -173,8 +175,7 @@ xfs_dir_createname( ...@@ -173,8 +175,7 @@ xfs_dir_createname(
args.total = total; args.total = total;
args.whichfork = XFS_DATA_FORK; args.whichfork = XFS_DATA_FORK;
args.trans = tp; args.trans = tp;
args.justcheck = 0; args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
args.addname = args.oknoent = 1;
if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
rval = xfs_dir2_sf_addname(&args); rval = xfs_dir2_sf_addname(&args);
...@@ -215,7 +216,7 @@ xfs_dir_lookup( ...@@ -215,7 +216,7 @@ xfs_dir_lookup(
args.dp = dp; args.dp = dp;
args.whichfork = XFS_DATA_FORK; args.whichfork = XFS_DATA_FORK;
args.trans = tp; args.trans = tp;
args.oknoent = 1; args.op_flags = XFS_DA_OP_OKNOENT;
args.cmpresult = XFS_CMP_DIFFERENT; args.cmpresult = XFS_CMP_DIFFERENT;
if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
...@@ -267,7 +268,7 @@ xfs_dir_removename( ...@@ -267,7 +268,7 @@ xfs_dir_removename(
args.total = total; args.total = total;
args.whichfork = XFS_DATA_FORK; args.whichfork = XFS_DATA_FORK;
args.trans = tp; args.trans = tp;
args.justcheck = args.addname = args.oknoent = 0; args.op_flags = 0;
if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
rval = xfs_dir2_sf_removename(&args); rval = xfs_dir2_sf_removename(&args);
...@@ -350,7 +351,7 @@ xfs_dir_replace( ...@@ -350,7 +351,7 @@ xfs_dir_replace(
args.total = total; args.total = total;
args.whichfork = XFS_DATA_FORK; args.whichfork = XFS_DATA_FORK;
args.trans = tp; args.trans = tp;
args.justcheck = args.addname = args.oknoent = 0; args.op_flags = 0;
if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
rval = xfs_dir2_sf_replace(&args); rval = xfs_dir2_sf_replace(&args);
...@@ -394,7 +395,8 @@ xfs_dir_canenter( ...@@ -394,7 +395,8 @@ xfs_dir_canenter(
args.dp = dp; args.dp = dp;
args.whichfork = XFS_DATA_FORK; args.whichfork = XFS_DATA_FORK;
args.trans = tp; args.trans = tp;
args.justcheck = args.addname = args.oknoent = 1; args.op_flags = XFS_DA_OP_JUSTCHECK | XFS_DA_OP_ADDNAME |
XFS_DA_OP_OKNOENT;
if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
rval = xfs_dir2_sf_addname(&args); rval = xfs_dir2_sf_addname(&args);
......
...@@ -215,7 +215,7 @@ xfs_dir2_block_addname( ...@@ -215,7 +215,7 @@ xfs_dir2_block_addname(
/* /*
* If this isn't a real add, we're done with the buffer. * If this isn't a real add, we're done with the buffer.
*/ */
if (args->justcheck) if (args->op_flags & XFS_DA_OP_JUSTCHECK)
xfs_da_brelse(tp, bp); xfs_da_brelse(tp, bp);
/* /*
* If we don't have space for the new entry & leaf ... * If we don't have space for the new entry & leaf ...
...@@ -225,7 +225,7 @@ xfs_dir2_block_addname( ...@@ -225,7 +225,7 @@ xfs_dir2_block_addname(
* Not trying to actually do anything, or don't have * Not trying to actually do anything, or don't have
* a space reservation: return no-space. * a space reservation: return no-space.
*/ */
if (args->justcheck || args->total == 0) if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
return XFS_ERROR(ENOSPC); return XFS_ERROR(ENOSPC);
/* /*
* Convert to the next larger format. * Convert to the next larger format.
...@@ -240,7 +240,7 @@ xfs_dir2_block_addname( ...@@ -240,7 +240,7 @@ xfs_dir2_block_addname(
/* /*
* Just checking, and it would work, so say so. * Just checking, and it would work, so say so.
*/ */
if (args->justcheck) if (args->op_flags & XFS_DA_OP_JUSTCHECK)
return 0; return 0;
needlog = needscan = 0; needlog = needscan = 0;
/* /*
...@@ -674,7 +674,7 @@ xfs_dir2_block_lookup_int( ...@@ -674,7 +674,7 @@ xfs_dir2_block_lookup_int(
else else
high = mid - 1; high = mid - 1;
if (low > high) { if (low > high) {
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
xfs_da_brelse(tp, bp); xfs_da_brelse(tp, bp);
return XFS_ERROR(ENOENT); return XFS_ERROR(ENOENT);
} }
...@@ -713,7 +713,7 @@ xfs_dir2_block_lookup_int( ...@@ -713,7 +713,7 @@ xfs_dir2_block_lookup_int(
} while (++mid < be32_to_cpu(btp->count) && } while (++mid < be32_to_cpu(btp->count) &&
be32_to_cpu(blp[mid].hashval) == hash); be32_to_cpu(blp[mid].hashval) == hash);
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
/* /*
* Here, we can only be doing a lookup (not a rename or replace). * Here, we can only be doing a lookup (not a rename or replace).
* If a case-insensitive match was found earlier, return success. * If a case-insensitive match was found earlier, return success.
......
...@@ -263,20 +263,21 @@ xfs_dir2_leaf_addname( ...@@ -263,20 +263,21 @@ xfs_dir2_leaf_addname(
* If we don't have enough free bytes but we can make enough * If we don't have enough free bytes but we can make enough
* by compacting out stale entries, we'll do that. * by compacting out stale entries, we'll do that.
*/ */
if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] < needbytes && if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] <
be16_to_cpu(leaf->hdr.stale) > 1) { needbytes && be16_to_cpu(leaf->hdr.stale) > 1) {
compact = 1; compact = 1;
} }
/* /*
* Otherwise if we don't have enough free bytes we need to * Otherwise if we don't have enough free bytes we need to
* convert to node form. * convert to node form.
*/ */
else if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] < else if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(
needbytes) { leaf->hdr.count)] < needbytes) {
/* /*
* Just checking or no space reservation, give up. * Just checking or no space reservation, give up.
*/ */
if (args->justcheck || args->total == 0) { if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
args->total == 0) {
xfs_da_brelse(tp, lbp); xfs_da_brelse(tp, lbp);
return XFS_ERROR(ENOSPC); return XFS_ERROR(ENOSPC);
} }
...@@ -301,7 +302,7 @@ xfs_dir2_leaf_addname( ...@@ -301,7 +302,7 @@ xfs_dir2_leaf_addname(
* If just checking, then it will fit unless we needed to allocate * If just checking, then it will fit unless we needed to allocate
* a new data block. * a new data block.
*/ */
if (args->justcheck) { if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
xfs_da_brelse(tp, lbp); xfs_da_brelse(tp, lbp);
return use_block == -1 ? XFS_ERROR(ENOSPC) : 0; return use_block == -1 ? XFS_ERROR(ENOSPC) : 0;
} }
...@@ -1414,7 +1415,7 @@ xfs_dir2_leaf_lookup_int( ...@@ -1414,7 +1415,7 @@ xfs_dir2_leaf_lookup_int(
cbp = dbp; cbp = dbp;
} }
} }
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
/* /*
* Here, we can only be doing a lookup (not a rename or replace). * Here, we can only be doing a lookup (not a rename or replace).
* If a case-insensitive match was found earlier, release the current * If a case-insensitive match was found earlier, release the current
......
...@@ -226,7 +226,7 @@ xfs_dir2_leafn_add( ...@@ -226,7 +226,7 @@ xfs_dir2_leafn_add(
ASSERT(index == be16_to_cpu(leaf->hdr.count) || ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
be32_to_cpu(leaf->ents[index].hashval) >= args->hashval); be32_to_cpu(leaf->ents[index].hashval) >= args->hashval);
if (args->justcheck) if (args->op_flags & XFS_DA_OP_JUSTCHECK)
return 0; return 0;
/* /*
...@@ -515,7 +515,7 @@ xfs_dir2_leafn_lookup_for_addname( ...@@ -515,7 +515,7 @@ xfs_dir2_leafn_lookup_for_addname(
/* Didn't find any space */ /* Didn't find any space */
fi = -1; fi = -1;
out: out:
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
if (curbp) { if (curbp) {
/* Giving back a free block. */ /* Giving back a free block. */
state->extravalid = 1; state->extravalid = 1;
...@@ -638,7 +638,8 @@ xfs_dir2_leafn_lookup_for_entry( ...@@ -638,7 +638,8 @@ xfs_dir2_leafn_lookup_for_entry(
/* Didn't find an exact match. */ /* Didn't find an exact match. */
error = ENOENT; error = ENOENT;
di = -1; di = -1;
ASSERT(index == be16_to_cpu(leaf->hdr.count) || args->oknoent); ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
(args->op_flags & XFS_DA_OP_OKNOENT));
out: out:
if (curbp) { if (curbp) {
/* Giving back a data block. */ /* Giving back a data block. */
...@@ -669,7 +670,7 @@ xfs_dir2_leafn_lookup_int( ...@@ -669,7 +670,7 @@ xfs_dir2_leafn_lookup_int(
int *indexp, /* out: leaf entry index */ int *indexp, /* out: leaf entry index */
xfs_da_state_t *state) /* state to fill in */ xfs_da_state_t *state) /* state to fill in */
{ {
if (args->addname) if (args->op_flags & XFS_DA_OP_ADDNAME)
return xfs_dir2_leafn_lookup_for_addname(bp, args, indexp, return xfs_dir2_leafn_lookup_for_addname(bp, args, indexp,
state); state);
return xfs_dir2_leafn_lookup_for_entry(bp, args, indexp, state); return xfs_dir2_leafn_lookup_for_entry(bp, args, indexp, state);
...@@ -1383,7 +1384,7 @@ xfs_dir2_node_addname( ...@@ -1383,7 +1384,7 @@ xfs_dir2_node_addname(
/* /*
* It worked, fix the hash values up the btree. * It worked, fix the hash values up the btree.
*/ */
if (!args->justcheck) if (!(args->op_flags & XFS_DA_OP_JUSTCHECK))
xfs_da_fixhashpath(state, &state->path); xfs_da_fixhashpath(state, &state->path);
} else { } else {
/* /*
...@@ -1566,7 +1567,8 @@ xfs_dir2_node_addname_int( ...@@ -1566,7 +1567,8 @@ xfs_dir2_node_addname_int(
/* /*
* Not allowed to allocate, return failure. * Not allowed to allocate, return failure.
*/ */
if (args->justcheck || args->total == 0) { if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
args->total == 0) {
/* /*
* Drop the freespace buffer unless it came from our * Drop the freespace buffer unless it came from our
* caller. * caller.
...@@ -1712,7 +1714,7 @@ xfs_dir2_node_addname_int( ...@@ -1712,7 +1714,7 @@ xfs_dir2_node_addname_int(
/* /*
* If just checking, we succeeded. * If just checking, we succeeded.
*/ */
if (args->justcheck) { if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL) if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
xfs_da_buf_done(fbp); xfs_da_buf_done(fbp);
return 0; return 0;
......
...@@ -332,7 +332,7 @@ xfs_dir2_sf_addname( ...@@ -332,7 +332,7 @@ xfs_dir2_sf_addname(
/* /*
* Just checking or no space reservation, it doesn't fit. * Just checking or no space reservation, it doesn't fit.
*/ */
if (args->justcheck || args->total == 0) if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
return XFS_ERROR(ENOSPC); return XFS_ERROR(ENOSPC);
/* /*
* Convert to block form then add the name. * Convert to block form then add the name.
...@@ -345,7 +345,7 @@ xfs_dir2_sf_addname( ...@@ -345,7 +345,7 @@ xfs_dir2_sf_addname(
/* /*
* Just checking, it fits. * Just checking, it fits.
*/ */
if (args->justcheck) if (args->op_flags & XFS_DA_OP_JUSTCHECK)
return 0; return 0;
/* /*
* Do it the easy way - just add it at the end. * Do it the easy way - just add it at the end.
...@@ -869,7 +869,7 @@ xfs_dir2_sf_lookup( ...@@ -869,7 +869,7 @@ xfs_dir2_sf_lookup(
return XFS_ERROR(EEXIST); return XFS_ERROR(EEXIST);
} }
} }
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
/* /*
* Here, we can only be doing a lookup (not a rename or replace). * Here, we can only be doing a lookup (not a rename or replace).
* If a case-insensitive match was found earlier, return "found". * If a case-insensitive match was found earlier, return "found".
...@@ -1071,7 +1071,7 @@ xfs_dir2_sf_replace( ...@@ -1071,7 +1071,7 @@ xfs_dir2_sf_replace(
* Didn't find it. * Didn't find it.
*/ */
if (i == sfp->hdr.count) { if (i == sfp->hdr.count) {
ASSERT(args->oknoent); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
#if XFS_BIG_INUMS #if XFS_BIG_INUMS
if (i8elevated) if (i8elevated)
xfs_dir2_sf_toino4(args); xfs_dir2_sf_toino4(args);
......
...@@ -85,7 +85,8 @@ xfs_dir2_trace_args( ...@@ -85,7 +85,8 @@ xfs_dir2_trace_args(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, NULL, NULL); (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
NULL, NULL);
} }
void void
...@@ -100,7 +101,7 @@ xfs_dir2_trace_args_b( ...@@ -100,7 +101,7 @@ xfs_dir2_trace_args_b(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
(void *)(bp ? bp->bps[0] : NULL), NULL); (void *)(bp ? bp->bps[0] : NULL), NULL);
} }
...@@ -117,7 +118,7 @@ xfs_dir2_trace_args_bb( ...@@ -117,7 +118,7 @@ xfs_dir2_trace_args_bb(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
(void *)(lbp ? lbp->bps[0] : NULL), (void *)(lbp ? lbp->bps[0] : NULL),
(void *)(dbp ? dbp->bps[0] : NULL)); (void *)(dbp ? dbp->bps[0] : NULL));
} }
...@@ -157,8 +158,8 @@ xfs_dir2_trace_args_db( ...@@ -157,8 +158,8 @@ xfs_dir2_trace_args_db(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)(long)db, (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
(void *)dbp); (void *)(long)db, (void *)dbp);
} }
void void
...@@ -173,7 +174,7 @@ xfs_dir2_trace_args_i( ...@@ -173,7 +174,7 @@ xfs_dir2_trace_args_i(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
(void *)((unsigned long)(i >> 32)), (void *)((unsigned long)(i >> 32)),
(void *)((unsigned long)(i & 0xFFFFFFFF))); (void *)((unsigned long)(i & 0xFFFFFFFF)));
} }
...@@ -190,7 +191,8 @@ xfs_dir2_trace_args_s( ...@@ -190,7 +191,8 @@ xfs_dir2_trace_args_s(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)(long)s, NULL); (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
(void *)(long)s, NULL);
} }
void void
...@@ -208,7 +210,7 @@ xfs_dir2_trace_args_sb( ...@@ -208,7 +210,7 @@ xfs_dir2_trace_args_sb(
(void *)((unsigned long)(args->inumber >> 32)), (void *)((unsigned long)(args->inumber >> 32)),
(void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans, (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)(long)s, (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
(void *)dbp); (void *)(long)s, (void *)dbp);
} }
#endif /* XFS_DIR2_TRACE */ #endif /* XFS_DIR2_TRACE */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment