NULL /* remount_fs */
};
+struct list_head obdfs_super_list;
+
static char *obdfs_read_opt(const char *opt, char *data)
{
char *value;
return 0;
}
+
+/* XXX allocate a super_entry, and add the super to the obdfs_super_list */
static struct super_block * obdfs_read_super(struct super_block *sb,
void *data, int silent)
{
return NULL;
}
+/* XXX remove the super to the obdfs_super_list */
static void obdfs_put_super(struct super_block *sb)
{
struct obdfs_sb_info *sbi;
EXIT;
}
+inline int obdfs_has_inline(struct inode *inode)
+{
+ struct obdfs_inode_info *oinfo = inode->u.generic_ip;
+
+ return (oinfo->oi_flags & OBD_FL_INLINEDATA);
+}
+
+void inline obdfs_from_inode(struct obdo *oa, struct inode *inode)
+{
+ struct obdfs_inode_info *oinfo = inode->u.generic_ip;
+
+ obdo_from_inode(oa, inode);
+ if (obdfs_has_inline(inode)) {
+ memcpy(oa->o_inline, oinfo->oi_inline, OBD_INLINESZ);
+ oa->o_flags |= OBD_FL_INLINEDATA;
+ }
+}
+
+void inline obdfs_to_inode(struct inode *inode, struct obdo *oa)
+{
+ struct obdfs_inode_info *oinfo = inode->u.generic_ip;
+
+ obdo_to_inode(inode, oa);
+ if (obdo_has_inline(oa)) {
+ memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
+ oinfo->oi_flags |= OBD_FL_INLINEDATA;
+ }
+}
+
/* all filling in of inodes postponed until lookup */
void obdfs_read_inode(struct inode *inode)
{
- int error;
- ENTRY;
+ struct obdo *oa;
+ int err;
- error = IOPS(inode, getattr)(IID(inode), inode);
- if (error) {
- printk("obdfs_read_inode: obd_getattr fails (%d)\n", error);
+ ENTRY;
+ oa = obdo_alloc();
+ if (!oa) {
+ printk("obdfs_read_inode: obdo_alloc failed\n");
+ EXIT;
return;
}
- CDEBUG(D_INODE, "ino %ld, mode: %o\n", inode->i_ino, inode->i_mode);
+ oa->o_valid = ~OBD_MD_FLOBDMD;
+ oa->o_id = inode->i_ino;
+ err = IOPS(inode, getattr)(IID(inode), oa);
+ if (err) {
+ printk("obdfs_read_inode: obd_getattr fails (%d)\n", err);
+ obdo_free(oa);
+ EXIT;
+ return;
+ }
+
+ ODEBUG(oa);
+ obdfs_to_inode(inode, oa);
+ obdo_free(oa);
IDEBUG(inode);
+
if (S_ISREG(inode->i_mode))
inode->i_op = &obdfs_file_inode_operations;
else if (S_ISDIR(inode->i_mode))
static void obdfs_write_inode(struct inode *inode)
{
- int error;
+ struct obdo *oa;
+ int err;
- error = IOPS(inode, setattr)(IID(inode), inode);
- if (error) {
- printk("obdfs_write_inode: obd_setattr fails (%d)\n", error);
+ oa = obdo_alloc();
+ oa->o_valid = OBD_MD_FLALL;
+ obdfs_from_inode(oa, inode);
+ err = IOPS(inode, setattr)(IID(inode), oa);
+
+ obdo_free(oa);
+
+ if (err) {
+ printk("obdfs_write_inode: obd_setattr fails (%d)\n", err);
return;
}
static void obdfs_delete_inode(struct inode *inode)
{
- int error;
+ struct obdo *oa;
+ int err;
ENTRY;
- error = IOPS(inode, destroy)(IID(inode), inode);
- if (error) {
- printk("obdfs_delete_node: ibd_destroy fails (%d)\n", error);
+ oa = obdo_alloc();
+ /* XXX we currently assume "id" is all that's needed for destroy */
+ oa->o_id = inode->i_ino;
+ err = IOPS(inode, destroy)(IID(inode), oa);
+ obdo_free(oa);
+
+ if (err) {
+ printk("obdfs_delete_node: obd_destroy fails (%d)\n", err);
return;
}
EXIT;
}
-static int obdfs_notify_change(struct dentry *de, struct iattr *iattr)
+
+
+
+static int obdfs_notify_change(struct dentry *de, struct iattr *attr)
{
struct inode *inode = de->d_inode;
- struct iattr saved_copy;
- int error;
+ struct obdo *oa;
+ int err;
ENTRY;
- inode_to_iattr(inode, &saved_copy);
+ oa = obdo_alloc();
+ if (!oa) {
+ printk("obdfs_notify_change: obdo_alloc fails\n");
+ return -ENOMEM;
+ }
- inode_setattr(inode, iattr);
- error = IOPS(inode, setattr)(IID(inode), inode);
- if ( error ) {
- inode_setattr(inode, &saved_copy);
- printk("obdfs_notify_change: obd_setattr fails (%d)\n", error);
- return error;
+ oa->o_id = inode->i_ino;
+ obdo_from_iattr(oa, attr);
+ err = IOPS(inode, setattr)(IID(inode), oa);
+ obdo_free(oa);
+
+ if ( err ) {
+ printk("obdfs_notify_change: obd_setattr fails (%d)\n", err);
+ return err;
}
+ inode_setattr(inode, attr);
CDEBUG(D_INODE, "inode blocks now %ld\n", inode->i_blocks);
EXIT;
- return error;
+ return err;
}
int bufsize)
{
struct statfs tmp;
- int error;
+ int err;
ENTRY;
- error = OPS(sb,statfs)(ID(sb), &tmp);
- if ( error ) {
- printk("obdfs_notify_change: obd_statfs fails (%d)\n", error);
- return error;
+ err = OPS(sb,statfs)(ID(sb), &tmp);
+ if ( err ) {
+ printk("obdfs_notify_change: obd_statfs fails (%d)\n", err);
+ return err;
}
copy_to_user(buf, &tmp, (bufsize<sizeof(tmp)) ? bufsize : sizeof(tmp));
EXIT;
- return error;
+ return err;
}
struct file_system_type obdfs_fs_type = {
obdfs_sysctl_init();
+ INIT_LIST_HEAD(&obdfs_super_list);
err = obdfs_init_wreqcache();
if (err)
return err;
+ /* XXX
+ flushd_init();
+ */
+
return register_filesystem(&obdfs_fs_type);
}
ENTRY;
obdfs_sysctl_clean();
+ obdfs_cleanup_wreqcache();
unregister_filesystem(&obdfs_fs_type);
}