diff options
author | Barry Naujok <bnaujok@sgi.com> | 2008-05-21 02:42:05 -0400 |
---|---|---|
committer | Niv Sardi <xaiki@debian.org> | 2008-07-28 02:58:37 -0400 |
commit | 6a178100abf01282eb697ab62b6086b2886dfc00 (patch) | |
tree | 5830f1257fc9662c0f9dcd107eda5377de716a4c /fs/xfs/xfs_dir2_node.c | |
parent | 5163f95a08cbf058ae16452c2242c5600fedc32e (diff) |
[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: Barry Naujok <bnaujok@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs/xfs_dir2_node.c')
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index fedf8f976a10..c71cff85950c 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -226,7 +226,7 @@ xfs_dir2_leafn_add( | |||
226 | ASSERT(index == be16_to_cpu(leaf->hdr.count) || | 226 | ASSERT(index == be16_to_cpu(leaf->hdr.count) || |
227 | be32_to_cpu(leaf->ents[index].hashval) >= args->hashval); | 227 | be32_to_cpu(leaf->ents[index].hashval) >= args->hashval); |
228 | 228 | ||
229 | if (args->justcheck) | 229 | if (args->op_flags & XFS_DA_OP_JUSTCHECK) |
230 | return 0; | 230 | return 0; |
231 | 231 | ||
232 | /* | 232 | /* |
@@ -515,7 +515,7 @@ xfs_dir2_leafn_lookup_for_addname( | |||
515 | /* Didn't find any space */ | 515 | /* Didn't find any space */ |
516 | fi = -1; | 516 | fi = -1; |
517 | out: | 517 | out: |
518 | ASSERT(args->oknoent); | 518 | ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); |
519 | if (curbp) { | 519 | if (curbp) { |
520 | /* Giving back a free block. */ | 520 | /* Giving back a free block. */ |
521 | state->extravalid = 1; | 521 | state->extravalid = 1; |
@@ -638,7 +638,8 @@ xfs_dir2_leafn_lookup_for_entry( | |||
638 | /* Didn't find an exact match. */ | 638 | /* Didn't find an exact match. */ |
639 | error = ENOENT; | 639 | error = ENOENT; |
640 | di = -1; | 640 | di = -1; |
641 | ASSERT(index == be16_to_cpu(leaf->hdr.count) || args->oknoent); | 641 | ASSERT(index == be16_to_cpu(leaf->hdr.count) || |
642 | (args->op_flags & XFS_DA_OP_OKNOENT)); | ||
642 | out: | 643 | out: |
643 | if (curbp) { | 644 | if (curbp) { |
644 | /* Giving back a data block. */ | 645 | /* Giving back a data block. */ |
@@ -669,7 +670,7 @@ xfs_dir2_leafn_lookup_int( | |||
669 | int *indexp, /* out: leaf entry index */ | 670 | int *indexp, /* out: leaf entry index */ |
670 | xfs_da_state_t *state) /* state to fill in */ | 671 | xfs_da_state_t *state) /* state to fill in */ |
671 | { | 672 | { |
672 | if (args->addname) | 673 | if (args->op_flags & XFS_DA_OP_ADDNAME) |
673 | return xfs_dir2_leafn_lookup_for_addname(bp, args, indexp, | 674 | return xfs_dir2_leafn_lookup_for_addname(bp, args, indexp, |
674 | state); | 675 | state); |
675 | return xfs_dir2_leafn_lookup_for_entry(bp, args, indexp, state); | 676 | return xfs_dir2_leafn_lookup_for_entry(bp, args, indexp, state); |
@@ -1383,7 +1384,7 @@ xfs_dir2_node_addname( | |||
1383 | /* | 1384 | /* |
1384 | * It worked, fix the hash values up the btree. | 1385 | * It worked, fix the hash values up the btree. |
1385 | */ | 1386 | */ |
1386 | if (!args->justcheck) | 1387 | if (!(args->op_flags & XFS_DA_OP_JUSTCHECK)) |
1387 | xfs_da_fixhashpath(state, &state->path); | 1388 | xfs_da_fixhashpath(state, &state->path); |
1388 | } else { | 1389 | } else { |
1389 | /* | 1390 | /* |
@@ -1566,7 +1567,8 @@ xfs_dir2_node_addname_int( | |||
1566 | /* | 1567 | /* |
1567 | * Not allowed to allocate, return failure. | 1568 | * Not allowed to allocate, return failure. |
1568 | */ | 1569 | */ |
1569 | if (args->justcheck || args->total == 0) { | 1570 | if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || |
1571 | args->total == 0) { | ||
1570 | /* | 1572 | /* |
1571 | * Drop the freespace buffer unless it came from our | 1573 | * Drop the freespace buffer unless it came from our |
1572 | * caller. | 1574 | * caller. |
@@ -1712,7 +1714,7 @@ xfs_dir2_node_addname_int( | |||
1712 | /* | 1714 | /* |
1713 | * If just checking, we succeeded. | 1715 | * If just checking, we succeeded. |
1714 | */ | 1716 | */ |
1715 | if (args->justcheck) { | 1717 | if (args->op_flags & XFS_DA_OP_JUSTCHECK) { |
1716 | if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL) | 1718 | if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL) |
1717 | xfs_da_buf_done(fbp); | 1719 | xfs_da_buf_done(fbp); |
1718 | return 0; | 1720 | return 0; |