summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/parent_repair.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/parent_repair.c')
-rw-r--r--fs/xfs/scrub/parent_repair.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/xfs/scrub/parent_repair.c b/fs/xfs/scrub/parent_repair.c
index 9dc48d496af6..aa196acb5600 100644
--- a/fs/xfs/scrub/parent_repair.c
+++ b/fs/xfs/scrub/parent_repair.c
@@ -172,6 +172,37 @@ out_rele:
return error;
}
+/* Does the dcache have a parent for this directory? */
+xfs_ino_t
+xrep_parent_check_dcache(
+ struct xfs_inode *dp)
+{
+ struct inode *pip = NULL;
+ struct dentry *dentry, *parent;
+ xfs_ino_t ret = NULLFSINO;
+
+ ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
+
+ dentry = d_find_alias(VFS_I(dp));
+ if (!dentry)
+ goto out;
+
+ parent = dget_parent(dentry);
+ if (!parent)
+ goto out_dput;
+
+ pip = igrab(d_inode(parent));
+ dput(parent);
+
+ ret = pip->i_ino;
+ xfs_irele(XFS_I(pip));
+
+out_dput:
+ dput(dentry);
+out:
+ return ret;
+}
+
/* Is this an acceptable parent for the inode we're scrubbing? */
bool
xrep_parent_acceptable(