staging: lustre: llite: do post work for statahead in readdir case
authorwang di <di.wang@intel.com>
Fri, 22 Jul 2016 02:44:11 +0000 (22:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 16:31:07 +0000 (18:31 +0200)
Increase the post-work for the statahead thread in the readdir
case since it can become very busy.

Signed-off-by: wang di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10761
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/llite_internal.h
drivers/staging/lustre/lustre/llite/statahead.c

index e650aeb1b89c3186d2aeb7930f1666da49addc40..dc159570698c4de38e9b9805588c7f1891e3db58 100644 (file)
@@ -997,7 +997,8 @@ struct ll_statahead_info {
        unsigned int        sai_ls_all:1,   /* "ls -al", do stat-ahead for
                                             * hidden entries
                                             */
-                               sai_agl_valid:1;/* AGL is valid for the dir */
+                               sai_agl_valid:1,/* AGL is valid for the dir */
+                               sai_in_readpage:1;/* statahead is in readdir() */
        wait_queue_head_t       sai_waitq;      /* stat-ahead wait queue */
        struct ptlrpc_thread    sai_thread;     /* stat-ahead thread */
        struct ptlrpc_thread    sai_agl_thread; /* AGL thread */
index df51f145ad5d3220839c5a0c2b9e2de49dda18c2..54ed52e344b94d389b8fc5c37a5f5964bf12f9d9 100644 (file)
@@ -1231,7 +1231,9 @@ do_it:
                         */
                        ll_release_page(page, le32_to_cpu(dp->ldp_flags) &
                                              LDF_COLLIDE);
+                       sai->sai_in_readpage = 1;
                        page = ll_get_dir_page(dir, pos, &chain);
+                       sai->sai_in_readpage = 0;
                }
        }
 
@@ -1550,6 +1552,11 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
                        return entry ? 1 : -EAGAIN;
                }
 
+               /* if statahead is busy in readdir, help it do post-work */
+               while (!ll_sa_entry_stated(entry) && sai->sai_in_readpage &&
+                      !sa_received_empty(sai))
+                       ll_post_statahead(sai);
+
                if (!ll_sa_entry_stated(entry)) {
                        sai->sai_index_wait = entry->se_index;
                        lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,