err = -EINVAL;
goto out;
}
-
+
if (client->sb->s_root == NULL) {
/* get the fs root inode. Note that this is not necessarily the root of
the mount */
err = ceph_get_inode(client->sb, le64_to_cpu(rinfo.trace_in[0].in->ino), &root_inode);
if (err < 0)
goto out;
+
alloc_fs = 1;
client->sb->s_root = d_alloc_root(root_inode);
const struct inode_operations ceph_dir_iops = {
.lookup = ceph_dir_lookup,
-// .getattr = ceph_inode_getattr,
+ .getattr = ceph_inode_getattr,
.setattr = ceph_setattr,
.mknod = ceph_dir_mknod,
.symlink = ceph_dir_symlink,
int ceph_get_inode(struct super_block *sb, unsigned long ino, struct inode **pinode)
{
+ struct ceph_inode_info *ci;
+
BUG_ON(pinode == NULL);
*pinode = iget_locked(sb, ino);
if ((*pinode)->i_state & I_NEW)
unlock_new_inode(*pinode);
+ ci = ceph_inode(*pinode);
+
+ ci->i_hashval = ino;
+
return 0;
}
inode->i_rdev = le32_to_cpu(info->rdev);
inode->i_blocks = 1;
- insert_inode_hash(inode);
+ if (ci->i_hashval != inode->i_ino) {
+ insert_inode_hash(inode);
+ ci->i_hashval = inode->i_ino;
+ }
dout(30, "fill_inode %p ino=%lx by %d.%d sz=%llu mode %o nlink %d\n", inode,
inode->i_ino, inode->i_uid, inode->i_gid, inode->i_size, inode->i_mode,
return 0;
}
+int ceph_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
+{
+ dout(30, "ceph_inode_getattr\n");
+
+ /* TODO: need to revalidate first */
+ generic_fillattr(dentry->d_inode, stat);
+ stat->blksize = CEPH_BLKSIZE;
+ return 0;
+}
+
#define CEPH_SUPER_MAGIC 0xc364c0de /* whatev */
+#define CEPH_BLKSIZE 4096
+
/*
* mount options
*/
loff_t i_wr_size;
struct timespec i_wr_mtime;
struct timespec i_old_atime;
+
+ unsigned long i_hashval;
struct inode vfs_inode; /* at end */
};
extern int ceph_handle_cap_grant(struct inode *inode, struct ceph_mds_file_caps *grant, struct ceph_mds_session *session);
extern int ceph_setattr(struct dentry *dentry, struct iattr *attr);
+extern int ceph_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
/* addr.c */
extern const struct address_space_operations ceph_aops;