1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2007 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <linux/sched.h>
25 #include <linux/smp_lock.h>
26 #include <linux/highmem.h>
27 #include <linux/pagemap.h>
29 #define DEBUG_SUBSYSTEM S_LLITE
31 #include <obd_support.h>
32 #include <lustre_lite.h>
33 #include <lustre_dlm.h>
34 #include <linux/lustre_version.h>
35 #include "llite_internal.h"
38 struct list_head se_list;
39 unsigned int se_index;
44 SA_ENTRY_UNSTATED = 0,
48 static unsigned int sai_generation = 0;
49 static spinlock_t sai_generation_lock = SPIN_LOCK_UNLOCKED;
51 static struct ll_statahead_info *ll_sai_alloc(void)
53 struct ll_statahead_info *sai;
59 spin_lock(&sai_generation_lock);
60 sai->sai_generation = ++sai_generation;
61 if (unlikely(sai_generation == 0))
62 sai->sai_generation = ++sai_generation;
63 spin_unlock(&sai_generation_lock);
64 atomic_set(&sai->sai_refcount, 1);
65 sai->sai_max = LL_SA_RPC_MIN;
66 cfs_waitq_init(&sai->sai_waitq);
67 cfs_waitq_init(&sai->sai_thread.t_ctl_waitq);
68 CFS_INIT_LIST_HEAD(&sai->sai_entries);
73 struct ll_statahead_info *ll_sai_get(struct ll_statahead_info *sai)
76 atomic_inc(&sai->sai_refcount);
80 static void ll_sai_put(struct ll_statahead_info *sai)
82 struct inode *inode = sai->sai_inode;
83 struct ll_inode_info *lli = ll_i2info(inode);
86 if (atomic_dec_and_lock(&sai->sai_refcount, &lli->lli_lock)) {
87 struct ll_sai_entry *entry, *next;
90 spin_unlock(&lli->lli_lock);
92 LASSERT(sai->sai_thread.t_flags & SVC_STOPPED);
94 if (sai->sai_sent > sai->sai_replied)
95 CDEBUG(D_READA,"statahead for dir "DFID" does not "
96 "finish: [sent:%u] [replied:%u]\n",
98 sai->sai_sent, sai->sai_replied);
100 list_for_each_entry_safe(entry, next, &sai->sai_entries,
102 list_del(&entry->se_list);
111 static struct ll_sai_entry *
112 ll_sai_entry_get(struct ll_statahead_info *sai, unsigned int index, int stat)
114 struct ll_inode_info *lli = ll_i2info(sai->sai_inode);
115 struct ll_sai_entry *entry;
118 OBD_ALLOC_PTR(entry);
120 RETURN(ERR_PTR(-ENOMEM));
122 CDEBUG(D_READA, "alloc sai entry %p index %u, stat %d\n",
124 entry->se_index = index;
125 entry->se_stat = stat;
127 spin_lock(&lli->lli_lock);
128 list_add_tail(&entry->se_list, &sai->sai_entries);
129 spin_unlock(&lli->lli_lock);
136 * 0: can not find the entry with the index
137 * 1: it is the first entry
138 * 2: it is not the first entry */
140 ll_sai_entry_set(struct ll_statahead_info *sai, unsigned int index, int stat)
142 struct ll_sai_entry *entry;
146 if (list_empty(&sai->sai_entries))
149 entry = list_entry(sai->sai_entries.next, struct ll_sai_entry, se_list);
150 if (entry->se_index == index)
153 while (entry->se_list.next != &sai->sai_entries &&
154 entry->se_index < index) {
155 entry = list_entry(entry->se_list.next, struct ll_sai_entry,
157 if (entry->se_index == index)
165 LASSERT(entry->se_stat == SA_ENTRY_UNSTATED);
166 entry->se_stat = stat;
172 /* Check whether first entry was stated already or not.
173 * No need to hold lli_lock, for:
174 * (1) it is me that remove entry from the list (ll_sai_entry_put)
175 * (2) the statahead thread only add new entry to the list tail */
176 static int ll_sai_entry_stated(struct ll_statahead_info *sai)
178 struct ll_sai_entry *entry;
182 if (!list_empty(&sai->sai_entries)) {
183 entry = list_entry(sai->sai_entries.next, struct ll_sai_entry,
185 rc = (entry->se_stat != SA_ENTRY_UNSTATED);
191 static void ll_sai_entry_put(struct ll_statahead_info *sai)
193 struct ll_inode_info *lli = ll_i2info(sai->sai_inode);
194 struct ll_sai_entry *entry;
197 spin_lock(&lli->lli_lock);
198 if (!list_empty(&sai->sai_entries)) {
199 entry = list_entry(sai->sai_entries.next,
200 struct ll_sai_entry, se_list);
201 list_del(&entry->se_list);
204 spin_unlock(&lli->lli_lock);
209 /* finish lookup/revalidate */
210 static int ll_statahead_interpret(struct ptlrpc_request *req,
211 struct md_enqueue_info *minfo,
214 struct lookup_intent *it = &minfo->mi_it;
215 struct dentry *dentry = minfo->mi_dentry;
216 struct inode *dir = dentry->d_parent->d_inode;
217 struct ll_inode_info *lli = ll_i2info(dir);
218 struct ll_statahead_info *sai = NULL;
221 CDEBUG(D_READA, "interpret statahead %.*s rc %d\n",
222 dentry->d_name.len, dentry->d_name.name, rc);
224 spin_lock(&lli->lli_lock);
225 if (unlikely(lli->lli_sai == NULL ||
226 lli->lli_sai->sai_generation != minfo->mi_generation)) {
227 spin_unlock(&lli->lli_lock);
228 GOTO(out_free, rc = -ESTALE);
230 sai = ll_sai_get(lli->lli_sai);
231 spin_unlock(&lli->lli_lock);
234 if (rc || dir == NULL)
237 if (dentry->d_inode == NULL) {
239 struct dentry *save = dentry;
240 struct it_cb_data icbd = {
242 .icbd_childp = &dentry
245 LASSERT(fid_is_zero(&minfo->mi_data.op_fid2));
247 rc = ll_lookup_it_finish(req, it, &icbd);
249 /* Here dentry->d_inode might be NULL,
250 * because the entry may have been removed before
251 * we start doing stat ahead. */
252 ll_lookup_finish_locks(it, dentry);
258 struct mdt_body *body;
260 body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF,
262 if (!lu_fid_eq(&minfo->mi_data.op_fid2, &body->fid1)) {
263 ll_unhash_aliases(dentry->d_inode);
264 GOTO(out, rc = -EAGAIN);
267 rc = ll_revalidate_it_finish(req, it, dentry);
269 ll_unhash_aliases(dentry->d_inode);
273 spin_lock(&dcache_lock);
276 #ifdef DCACHE_LUSTRE_INVALID
277 dentry->d_flags &= ~DCACHE_LUSTRE_INVALID;
279 unlock_dentry(dentry);
280 d_rehash_cond(dentry, 0);
281 spin_unlock(&dcache_lock);
283 ll_lookup_finish_locks(it, dentry);
292 spin_lock(&lli->lli_lock);
293 first = ll_sai_entry_set(sai,
294 (unsigned int)(long)minfo->mi_cbdata,
296 spin_unlock(&lli->lli_lock);
298 /* wake up the "ls -l" process only when the first entry
300 cfs_waitq_signal(&sai->sai_waitq);
302 CDEBUG(D_READA, "can't find sai entry for dir "
303 DFID" generation %u index %u\n",
305 minfo->mi_generation,
306 (unsigned int)(long)minfo->mi_cbdata);
311 ll_intent_release(it);
318 static void sa_args_fini(struct md_enqueue_info *minfo,
319 struct ldlm_enqueue_info *einfo)
321 LASSERT(minfo && einfo);
322 capa_put(minfo->mi_data.op_capa1);
323 capa_put(minfo->mi_data.op_capa2);
328 /* There is race condition between "capa_put" and "ll_statahead_interpret" for
329 * accessing "op_data.op_capa[1,2]" as following:
330 * "capa_put" releases "op_data.op_capa[1,2]"'s reference count after calling
331 * "md_intent_getattr_async". But "ll_statahead_interpret" maybe run first, and
332 * fill "op_data.op_capa[1,2]" as POISON, then cause "capa_put" access invalid
333 * "ocapa". So here reserve "op_data.op_capa[1,2]" in "pcapa" before calling
334 * "md_intent_getattr_async". */
335 static int sa_args_init(struct inode *dir, struct dentry *dentry,
336 struct md_enqueue_info **pmi,
337 struct ldlm_enqueue_info **pei,
338 struct obd_capa **pcapa)
340 struct ll_inode_info *lli = ll_i2info(dir);
341 struct md_enqueue_info *minfo;
342 struct ldlm_enqueue_info *einfo;
343 struct md_op_data *op_data;
345 OBD_ALLOC_PTR(einfo);
349 OBD_ALLOC_PTR(minfo);
355 op_data = ll_prep_md_op_data(&minfo->mi_data, dir, dentry->d_inode,
356 dentry->d_name.name, dentry->d_name.len,
357 0, LUSTRE_OPC_ANY, NULL);
358 if (IS_ERR(op_data)) {
361 return PTR_ERR(op_data);
364 minfo->mi_it.it_op = IT_GETATTR;
365 minfo->mi_dentry = dentry;
366 minfo->mi_cb = ll_statahead_interpret;
367 minfo->mi_generation = lli->lli_sai->sai_generation;
368 minfo->mi_cbdata = (void *)(long)lli->lli_sai->sai_index;
370 einfo->ei_type = LDLM_IBITS;
371 einfo->ei_mode = it_to_lock_mode(&minfo->mi_it);
372 einfo->ei_cb_bl = ll_md_blocking_ast;
373 einfo->ei_cb_cp = ldlm_completion_ast;
374 einfo->ei_cb_gl = NULL;
375 einfo->ei_cbdata = NULL;
379 pcapa[0] = op_data->op_capa1;
380 pcapa[1] = op_data->op_capa2;
385 /* similar to ll_lookup_it(). */
386 static int do_sa_lookup(struct inode *dir, struct dentry *dentry)
388 struct md_enqueue_info *minfo;
389 struct ldlm_enqueue_info *einfo;
390 struct obd_capa *capas[2];
394 rc = sa_args_init(dir, dentry, &minfo, &einfo, capas);
398 rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
403 sa_args_fini(minfo, einfo);
409 /* similar to ll_revalidate_it().
412 * 0 -- will send stat-ahead request
413 * others -- prepare stat-ahead request failed */
414 static int do_sa_revalidate(struct dentry *dentry)
416 struct inode *inode = dentry->d_inode;
417 struct inode *dir = dentry->d_parent->d_inode;
418 struct lookup_intent it = { .it_op = IT_GETATTR };
419 struct md_enqueue_info *minfo;
420 struct ldlm_enqueue_info *einfo;
421 struct obd_capa *capas[2];
428 if (d_mountpoint(dentry))
431 if (dentry == dentry->d_sb->s_root)
434 rc = md_revalidate_lock(ll_i2mdexp(dir), &it, ll_inode2fid(inode));
436 ll_intent_release(&it);
440 rc = sa_args_init(dir, dentry, &minfo, &einfo, capas);
444 rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
449 sa_args_fini(minfo, einfo);
455 static inline void ll_name2qstr(struct qstr *this, const char *name, int namelen)
457 unsigned long hash = init_name_hash();
462 for (; namelen > 0; namelen--, name++) {
463 c = *(const unsigned char *)name;
464 hash = partial_name_hash(c, hash);
466 this->hash = end_name_hash(hash);
469 static int ll_statahead_one(struct dentry *parent, const char* entry_name,
472 struct inode *dir = parent->d_inode;
473 struct ll_inode_info *lli = ll_i2info(dir);
474 struct ll_statahead_info *sai = lli->lli_sai;
476 struct dentry *dentry;
477 struct ll_sai_entry *se;
481 #ifdef DCACHE_LUSTRE_INVALID
482 if (parent->d_flags & DCACHE_LUSTRE_INVALID) {
484 if (d_unhashed(parent)) {
486 CDEBUG(D_READA, "parent dentry@%p %.*s is "
487 "invalid, skip statahead\n",
488 parent, parent->d_name.len, parent->d_name.name);
492 se = ll_sai_entry_get(sai, sai->sai_index, SA_ENTRY_UNSTATED);
496 ll_name2qstr(&name, entry_name, entry_name_len);
497 dentry = d_lookup(parent, &name);
499 dentry = d_alloc(parent, &name);
501 rc = do_sa_lookup(dir, dentry);
505 GOTO(out, rc = -ENOMEM);
508 rc = do_sa_revalidate(dentry);
517 CDEBUG(D_READA, "set sai entry %p index %u stat %d rc %d\n",
518 se, se->se_index, se->se_stat, rc);
520 cfs_waitq_signal(&sai->sai_waitq);
529 static inline int sa_check_stop(struct ll_statahead_info *sai)
531 return !!(sai->sai_thread.t_flags & SVC_STOPPING);
534 static inline int sa_not_full(struct ll_statahead_info *sai)
536 return sai->sai_index < sai->sai_hit + sai->sai_miss + sai->sai_max;
539 /* (1) hit ratio less than 80%
541 * (2) consecutive miss more than 8 */
542 static inline int sa_low_hit(struct ll_statahead_info *sai)
544 return ((sai->sai_hit < 4 * sai->sai_miss && sai->sai_hit > 7) ||
545 (sai->sai_consecutive_miss > 8));
548 struct ll_sa_thread_args {
549 struct dentry *sta_parent;
553 static int ll_statahead_thread(void *arg)
555 struct ll_sa_thread_args *sta = arg;
556 struct dentry *parent = dget(sta->sta_parent);
557 struct inode *dir = parent->d_inode;
558 struct ll_inode_info *lli = ll_i2info(dir);
559 struct ll_sb_info *sbi = ll_i2sbi(dir);
560 struct ll_statahead_info *sai = ll_sai_get(lli->lli_sai);
561 struct ptlrpc_thread *thread = &sai->sai_thread;
566 struct ll_dir_chain chain;
571 snprintf(pname, 15, "ll_sa_%u", sta->sta_pid);
572 cfs_daemonize(pname);
576 spin_lock(&lli->lli_lock);
577 thread->t_flags = SVC_RUNNING;
578 spin_unlock(&lli->lli_lock);
579 cfs_waitq_signal(&thread->t_ctl_waitq);
580 CDEBUG(D_READA, "start doing statahead for %s\n", parent->d_name.name);
582 ll_dir_chain_init(&chain);
583 page = ll_get_dir_page(dir, pos, 0, &chain);
586 struct lu_dirpage *dp;
587 struct lu_dirent *ent;
591 CERROR("error reading dir "DFID" at %llu/%u: rc %d\n",
592 PFID(ll_inode2fid(dir)), pos,
597 dp = page_address(page);
598 for (ent = lu_dirent_start(dp); ent != NULL;
599 ent = lu_dirent_next(ent)) {
600 struct l_wait_info lwi = { 0 };
601 char *name = ent->lde_name;
602 int namelen = le16_to_cpu(ent->lde_namelen);
605 /* Skip dummy record. */
608 if (name[0] == '.') {
612 } else if (name[1] == '.' && namelen == 2) {
615 } else if (!sai->sai_ls_all) {
616 /* skip hidden files */
617 sai->sai_skip_hidden++;
622 /* don't stat-ahead first entry */
623 if (unlikely(!first)) {
628 l_wait_event(thread->t_ctl_waitq,
629 sa_check_stop(sai) || sa_not_full(sai),
632 if (unlikely(sa_check_stop(sai))) {
637 rc = ll_statahead_one(parent, name, namelen);
643 pos = le64_to_cpu(dp->ldp_hash_end);
645 if (pos == DIR_END_OFF) {
646 /* End of directory reached. */
648 } else if (1 /* chain is exhausted*/) {
649 /* Normal case: continue to the next page. */
650 page = ll_get_dir_page(dir, pos, 1, &chain);
652 /* go into overflow page. */
658 ll_dir_chain_fini(&chain);
659 spin_lock(&lli->lli_lock);
660 thread->t_flags = SVC_STOPPED;
661 spin_unlock(&lli->lli_lock);
662 cfs_waitq_signal(&sai->sai_waitq);
663 cfs_waitq_signal(&thread->t_ctl_waitq);
666 CDEBUG(D_READA, "statahead thread stopped, pid %d\n",
671 /* called in ll_file_release() */
672 void ll_stop_statahead(struct inode *inode, void *key)
674 struct ll_inode_info *lli = ll_i2info(inode);
675 struct ptlrpc_thread *thread;
677 spin_lock(&lli->lli_lock);
678 if (lli->lli_opendir_pid == 0 ||
679 unlikely(lli->lli_opendir_key != key)) {
680 spin_unlock(&lli->lli_lock);
684 lli->lli_opendir_key = NULL;
685 lli->lli_opendir_pid = 0;
688 struct l_wait_info lwi = { 0 };
690 thread = &lli->lli_sai->sai_thread;
691 if (!(thread->t_flags & SVC_STOPPED)) {
692 thread->t_flags = SVC_STOPPING;
693 spin_unlock(&lli->lli_lock);
694 cfs_waitq_signal(&thread->t_ctl_waitq);
696 CDEBUG(D_READA, "stopping statahead thread, pid %d\n",
698 l_wait_event(thread->t_ctl_waitq,
699 thread->t_flags & SVC_STOPPED,
702 spin_unlock(&lli->lli_lock);
705 /* Put the ref which was held when first statahead_enter.
706 * It maybe not the last ref for some statahead requests
708 ll_sai_put(lli->lli_sai);
711 spin_unlock(&lli->lli_lock);
715 LS_NONE_FIRST_DE = 0, /* not first dirent, or is "." */
716 LS_FIRST_DE, /* the first non-hidden dirent */
717 LS_FIRST_DOT_DE /* the first hidden dirent, that is ".xxx" */
720 static int is_first_dirent(struct inode *dir, struct dentry *dentry)
722 struct ll_dir_chain chain;
723 struct qstr *target = &dentry->d_name;
727 int rc = LS_NONE_FIRST_DE;
730 ll_dir_chain_init(&chain);
731 page = ll_get_dir_page(dir, pos, 0, &chain);
734 struct lu_dirpage *dp;
735 struct lu_dirent *ent;
739 CERROR("error reading dir "DFID" at %llu: rc %d\n",
740 PFID(ll_inode2fid(dir)), pos, rc);
744 dp = page_address(page);
745 for (ent = lu_dirent_start(dp); ent != NULL;
746 ent = lu_dirent_next(ent)) {
747 char *name = ent->lde_name;
748 int namelen = le16_to_cpu(ent->lde_namelen);
751 /* Skip dummy record. */
754 if (name[0] == '.') {
758 else if (name[1] == '.' && namelen == 2)
767 if (dot_de && target->name[0] != '.') {
768 CDEBUG(D_READA, "%.*s skip hidden file %.*s\n",
769 target->len, target->name,
774 if (target->len == namelen &&
775 !strncmp(target->name, name, target->len))
776 rc = LS_FIRST_DE + dot_de;
778 rc = LS_NONE_FIRST_DE;
782 pos = le64_to_cpu(dp->ldp_hash_end);
784 if (pos == DIR_END_OFF) {
785 /* End of directory reached. */
787 } else if (1 /* chain is exhausted*/) {
788 /* Normal case: continue to the next page. */
789 page = ll_get_dir_page(dir, pos, 1, &chain);
791 /* go into overflow page. */
797 ll_dir_chain_fini(&chain);
801 /* Start statahead thread if this is the first dir entry.
802 * Otherwise if a thread is started already, wait it until it is ahead of me.
804 * 0 -- stat ahead thread process such dentry, for lookup, it miss
805 * 1 -- stat ahead thread process such dentry, for lookup, it hit
806 * -EEXIST -- stat ahead thread started, and this is the first dentry
807 * -EBADFD -- statahead thread exit and not dentry available
809 int do_statahead_enter(struct inode *dir, struct dentry **dentryp, int lookup)
811 struct ll_sb_info *sbi = ll_i2sbi(dir);
812 struct ll_inode_info *lli = ll_i2info(dir);
813 struct ll_statahead_info *sai = lli->lli_sai;
814 struct ll_sa_thread_args sta;
815 struct l_wait_info lwi = { 0 };
819 LASSERT(lli->lli_opendir_pid == cfs_curproc_pid());
822 if (unlikely(sai->sai_thread.t_flags & SVC_STOPPED &&
823 list_empty(&sai->sai_entries)))
826 if ((*dentryp)->d_name.name[0] == '.') {
827 if (likely(sai->sai_ls_all ||
828 sai->sai_miss_hidden >= sai->sai_skip_hidden)) {
829 /* Hidden dentry is the first one, or statahead
830 * thread does not skip so many hidden dentries
831 * before "sai_ls_all" enabled as below. */
833 if (!sai->sai_ls_all)
834 /* It maybe because hidden dentry is not
835 * the first one, "sai_ls_all" was not
836 * set, then "ls -al" missed. Enable
837 * "sai_ls_all" for such case. */
840 /* Such "getattr" has been skipped before
841 * "sai_ls_all" enabled as above. */
842 sai->sai_miss_hidden++;
847 if (ll_sai_entry_stated(sai)) {
850 sbi->ll_sa_blocked++;
851 /* thread started already, avoid double-stat */
852 l_wait_event(sai->sai_waitq,
853 ll_sai_entry_stated(sai) ||
854 sai->sai_thread.t_flags & SVC_STOPPED,
859 struct dentry *result;
861 result = d_lookup((*dentryp)->d_parent,
862 &(*dentryp)->d_name);
864 LASSERT(result != *dentryp);
870 /* do nothing for revalidate */
874 /* I am the "lli_opendir_pid" owner, only me can set "lli_sai". */
875 LASSERT(lli->lli_sai == NULL);
877 rc = is_first_dirent(dir, *dentryp);
878 if (rc == LS_NONE_FIRST_DE) {
879 /* It is not "ls -{a}l" operation, no need statahead for it */
880 spin_lock(&lli->lli_lock);
881 lli->lli_opendir_key = NULL;
882 lli->lli_opendir_pid = 0;
883 spin_unlock(&lli->lli_lock);
887 sai = ll_sai_alloc();
891 sai->sai_inode = igrab(dir);
892 sai->sai_ls_all = (rc == LS_FIRST_DOT_DE);
894 sta.sta_parent = (*dentryp)->d_parent;
895 sta.sta_pid = cfs_curproc_pid();
898 rc = cfs_kernel_thread(ll_statahead_thread, &sta, 0);
900 CERROR("can't start ll_sa thread, rc: %d\n", rc);
901 sai->sai_thread.t_flags = SVC_STOPPED;
903 LASSERT(lli->lli_sai == NULL);
907 l_wait_event(sai->sai_thread.t_ctl_waitq,
908 sai->sai_thread.t_flags & (SVC_RUNNING | SVC_STOPPED),
911 /* We don't stat-ahead for the first dirent since we are already in
912 * lookup, and -EEXIST also indicates that this is the first dirent. */
916 /* update hit/miss count */
917 void ll_statahead_exit(struct dentry *dentry, int result)
919 struct dentry *parent = dentry->d_parent;
920 struct ll_inode_info *lli = ll_i2info(parent->d_inode);
921 struct ll_sb_info *sbi = ll_i2sbi(parent->d_inode);
922 struct ll_dentry_data *ldd = ll_d2d(dentry);
924 if (lli->lli_opendir_pid != cfs_curproc_pid())
928 struct ll_statahead_info *sai = lli->lli_sai;
933 sai->sai_consecutive_miss = 0;
934 sai->sai_max = min(2 * sai->sai_max, sbi->ll_sa_max);
938 sai->sai_consecutive_miss++;
939 if (sa_low_hit(sai) &&
940 sai->sai_thread.t_flags & SVC_RUNNING) {
942 CDEBUG(D_READA, "statahead for dir %.*s hit "
943 "ratio too low: hit/miss %u/%u, "
944 "sent/replied %u/%u. stopping statahead "
946 parent->d_name.len, parent->d_name.name,
947 sai->sai_hit, sai->sai_miss,
948 sai->sai_sent, sai->sai_replied,
950 spin_lock(&lli->lli_lock);
951 if (!(sai->sai_thread.t_flags & SVC_STOPPED))
952 sai->sai_thread.t_flags = SVC_STOPPING;
953 spin_unlock(&lli->lli_lock);
957 cfs_waitq_signal(&sai->sai_thread.t_ctl_waitq);
958 ll_sai_entry_put(sai);
960 if (likely(ldd != NULL))
961 ldd->lld_sa_generation = sai->sai_generation;