Whamcloud - gitweb
LU-9679 general: add missing spaces to folded strings.
[fs/lustre-release.git] / lustre / llite / statahead.c
index 0b75ccc..0f1dfe3 100644 (file)
@@ -888,10 +888,8 @@ static int ll_agl_thread(void *arg)
        struct ll_sb_info *sbi = ll_i2sbi(dir);
        struct ll_statahead_info *sai;
        struct ptlrpc_thread *thread;
-       struct l_wait_info lwi = { 0 };
        ENTRY;
 
-
        sai = ll_sai_get(dir);
        thread = &sai->sai_agl_thread;
        thread->t_pid = current_pid();
@@ -909,14 +907,12 @@ static int ll_agl_thread(void *arg)
        spin_unlock(&plli->lli_agl_lock);
        wake_up(&thread->t_ctl_waitq);
 
-        while (1) {
-                l_wait_event(thread->t_ctl_waitq,
-                             !agl_list_empty(sai) ||
-                             !thread_is_running(thread),
-                             &lwi);
-
-                if (!thread_is_running(thread))
-                        break;
+       while (1) {
+               wait_event_idle(thread->t_ctl_waitq,
+                               !agl_list_empty(sai) ||
+                               !thread_is_running(thread));
+               if (!thread_is_running(thread))
+                       break;
 
                spin_lock(&plli->lli_agl_lock);
                /* The statahead thread maybe help to process AGL entries,
@@ -955,7 +951,6 @@ static int ll_agl_thread(void *arg)
 static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)
 {
        struct ptlrpc_thread *thread = &sai->sai_agl_thread;
-       struct l_wait_info    lwi    = { 0 };
        struct ll_inode_info  *plli;
        struct task_struct            *task;
        ENTRY;
@@ -972,9 +967,8 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)
                RETURN_EXIT;
        }
 
-       l_wait_event(thread->t_ctl_waitq,
-                    thread_is_running(thread) || thread_is_stopped(thread),
-                    &lwi);
+       wait_event_idle(thread->t_ctl_waitq,
+                       thread_is_running(thread) || thread_is_stopped(thread));
        EXIT;
 }
 
@@ -991,7 +985,6 @@ static int ll_statahead_thread(void *arg)
        int first = 0;
        struct md_op_data *op_data;
        struct ll_dir_chain chain;
-       struct l_wait_info lwi = { 0 };
        struct page *page = NULL;
        __u64 pos = 0;
        int rc = 0;
@@ -1005,8 +998,8 @@ static int ll_statahead_thread(void *arg)
               sai, parent->d_name.len, parent->d_name.name);
 
        OBD_ALLOC_PTR(op_data);
-       if (IS_ERR(op_data))
-               GOTO(out, rc = PTR_ERR(op_data));
+       if (!op_data)
+               GOTO(out, rc = -ENOMEM);
 
        if (sbi->ll_flags & LL_SBI_AGL_ENABLED)
                ll_start_agl(parent, sai);
@@ -1101,12 +1094,11 @@ static int ll_statahead_thread(void *arg)
 
                        /* wait for spare statahead window */
                        do {
-                               l_wait_event(sa_thread->t_ctl_waitq,
-                                            !sa_sent_full(sai) ||
-                                            sa_has_callback(sai) ||
-                                            !agl_list_empty(sai) ||
-                                            !thread_is_running(sa_thread),
-                                            &lwi);
+                               wait_event_idle(sa_thread->t_ctl_waitq,
+                                               !sa_sent_full(sai) ||
+                                               sa_has_callback(sai) ||
+                                               !agl_list_empty(sai) ||
+                                               !thread_is_running(sa_thread));
 
                                sa_handle_callback(sai);
 
@@ -1161,10 +1153,9 @@ static int ll_statahead_thread(void *arg)
        /* statahead is finished, but statahead entries need to be cached, wait
         * for file release to stop me. */
        while (thread_is_running(sa_thread)) {
-               l_wait_event(sa_thread->t_ctl_waitq,
-                            sa_has_callback(sai) ||
-                            !thread_is_running(sa_thread),
-                            &lwi);
+               wait_event_idle(sa_thread->t_ctl_waitq,
+                               sa_has_callback(sai) ||
+                               !thread_is_running(sa_thread));
 
                sa_handle_callback(sai);
        }
@@ -1179,9 +1170,8 @@ out:
 
                CDEBUG(D_READA, "stop agl thread: sai %p pid %u\n",
                       sai, (unsigned int)agl_thread->t_pid);
-               l_wait_event(agl_thread->t_ctl_waitq,
-                            thread_is_stopped(agl_thread),
-                            &lwi);
+               wait_event_idle(agl_thread->t_ctl_waitq,
+                               thread_is_stopped(agl_thread));
        } else {
                /* Set agl_thread flags anyway. */
                thread_set_flags(agl_thread, SVC_STOPPED);
@@ -1191,10 +1181,9 @@ out:
         * safely because statahead RPC will access sai data */
        while (sai->sai_sent != sai->sai_replied) {
                /* in case we're not woken up, timeout wait */
-               lwi = LWI_TIMEOUT(msecs_to_jiffies(MSEC_PER_SEC >> 3),
-                                 NULL, NULL);
-               l_wait_event(sa_thread->t_ctl_waitq,
-                       sai->sai_sent == sai->sai_replied, &lwi);
+               wait_event_idle_timeout(sa_thread->t_ctl_waitq,
+                                       sai->sai_sent == sai->sai_replied,
+                                       cfs_time_seconds(1) >> 3);
        }
 
        /* release resources held by statahead RPCs */
@@ -1314,8 +1303,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
                        struct ll_inode_info *lli = ll_i2info(dir);
 
                        rc = PTR_ERR(page);
-                       CERROR("%s: reading dir "DFID" at %llu"
-                              "opendir_pid = %u : rc = %d\n",
+                       CERROR("%s: reading dir "DFID" at %llu opendir_pid = %u : rc = %d\n",
                               ll_i2sbi(dir)->ll_fsname,
                               PFID(ll_inode2fid(dir)), pos,
                               lli->lli_opendir_pid, rc);
@@ -1420,7 +1408,6 @@ static int revalidate_statahead_dentry(struct inode *dir,
                                        bool unplug)
 {
        struct sa_entry *entry = NULL;
-       struct l_wait_info lwi = { 0 };
        struct ll_dentry_data *ldd;
        struct ll_inode_info *lli = ll_i2info(dir);
        int rc = 0;
@@ -1468,10 +1455,9 @@ static int revalidate_statahead_dentry(struct inode *dir,
                spin_lock(&lli->lli_sa_lock);
                sai->sai_index_wait = entry->se_index;
                spin_unlock(&lli->lli_sa_lock);
-               lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,
-                                      LWI_ON_SIGNAL_NOOP, NULL);
-               rc = l_wait_event(sai->sai_waitq, sa_ready(entry), &lwi);
-               if (rc < 0) {
+               rc = wait_event_idle_timeout(sai->sai_waitq, sa_ready(entry),
+                                            cfs_time_seconds(30));
+               if (rc == 0) {
                        /*
                         * entry may not be ready, so it may be used by inflight
                         * statahead RPC, don't free it.
@@ -1564,7 +1550,6 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry)
        struct ll_statahead_info *sai = NULL;
        struct dentry *parent = dentry->d_parent;
        struct ptlrpc_thread *thread;
-       struct l_wait_info lwi = { 0 };
        struct task_struct *task;
        struct ll_sb_info *sbi = ll_i2sbi(parent->d_inode);
        int first = LS_FIRST_DE;
@@ -1619,9 +1604,8 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry)
                GOTO(out, rc);
        }
 
-       l_wait_event(thread->t_ctl_waitq,
-                    thread_is_running(thread) || thread_is_stopped(thread),
-                    &lwi);
+       wait_event_idle(thread->t_ctl_waitq,
+                       thread_is_running(thread) || thread_is_stopped(thread));
        ll_sai_put(sai);
 
        /*