Whamcloud - gitweb
- added a 'dying' head to fix very bad bug in yesterday's request code
[fs/lustre-release.git] / lustre / mds / mds_ext2.c
index 4649322..dcc887a 100644 (file)
@@ -21,7 +21,7 @@
 
 static void *mds_ext2_start(struct inode *inode, int nblocks)
 {
-        return 0;
+        return (void *)1;
 }
 
 static int mds_ext2_stop(struct inode *inode, void *handle)
@@ -29,14 +29,16 @@ static int mds_ext2_stop(struct inode *inode, void *handle)
         return 0;
 }
 
-static int mds_ext2_setattr(struct inode *inode, void *handle,
+static int mds_ext2_setattr(struct dentry *dentry, void *handle,
                             struct iattr *iattr)
 {
+        struct inode *inode = dentry->d_inode;
+
         /* a _really_ horrible hack to avoid removing the data stored
            in the block pointers; this data is the object id
            this will go into an extended attribute at some point.
         */
-        if (iattr->ia_valid & ATTR_SIZE ) {
+        if (iattr->ia_valid & ATTR_SIZE) {
                 /* ATTR_SIZE would invoke truncate: clear it */
                 iattr->ia_valid &= ~ATTR_SIZE;
                 inode->i_size = iattr->ia_size;
@@ -49,7 +51,10 @@ static int mds_ext2_setattr(struct inode *inode, void *handle,
                 }
         }
 
-        return 0;
+        if (inode->i_op->setattr)
+                return inode->i_op->setattr(dentry, iattr);
+        else
+                return inode_setattr(inode, iattr);
 }
 
 /*
@@ -58,13 +63,13 @@ static int mds_ext2_setattr(struct inode *inode, void *handle,
  */
 static int mds_ext2_set_objid(struct inode *inode, void *handle, obd_id id)
 {
-        memcpy(inode->u.ext2_i.i_data, &id, sizeof(id));
+        (__u64)(inode->u.ext2_i.i_data[0]) = cpu_to_le64(id);
         return 0;
 }
 
 static void mds_ext2_get_objid(struct inode *inode, obd_id *id)
 {
-        memcpy(id, &inode->u.ext2_i.i_data, sizeof(*id));
+        *id = le64_to_cpu(inode->u.ext2_i.i_data[0]);
 }
 
 static ssize_t mds_ext2_readpage(struct file *file, char *buf, size_t count,
@@ -76,6 +81,29 @@ static ssize_t mds_ext2_readpage(struct file *file, char *buf, size_t count,
                 return generic_file_read(file, buf, count, offset);
 }
 
+struct mds_fs_operations mds_ext2_fs_ops;
+
+static void mds_ext2_delete_inode(struct inode *inode)
+{
+        if (S_ISREG(inode->i_mode))
+                mds_ext2_set_objid(inode, NULL, 0);
+
+        mds_ext2_fs_ops.cl_delete_inode(inode);
+}
+
+static int mds_ext2_set_last_rcvd(struct mds_obd *mds, void *handle)
+{
+        /* Bail for ext2 - can't tell when it is on disk anyways, sync? */
+        mds->mds_last_committed = mds->mds_last_rcvd;
+
+        return 0;
+}
+
+static int mds_ext2_journal_data(struct file *filp)
+{
+        return 0;
+}
+
 struct mds_fs_operations mds_ext2_fs_ops = {
         fs_start:       mds_ext2_start,
         fs_commit:      mds_ext2_stop,
@@ -83,4 +111,8 @@ struct mds_fs_operations mds_ext2_fs_ops = {
         fs_set_objid:   mds_ext2_set_objid,
         fs_get_objid:   mds_ext2_get_objid,
         fs_readpage:    mds_ext2_readpage,
+        fs_delete_inode:mds_ext2_delete_inode,
+        cl_delete_inode:clear_inode,
+        fs_journal_data:mds_ext2_journal_data,
+        fs_set_last_rcvd:mds_ext2_set_last_rcvd,
 };