Whamcloud - gitweb
LU-1684 ldlm: move ldlm flags not sent through wire to upper 32bits
[fs/lustre-release.git] / lustre / llite / statahead.c
index d911ab6..5cf4b9c 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
-#include <linux/smp_lock.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 
@@ -84,7 +83,7 @@ struct ll_sa_entry {
 };
 
 static unsigned int sai_generation = 0;
-static cfs_spinlock_t sai_generation_lock = CFS_SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(sai_generation_lock);
 
 static inline int ll_sa_entry_unlinked(struct ll_sa_entry *entry)
 {
@@ -139,10 +138,10 @@ ll_sa_entry_unhash(struct ll_statahead_info *sai, struct ll_sa_entry *entry)
 static inline int agl_should_run(struct ll_statahead_info *sai,
                                  struct inode *inode)
 {
-        if (inode != NULL && S_ISREG(inode->i_mode) &&
-            ll_i2info(inode)->lli_smd != NULL && sai->sai_agl_valid)
-                return 1;
-        return 0;
+       if (inode != NULL && S_ISREG(inode->i_mode) &&
+           ll_i2info(inode)->lli_has_smd && sai->sai_agl_valid)
+               return 1;
+       return 0;
 }
 
 static inline struct ll_sa_entry *
@@ -1118,9 +1117,8 @@ static int ll_statahead_thread(void *arg)
         cfs_spin_unlock(&plli->lli_sa_lock);
         cfs_waitq_signal(&thread->t_ctl_waitq);
 
-        plli->lli_sa_pos = 0;
         ll_dir_chain_init(&chain);
-        page = ll_get_dir_page(NULL, dir, pos, &chain);
+       page = ll_get_dir_page(dir, pos, &chain);
 
         while (1) {
                 struct lu_dirpage *dp;
@@ -1277,9 +1275,8 @@ do_it:
                          */
                         ll_release_page(page, le32_to_cpu(dp->ldp_flags) &
                                               LDF_COLLIDE);
-                        plli->lli_sa_pos = pos;
                         sai->sai_in_readpage = 1;
-                        page = ll_get_dir_page(NULL, dir, pos, &chain);
+                       page = ll_get_dir_page(dir, pos, &chain);
                         sai->sai_in_readpage = 0;
                 } else {
                         LASSERT(le32_to_cpu(dp->ldp_flags) & LDF_COLLIDE);
@@ -1395,7 +1392,6 @@ enum {
 
 static int is_first_dirent(struct inode *dir, struct dentry *dentry)
 {
-        struct ll_inode_info *lli    = ll_i2info(dir);
         struct ll_dir_chain   chain;
         struct qstr          *target = &dentry->d_name;
         struct page          *page;
@@ -1404,9 +1400,8 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
         int                   rc     = LS_NONE_FIRST_DE;
         ENTRY;
 
-        lli->lli_sa_pos = 0;
         ll_dir_chain_init(&chain);
-        page = ll_get_dir_page(NULL, dir, pos, &chain);
+       page = ll_get_dir_page(dir, pos, &chain);
 
         while (1) {
                 struct lu_dirpage *dp;
@@ -1493,8 +1488,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
                          */
                         ll_release_page(page, le32_to_cpu(dp->ldp_flags) &
                                               LDF_COLLIDE);
-                        lli->lli_sa_pos = pos;
-                        page = ll_get_dir_page(NULL, dir, pos, &chain);
+                       page = ll_get_dir_page(dir, pos, &chain);
                 } else {
                         /*
                          * go into overflow page.