@@ -440,7 +440,7 @@ int
xfs_dir_removename(
struct xfs_trans *tp,
struct xfs_inode *dp,
- struct xfs_name *name,
+ const struct xfs_name *name,
xfs_ino_t ino,
xfs_extlen_t total) /* bmap's total block count */
{
@@ -55,7 +55,7 @@ extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
const struct xfs_name *name, xfs_ino_t *inum,
struct xfs_name *ci_name);
extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
- struct xfs_name *name, xfs_ino_t ino,
+ const struct xfs_name *name, xfs_ino_t ino,
xfs_extlen_t tot);
extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
const struct xfs_name *name, xfs_ino_t inum,
@@ -420,3 +420,49 @@ xfs_parent_lookup(
return xfs_attr_get_ilocked(&scr->args);
}
+
+/*
+ * Attach the parent pointer (@pptr -> @name) to @ip immediately. Caller must
+ * not have a transaction or hold the ILOCK. This is for specialized repair
+ * functions only. The scratchpad need not be initialized.
+ */
+int
+xfs_parent_set(
+ struct xfs_inode *ip,
+ const struct xfs_parent_name_irec *pptr,
+ struct xfs_parent_scratch *scr)
+{
+ if (XFS_IS_CORRUPT(ip->i_mount,
+ !xfs_parent_verify_irec(ip->i_mount, pptr))) {
+ return -EFSCORRUPTED;
+ }
+
+ xfs_parent_irec_to_disk(&scr->rec, pptr);
+ xfs_parent_scratch_init(NULL, ip, pptr, scr);
+ scr->args.op_flags |= XFS_DA_OP_LOGGED;
+
+ return xfs_attr_set(&scr->args);
+}
+
+/*
+ * Remove the parent pointer (@rec -> @name) from @ip immediately. Caller must
+ * not have a transaction or hold the ILOCK. This is for specialized repair
+ * functions only. The scratchpad need not be initialized.
+ */
+int
+xfs_parent_unset(
+ struct xfs_inode *ip,
+ const struct xfs_parent_name_irec *pptr,
+ struct xfs_parent_scratch *scr)
+{
+ if (XFS_IS_CORRUPT(ip->i_mount,
+ !xfs_parent_verify_irec(ip->i_mount, pptr))) {
+ return -EFSCORRUPTED;
+ }
+
+ xfs_parent_irec_to_disk(&scr->rec, pptr);
+ xfs_parent_scratch_init(NULL, ip, pptr, scr);
+ scr->args.op_flags |= XFS_DA_OP_LOGGED | XFS_DA_OP_REMOVE;
+
+ return xfs_attr_set(&scr->args);
+}
@@ -162,4 +162,12 @@ int xfs_parent_lookup(struct xfs_trans *tp, struct xfs_inode *ip,
const struct xfs_parent_name_irec *pptr,
struct xfs_parent_scratch *scratch);
+int xfs_parent_set(struct xfs_inode *ip,
+ const struct xfs_parent_name_irec *pptr,
+ struct xfs_parent_scratch *scratch);
+
+int xfs_parent_unset(struct xfs_inode *ip,
+ const struct xfs_parent_name_irec *rec,
+ struct xfs_parent_scratch *scratch);
+
#endif /* __XFS_PARENT_H__ */