return rval;
}
+int
+xfs_dir_replace_args(
+ struct xfs_da_args *args)
+{
+ bool is_block, is_leaf;
+ int error;
+
+ if (args->dp->i_df.if_format == XFS_DINODE_FMT_LOCAL)
+ return xfs_dir2_sf_replace(args);
+
+ error = xfs_dir2_isblock(args, &is_block);
+ if (error)
+ return error;
+ if (is_block)
+ return xfs_dir2_block_replace(args);
+
+ error = xfs_dir2_isleaf(args, &is_leaf);
+ if (error)
+ return error;
+ if (is_leaf)
+ return xfs_dir2_leaf_replace(args);
+
+ return xfs_dir2_node_replace(args);
+}
+
/*
* Replace the inode number of a directory entry.
*/
{
struct xfs_da_args *args;
int rval;
- bool v;
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
args->whichfork = XFS_DATA_FORK;
args->trans = tp;
args->owner = dp->i_ino;
-
- if (dp->i_df.if_format == XFS_DINODE_FMT_LOCAL) {
- rval = xfs_dir2_sf_replace(args);
- goto out_free;
- }
-
- rval = xfs_dir2_isblock(args, &v);
- if (rval)
- goto out_free;
- if (v) {
- rval = xfs_dir2_block_replace(args);
- goto out_free;
- }
-
- rval = xfs_dir2_isleaf(args, &v);
- if (rval)
- goto out_free;
- if (v)
- rval = xfs_dir2_leaf_replace(args);
- else
- rval = xfs_dir2_node_replace(args);
-out_free:
+ rval = xfs_dir_replace_args(args);
kfree(args);
return rval;
}
int xfs_dir_lookup_args(struct xfs_da_args *args);
int xfs_dir_createname_args(struct xfs_da_args *args);
int xfs_dir_removename_args(struct xfs_da_args *args);
+int xfs_dir_replace_args(struct xfs_da_args *args);
/*
* Direct call from the bmap code, bypassing the generic directory layer.
xfs_extlen_t total)
{
struct xfs_scrub *sc = rd->sc;
- bool is_block, is_leaf;
int error;
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
xrep_dir_init_args(rd, dp, name);
rd->args.inumber = inum;
rd->args.total = total;
-
- if (dp->i_df.if_format == XFS_DINODE_FMT_LOCAL)
- return xfs_dir2_sf_replace(&rd->args);
-
- error = xfs_dir2_isblock(&rd->args, &is_block);
- if (error)
- return error;
- if (is_block)
- return xfs_dir2_block_replace(&rd->args);
-
- error = xfs_dir2_isleaf(&rd->args, &is_leaf);
- if (error)
- return error;
- if (is_leaf)
- return xfs_dir2_leaf_replace(&rd->args);
-
- return xfs_dir2_node_replace(&rd->args);
+ return xfs_dir_replace_args(&rd->args);
}
/*