@@ -1247,3 +1247,27 @@ void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc)
kfree(sm);
}
}
+
+/*
+ * Get the parent inode for the snap directory ".snap",
+ * if the inode is not a snap directory just return it
+ * with the reference increased.
+ */
+struct inode *ceph_get_snap_parent_inode(struct inode *inode)
+{
+ struct inode *pinode;
+
+ if (ceph_snap(inode) == CEPH_SNAPDIR) {
+ struct ceph_vino vino = {
+ .ino = ceph_ino(inode),
+ .snap = CEPH_NOSNAP,
+ };
+ pinode = ceph_find_inode(inode->i_sb, vino);
+ BUG_ON(!pinode);
+ } else {
+ ihold(inode);
+ pinode = inode;
+ }
+
+ return pinode;
+}
@@ -969,6 +969,7 @@ extern void ceph_put_snapid_map(struct ceph_mds_client* mdsc,
struct ceph_snapid_map *sm);
extern void ceph_trim_snapid_map(struct ceph_mds_client *mdsc);
extern void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc);
+extern struct inode *ceph_get_snap_parent_inode(struct inode *inode);
void ceph_umount_begin(struct super_block *sb);