Whamcloud - gitweb
minor fix the oops which block HEAD's testing.
[fs/lustre-release.git] / lustre / lvfs / fsfilt_smfs.c
index af36a3b..d1573f6 100644 (file)
@@ -76,7 +76,7 @@ static void *fsfilt_smfs_brw_start(int objcount, struct fsfilt_objinfo *fso,
                 return NULL;
 
         cache_inode = I2CI(fso->fso_dentry->d_inode);
-         cache_dentry = pre_smfs_dentry(NULL, cache_inode, fso->fso_dentry);
+        cache_dentry = pre_smfs_dentry(NULL, cache_inode, fso->fso_dentry);
 
         if (!cache_dentry)
                 GOTO(exit, rc = ERR_PTR(-ENOMEM));
@@ -395,11 +395,27 @@ static ssize_t fsfilt_smfs_readpage(struct file *file, char *buf,
         *cache_ppos = *off;
 
         pre_smfs_inode(file->f_dentry->d_inode, cache_inode);
-
+#if CONFIG_SNAPFS
+        /*readdir page*/
+        if (smfs_dotsnap_inode(file->f_dentry->d_inode)) {
+                struct fsfilt_operations *snapops = 
+                                        I2SNAPOPS(file->f_dentry->d_inode);
+                
+                LASSERT(S_ISDIR(file->f_dentry->d_inode->i_mode));
+                
+                rc = snapops->fs_read_dotsnap_dir_page(sfi->c_file, buf, count, 
+                                                       cache_ppos); 
+        } else {
+                if (cache_fsfilt->fs_readpage)
+                        rc = cache_fsfilt->fs_readpage(sfi->c_file, buf, count,
+                                                       cache_ppos);
+        }
+#else
         if (cache_fsfilt->fs_readpage)
                 rc = cache_fsfilt->fs_readpage(sfi->c_file, buf, count,
                                                cache_ppos);
 
+#endif
         *off = *cache_ppos;
         post_smfs_inode(file->f_dentry->d_inode, cache_inode);
         duplicate_file(file, sfi->c_file);
@@ -601,7 +617,8 @@ static int fsfilt_smfs_write_record(struct file *file, void *buf, int bufsize,
         RETURN(rc);
 }
 
-static int fsfilt_smfs_post_setup(struct obd_device *obd, struct vfsmount *mnt)
+static int fsfilt_smfs_post_setup(struct obd_device *obd, struct vfsmount *mnt,
+                                  struct dentry *root_dentry)
 {
         struct super_block *sb = NULL;
         int rc = 0;
@@ -612,10 +629,6 @@ static int fsfilt_smfs_post_setup(struct obd_device *obd, struct vfsmount *mnt)
                 smfs_post_setup(sb, mnt);
                 if (SMFS_DO_REC(S2SMI(sb)))
                         rc = smfs_start_rec(sb, mnt);
-#if CONFIG_SNAPFS
-                if (SMFS_DO_COW(S2SMI(sb)))
-                        rc = smfs_start_cow(sb);
-#endif
                 if (rc)
                         GOTO(exit, rc);
                 if (obd)
@@ -640,10 +653,6 @@ static int fsfilt_smfs_post_cleanup(struct obd_device *obd,
                 sb = mnt->mnt_sb;
                 if (SMFS_DO_REC(S2SMI(sb)))
                         rc = smfs_stop_rec(sb);
-#if CONFIG_SNAPFS
-                if (SMFS_DO_COW(S2SMI(sb)))
-                        rc = smfs_stop_cow(sb);
-#endif
                 smfs_post_cleanup(sb);
         }
         RETURN(rc);
@@ -964,7 +973,7 @@ static int fsfilt_smfs_set_snap_item(struct super_block *sb, char *name)
 
         ENTRY;
 #if CONFIG_SNAPFS
-        rc = smfs_add_snap_item(sb, name);
+#warning "still not implement for add snap item -wangdi"         
 #endif
         RETURN(rc);        
 }
@@ -979,7 +988,7 @@ static int fsfilt_smfs_do_write_cow(struct dentry *de, void *extents,
         for (i = 0; i < num_extents; i++) {
                size_t count = w_ext->w_count;
                loff_t off = w_ext->w_pos;
-               rc = smfs_cow_write(de->d_inode, de, &count, &off);
+               rc = smfs_cow_write_pre(de->d_inode, de, &count, &off);
                if (rc)
                         RETURN(rc);  
                w_ext ++;