#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>
#include <obd_support.h>
#include <lustre_lite.h>
#include <lustre_dlm.h>
-#include <linux/lustre_version.h>
#include "llite_internal.h"
#define SA_OMITTED_ENTRY_MAX 8ULL
};
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)
{
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 *
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;
*/
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);
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;
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;
*/
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.
struct lookup_intent it = { .it_op = IT_GETATTR,
.d.lustre.it_lock_handle =
entry->se_handle };
- struct ll_dentry_data *lld;
- __u64 bits;
-
- rc = md_revalidate_lock(ll_i2mdexp(dir), &it,
- ll_inode2fid(inode), &bits);
- if (rc == 1) {
- if ((*dentryp)->d_inode == NULL) {
- *dentryp = ll_find_alias(inode,
- *dentryp);
- lld = ll_d2d(*dentryp);
- if (unlikely(lld == NULL))
- ll_dops_init(*dentryp, 1, 1);
+ __u64 bits;
+
+ rc = md_revalidate_lock(ll_i2mdexp(dir), &it,
+ ll_inode2fid(inode), &bits);
+ if (rc == 1) {
+ if ((*dentryp)->d_inode == NULL) {
+ *dentryp = ll_splice_alias(inode,
+ *dentryp);
} else if ((*dentryp)->d_inode != inode) {
/* revalidate, but inode is recreated */
CDEBUG(D_READA,
ll_sai_unplug(sai, entry);
RETURN(-ESTALE);
} else {
- ll_dentry_rehash(*dentryp, 0);
- iput(inode);
- }
- entry->se_inode = NULL;
+ iput(inode);
+ }
+ entry->se_inode = NULL;
- ll_dentry_reset_flags(*dentryp, bits);
+ if ((bits & MDS_INODELOCK_LOOKUP) &&
+ d_lustre_invalid(*dentryp))
+ d_lustre_revalidate(*dentryp);
ll_intent_release(&it);
}
}