Whamcloud - gitweb
Need to package the scripts in $libdir/lustre/.
[fs/lustre-release.git] / lustre / lvfs / lvfs_undo.c
index 43e9dbf..0018a59 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/pagemap.h>
 #include <linux/quotaops.h>
 #include <linux/version.h>
-#include <linux/kp30.h>
+#include <libcfs/kp30.h>
 #include <linux/lustre_fsfilt.h>
 #include <linux/obd.h>
 #include <linux/obd_class.h>
@@ -34,7 +34,7 @@ static int lvfs_undo_create(struct super_block *sb,
                             struct reint_record *r_rec)
 {
         struct fsfilt_operations *fsfilt = S2SMI(sb)->sm_fsfilt;
-        char *path = r_rec->rec_data1;
+        char *path = r_rec->name.path_name;
         int type = r_rec->u_rec.ur_iattr.ia_mode & S_IFMT;
                struct nameidata nd;
        struct dentry *dparent = NULL;
@@ -122,7 +122,7 @@ static int lvfs_undo_link(struct super_block *sb,
                           struct reint_record *r_rec)
 {
         struct fsfilt_operations *fsfilt = S2SMI(sb)->sm_fsfilt;
-        char   *new_path = r_rec->rec_data2;
+        char   *new_path = r_rec->u.re_name.path_name;
                struct nameidata nd;
        struct dentry *dparent = NULL;
        struct dentry *dentry = NULL;
@@ -159,7 +159,6 @@ static int lvfs_undo_link(struct super_block *sb,
                 CERROR("Error for undo node %s\n", new_path);
                 GOTO(cleanup, 0); 
         } else {
-                /*restore time attr of dir inode*/
                 struct iattr *iattr = &r_rec->u_rec.ur_pattr;
                 
                 iattr->ia_valid = ATTR_MTIME | ATTR_CTIME;
@@ -185,7 +184,7 @@ static int lvfs_undo_unlink(struct super_block *sb,
                              struct reint_record *r_rec)
 {
         struct fsfilt_operations *fsfilt = S2SMI(sb)->sm_fsfilt;
-        char   *path = r_rec->rec_data1;
+        char   *path = r_rec->name.path_name;
         struct nameidata nd;
         struct dentry *dparent;
        struct dentry *dentry = NULL;
@@ -209,7 +208,7 @@ static int lvfs_undo_unlink(struct super_block *sb,
         if (!SMFS_DO_WRITE_KML(r_rec->u_rec.ur_flags))
                 SMFS_CLEAN_INODE_REC(dir);
         if (SMFS_DO_DEC_LINK(r_rec->u_rec.ur_flags)) {
-                ino_t ino = *((ino_t *)r_rec->rec_data2);
+                ino_t ino = *((ino_t *)r_rec->u.re_name.path_name);
                 struct inode* inode = iget(dir->i_sb, ino);
                 if (!inode) 
                         GOTO(cleanup1, rc = -EINVAL);        
@@ -223,7 +222,7 @@ cleanup1:
                 post_smfs_dentry(del_dentry);
                 iput(inode);
         } else {
-                char   *del_path = r_rec->rec_data2;
+                char   *del_path = r_rec->u.re_name.path_name;
                              
                 rc = lookup_by_path(del_path, LOOKUP_PARENT, &del_nd);
                 if (rc) 
@@ -251,8 +250,8 @@ cleanup2:
                         l_dput(del_dentry);
                 path_release(&del_nd);
         }
+
         if (!rc) {
-               /*restore time attr of dir inode*/
                 struct iattr *iattr = &r_rec->u_rec.ur_pattr;
                 
                 iattr->ia_valid = ATTR_MTIME | ATTR_CTIME;
@@ -277,8 +276,8 @@ static int lvfs_undo_rename(struct super_block *sb,
                              struct reint_record *r_rec)
 {
         struct fsfilt_operations *fsfilt = S2SMI(sb)->sm_fsfilt;
-        char   *path = r_rec->rec_data1;
-        char   *new_path = r_rec->rec_data2;
+        char   *path = r_rec->name.path_name;
+        char   *new_path = r_rec->u.re_name.path_name;
         struct nameidata nd;
         struct nameidata new_nd;
         struct dentry *dparent;
@@ -329,7 +328,6 @@ static int lvfs_undo_rename(struct super_block *sb,
                 CERROR("Error for undo node %s\n", new_path);
                 GOTO(cleanup, 0); 
         } else {
-                /*restore time attr of dir inode*/
                 struct iattr *iattr = &r_rec->u_rec.ur_pattr;
                 
                 iattr->ia_valid = ATTR_MTIME | ATTR_CTIME;
@@ -357,7 +355,7 @@ static int lvfs_undo_setattr(struct super_block *sb,
                              struct reint_record *r_rec)
 {
         struct fsfilt_operations *fsfilt = S2SMI(sb)->sm_fsfilt;
-        char *path = r_rec->rec_data1;
+        char *path = r_rec->name.path_name;
                struct nameidata nd;
        struct dentry *dparent = NULL;
        struct dentry *dentry = NULL;
@@ -384,7 +382,7 @@ static int lvfs_undo_setattr(struct super_block *sb,
         if (IS_ERR(handle))
                 GOTO(cleanup, rc = PTR_ERR(handle));
         
-        /*FIXME later, did not set parent attr*/
+        /* FIXME later, did not set parent attr. */
         r_rec->u_rec.ur_iattr.ia_valid = r_rec->u_rec.ur_pattr.ia_valid;
         rc = fsfilt->fs_setattr(dentry, handle, &r_rec->u_rec.ur_iattr, 0);
 cleanup: