]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mounts and unmounts. vfs ops stubs
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 6 Dec 2007 17:10:46 +0000 (17:10 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 6 Dec 2007 17:10:46 +0000 (17:10 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2186 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/kernel/Makefile
trunk/ceph/kernel/addr.c [new file with mode: 0644]
trunk/ceph/kernel/bufferlist.h [deleted file]
trunk/ceph/kernel/dir.c [new file with mode: 0644]
trunk/ceph/kernel/file.c [new file with mode: 0644]
trunk/ceph/kernel/inode.c
trunk/ceph/kernel/mds_client.c
trunk/ceph/kernel/super.c
trunk/ceph/kernel/super.h

index 3f62291a3c1d3b33e497e0c14b0da6f4b56f841c..25a456ee8a52ecd6880cf91c10860c2f158d442e 100644 (file)
@@ -4,8 +4,8 @@
 
 obj-$(CONFIG_CEPH_FS) += ceph.o
 
-ceph-objs := super.o inode.o \
-       bufferlist.o ktcp.o messenger.o \
+ceph-objs := super.o inode.o dir.o file.o addr.o \
+       ktcp.o messenger.o \
        client.o \
        mds_client.o mdsmap.o \
        mon_client.o \
diff --git a/trunk/ceph/kernel/addr.c b/trunk/ceph/kernel/addr.c
new file mode 100644 (file)
index 0000000..beae8cd
--- /dev/null
@@ -0,0 +1,13 @@
+
+#include "super.h"
+
+/*
+static int ceph_vfs_readpage(struct file *filp, struct page *page)
+{
+
+}
+*/
+
+const struct address_space_operations ceph_aops = {
+//      .readpage = ceph_vfs_readpage,
+};
diff --git a/trunk/ceph/kernel/bufferlist.h b/trunk/ceph/kernel/bufferlist.h
deleted file mode 100644 (file)
index e154321..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _FS_CEPH_BUFFERLIST_H
-#define _FS_CEPH_BUFFERLIST_H
-
-#include <linux/uio.h>
-
-/*
- * quick and dirty bufferlist struct.
- *
- * preallocates memory in large chunks, allowing you to append small bits at a
- * time in a reasonably efficient fashion...
- */
-
-#define CEPH_BUFFERLIST_START_KVLEN  8  /* embed some statically, for fast normal case */
-
-struct ceph_bufferlist {
-       struct kvec *b_kv;   /* data payload */
-       struct kvec b_kv_array[CEPH_BUFFERLIST_START_KVLEN];  
-       size_t b_kvlen;          /* used/defined elements in b_kv */         
-       size_t b_kvmax;          /* allocated size of b_kv array */
-       size_t b_len;            /* size in bytes of _entire_ bufferlist */
-       struct kvec b_append; /* preallocated memory for appending data to this bufferlist */
-};
-
-struct ceph_bufferlist_iterator {
-       int i_kv;  /* which kv */
-       int i_off;  /* offset in that kv */
-};
-
-extern void ceph_bl_init(struct ceph_bufferlist *bl);
-extern void ceph_bl_clear(struct ceph_bufferlist *bl);
-extern void ceph_bl_append_ref(struct ceph_bufferlist *bl, void *dp, int len);
-extern void ceph_bl_append_copy(struct ceph_bufferlist *bl, void *p, size_t len);
-extern void ceph_bl_append_copied(struct ceph_bufferlist *bl, size_t len);
-extern void ceph_bl_prepare_append(struct ceph_bufferlist *bl, int len);
-
-extern void ceph_bl_iterator_init(struct ceph_bufferlist_iterator *bli);
-
-extern int ceph_bl_copy(struct ceph_bufferlist *bl, struct ceph_bufferlist_iterator *bli, void *p, int len);
-
-extern void ceph_bl_iterator_advance(struct ceph_bufferlist *bl, 
-                                    struct ceph_bufferlist_iterator *bli, 
-                                    int off);
-extern int ceph_bl_decode_have(struct ceph_bufferlist *bl, struct ceph_bufferlist_iterator *bli, int s);
-
-extern int ceph_bl_decode_64(struct ceph_bufferlist *bl, struct ceph_bufferlist_iterator *bli, __u64 *v);
-extern int ceph_bl_decode_32(struct ceph_bufferlist *bl, struct ceph_bufferlist_iterator *bli, __u32 *v);
-extern int ceph_bl_decode_16(struct ceph_bufferlist *bl, struct ceph_bufferlist_iterator *bli, __u16 *v);
-extern int ceph_bl_decode_8(struct ceph_bufferlist *bl, struct ceph_bufferlist_iterator *bli, __u8 *v);
-
-
-
-#endif
diff --git a/trunk/ceph/kernel/dir.c b/trunk/ceph/kernel/dir.c
new file mode 100644 (file)
index 0000000..67d4090
--- /dev/null
@@ -0,0 +1,36 @@
+
+#include "super.h"
+
+const struct inode_operations ceph_dir_iops;
+const struct file_operations ceph_dir_fops;
+
+/*
+static int ceph_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
+{
+}
+
+int ceph_dir_release(struct inode *inode, struct file *filp)
+{
+}
+*/
+
+const struct inode_operations ceph_dir_iops = {
+/*     .create = ceph_vfs_create,
+       .lookup = ceph_vfs_lookup,
+       .unlink = ceph_vfs_unlink,
+       .mkdir = ceph_vfs_mkdir,
+       .rmdir = ceph_vfs_rmdir,
+       .mknod = ceph_vfs_mknod,
+       .rename = ceph_vfs_rename,
+       .getattr = ceph_vfs_getattr,
+       .setattr = ceph_vfs_setattr,
+*/
+};
+
+const struct file_operations ceph_dir_fops = {
+/*     .read = generic_read_dir,
+       .readdir = ceph_dir_readdir,
+//     .open = ceph_file_open,
+       .release = ceph_dir_release,
+*/
+};
diff --git a/trunk/ceph/kernel/file.c b/trunk/ceph/kernel/file.c
new file mode 100644 (file)
index 0000000..31f44c5
--- /dev/null
@@ -0,0 +1,44 @@
+
+#include "super.h"
+
+/*
+static ssize_t
+ceph_file_read(struct file *filp, char __user * data, size_t count,
+              loff_t * offset)
+{
+}
+
+
+static ssize_t
+ceph_file_write(struct file *filp, const char __user * data,
+               size_t count, loff_t * offset)
+{
+}
+
+
+int ceph_file_open(struct inode *inode, struct file *file)
+{
+}
+
+
+static int ceph_file_lock(struct file *filp, int cmd, struct file_lock *fl)
+{
+}
+*/
+
+const struct inode_operations ceph_file_iops = {
+/*     .getattr = ceph_vfs_getattr,
+       .setattr = ceph_vfs_setattr,
+*/
+};
+
+const struct file_operations ceph_file_fops = {
+/*     .llseek = generic_file_llseek,
+       .read = ceph_file_read,
+       .write = ceph_file_write,
+       .open = ceph_file_open,
+//     .release = ceph_dir_release,
+       .lock = ceph_file_lock,
+       .mmap = generic_file_mmap,
+*/
+};
index 946c9e28ac23c79dbfa2d6c8bd092cddfeac628a..8f9a951d61ffdee863b876c9e0705696527f8296 100644 (file)
@@ -7,3 +7,163 @@
 
 #include "super.h"
 
+const struct inode_operations ceph_symlink_iops;
+
+struct inode *ceph_new_inode(struct super_block *sb, 
+                            struct ceph_mds_reply_inode *info) {
+       struct inode *inode;
+       
+       inode = new_inode(sb);
+       if (inode == NULL)
+               return ERR_PTR(-ENOMEM);
+       
+       inode->i_ino = le64_to_cpu(info->ino);
+       inode->i_mode = le32_to_cpu(info->mode) | S_IFDIR;
+       inode->i_uid = le32_to_cpu(info->uid);
+       inode->i_gid = le32_to_cpu(info->gid);
+       inode->i_nlink = le32_to_cpu(info->nlink);
+       inode->i_size = le64_to_cpu(info->size);
+       inode->i_rdev = le32_to_cpu(info->rdev);
+       inode->i_blocks = 0;
+       inode->i_rdev = 0;
+       dout(30, "new_inode ino=%lx by %d.%d sz=%llu\n", inode->i_ino,
+            inode->i_uid, inode->i_gid, inode->i_size);
+       
+       ceph_decode_timespec(&inode->i_atime, &info->atime);
+       ceph_decode_timespec(&inode->i_mtime, &info->mtime);
+       ceph_decode_timespec(&inode->i_ctime, &info->ctime);
+
+#if 0
+       /* ceph inode */
+       ci->i_layout = info->layout;  /* swab? */
+
+       if (le32_to_cpu(info->fragtree.nsplits) == 0) {
+               ci->i_fragtree = ci->i_fragtree_static;
+       } else {
+               //ci->i_fragtree = kmalloc(...);
+               BUG_ON(1); // write me
+       }
+       ci->i_fragtree->nsplits = le32_to_cpu(info->fragtree.nsplits);
+       for (i=0; i<ci->i_fragtree->nsplits; i++)
+               ci->i_fragtree->splits[i] = le32_to_cpu(info->fragtree.splits[i]);
+
+       ci->i_frag_map_nr = 1;
+       ci->i_frag_map = ci->i_frag_map_static;
+       ci->i_frag_map[0].frag = 0;
+       ci->i_frag_map[0].mds = 0; /* fixme */
+       
+       ci->i_nr_caps = 0;
+       ci->i_caps = ci->i_caps_static;
+       ci->i_wr_size = 0;
+       ci->i_wr_mtime.tv_sec = 0;
+       ci->i_wr_mtime.tv_usec = 0;
+#endif
+
+       inode->i_mapping->a_ops = &ceph_aops;
+
+       switch (inode->i_mode & S_IFMT) {
+       case S_IFIFO:
+       case S_IFBLK:
+       case S_IFCHR:
+       case S_IFSOCK:
+               init_special_inode(inode, inode->i_mode, inode->i_rdev);
+               break;
+       case S_IFREG:
+               inode->i_op = &ceph_file_iops;
+               inode->i_fop = &ceph_file_fops;
+               break;
+       case S_IFLNK:
+               inode->i_op = &ceph_symlink_iops;
+               break;
+       case S_IFDIR:
+               inc_nlink(inode);
+               inode->i_op = &ceph_dir_iops;
+               inode->i_fop = &ceph_dir_fops;
+               break;
+       default:
+               derr(0, "BAD mode 0x%x S_IFMT 0x%x\n",
+                    inode->i_mode, inode->i_mode & S_IFMT);
+               return ERR_PTR(-EINVAL);
+       }
+
+       return inode;
+}
+
+/*
+static int
+ceph_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
+               struct nameidata *nd)
+{
+}
+
+static int ceph_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+{
+}
+
+static struct dentry *ceph_vfs_lookup(struct inode *dir, struct dentry *dentry,
+                                     struct nameidata *nameidata)
+{
+}
+
+static int ceph_vfs_unlink(struct inode *i, struct dentry *d)
+{
+}
+
+static int ceph_vfs_rmdir(struct inode *i, struct dentry *d)
+{
+}
+
+static int
+ceph_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
+               struct inode *new_dir, struct dentry *new_dentry)
+{
+}
+
+static int
+ceph_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
+                struct kstat *stat)
+{
+}
+
+static int ceph_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
+{
+}
+
+static int ceph_vfs_readlink(struct dentry *dentry, char __user * buffer,
+                            int buflen)
+{
+}
+
+static void *ceph_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+}
+
+static void ceph_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
+{
+}
+
+static int
+ceph_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
+{
+}
+
+static int
+ceph_vfs_link(struct dentry *old_dentry, struct inode *dir,
+             struct dentry *dentry)
+{
+}
+
+static int
+ceph_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
+{
+}
+*/
+
+const struct inode_operations ceph_symlink_iops = {
+/*     .readlink = ceph_vfs_readlink,
+       .follow_link = ceph_vfs_follow_link,
+       .put_link = ceph_vfs_put_link,
+       .getattr = ceph_vfs_getattr,
+       .setattr = ceph_vfs_setattr,
+*/
+};
index 36f63feac85acf4252725d61ad16fbebcf3231a2..1e0a68b2df96fdb0a1eee14ae6737d4b3b754516 100644 (file)
@@ -570,55 +570,6 @@ void ceph_mdsc_destroy_reply_info(struct ceph_mds_reply_info *info)
 }
 
 
-void ceph_mdsc_fill_inode(struct inode *inode, struct ceph_mds_reply_inode *info)
-{
-       struct ceph_inode_info *ci = CEPH_I(inode);
-       int mask = le32_to_cpu(info->mask);
-       int i;
-
-       /* vfs inode */
-       inode->i_ino = le64_to_cpu(info->ino);
-       inode->i_mode = le32_to_cpu(info->mode) | S_IFDIR;
-       inode->i_uid = le32_to_cpu(info->uid);
-       inode->i_gid = le32_to_cpu(info->gid);
-       inode->i_nlink = le32_to_cpu(info->nlink);
-       inode->i_size = le64_to_cpu(info->size);
-       inode->i_rdev = le32_to_cpu(info->rdev);
-
-       dout(30, "mdsc fill_inode ino=%lx by %d.%d sz=%llu\n", inode->i_ino,
-            inode->i_uid, inode->i_gid, inode->i_size);
-       
-       ceph_decode_timespec(&inode->i_atime, &info->atime);
-       ceph_decode_timespec(&inode->i_mtime, &info->mtime);
-       ceph_decode_timespec(&inode->i_ctime, &info->ctime);
-       
-       /* ceph inode */
-       ci->i_layout = info->layout;  /* swab? */
-
-       if (le32_to_cpu(info->fragtree.nsplits) == 0) {
-               ci->i_fragtree = ci->i_fragtree_static;
-       } else {
-               //ci->i_fragtree = kmalloc(...);
-               BUG_ON(1); // write me
-       }
-       ci->i_fragtree->nsplits = le32_to_cpu(info->fragtree.nsplits);
-       for (i=0; i<ci->i_fragtree->nsplits; i++)
-               ci->i_fragtree->splits[i] = le32_to_cpu(info->fragtree.splits[i]);
-
-       ci->i_frag_map_nr = 1;
-       ci->i_frag_map = ci->i_frag_map_static;
-       ci->i_frag_map[0].frag = 0;
-       ci->i_frag_map[0].mds = 0; /* fixme */
-       
-       ci->i_nr_caps = 0;
-       ci->i_caps = ci->i_caps_static;
-       ci->i_wr_size = 0;
-       ci->i_wr_mtime.tv_sec = 0;
-       ci->i_wr_mtime.tv_usec = 0;
-}
-
-
-
 void ceph_mdsc_handle_forward(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
 {
        struct ceph_mds_request *req;
index b5477214f34577ba828c3d98e406a5ed56b94b5d..7cd83ba8934bc56a7fa40b1486f93e17736e52e3 100644 (file)
@@ -363,13 +363,12 @@ static int open_root_inode(struct super_block *sb, struct ceph_mount_args *args)
        rootinfo = &rinfo.trace_in[rinfo.trace_nr-1];
                
        /* construct root inode */
-       inode = new_inode(sb);
+       inode = ceph_new_inode(sb, rootinfo->in);
        if (!inode) {
                err = -ENOMEM;
                goto out;
        }
-       dout(30, "open_root_inode filling inode\n");
-       ceph_mdsc_fill_inode(inode, rootinfo->in);
+
        root = d_alloc_root(inode);
        if (!root) {
                err = -ENOMEM;
index 7940296e5428dd0b8e41d1301952d50b95c72e30..a05eaac026af6404c5d10c01613e070b62def135 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _FS_CEPH_CEPH_H
-#define _FS_CEPH_CEPH_H
+#ifndef _FS_CEPH_SUPER_H
+#define _FS_CEPH_SUPER_H
 
 #include <linux/ceph_fs.h>
 #include <linux/fs.h>
@@ -67,7 +67,7 @@ struct ceph_inode_info {
        off_t i_wr_size;
        struct ceph_timeval i_wr_mtime;
        
-       struct inode vfs_inode;
+       struct inode vfs_inode; /* at end */
 };
 
 static inline struct ceph_inode_info *CEPH_I(struct inode *inode)
@@ -75,15 +75,20 @@ static inline struct ceph_inode_info *CEPH_I(struct inode *inode)
        return list_entry(inode, struct ceph_inode_info, vfs_inode);
 }
 
+/* inode.c */
+extern struct inode *ceph_new_inode(struct super_block *sb, 
+                                   struct ceph_mds_reply_inode *info);
 
+/* addr.c */
+extern const struct address_space_operations ceph_aops;
 
 /* file.c */
-extern const struct inode_operations ceph_file_inops;
-extern const struct file_operations ceph_file_operations;
+extern const struct inode_operations ceph_file_iops;
+extern const struct file_operations ceph_file_fops;
 extern const struct address_space_operations ceph_aops;
 
 /* dir.c */
-extern const struct inode_operations ceph_dir_inops;
-extern const struct file_operations ceph_dir_operations;
+extern const struct inode_operations ceph_dir_iops;
+extern const struct file_operations ceph_dir_fops;
 
 #endif /* _FS_CEPH_CEPH_H */