Whamcloud - gitweb
LU-13490 lustre: fix to make jobstats work for async ra 26/38426/4
authorWang Shilong <wshilong@ddn.com>
Thu, 30 Apr 2020 11:42:29 +0000 (19:42 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 14 May 2020 05:39:26 +0000 (05:39 +0000)
We use workqueue to triger async readahead, this will make
the problem that read jobstats are not accounted by real
IO, we could fix this by overwritting jobid which inited in
vvp_io_init().

Change-Id: I20b00b17f7a90cf94f1e5be54f47aee8ea2e5440
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/38426
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Ben Evans <beevans@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/llite_internal.h
lustre/llite/rw.c

index 0ca22e4..150e6a8 100644 (file)
@@ -801,6 +801,7 @@ struct ll_readahead_work {
 
        /* async worker to handler read */
        struct work_struct               lrw_readahead_work;
+       char                             lrw_jobid[LUSTRE_JOBID_SIZE];
 };
 
 extern struct kmem_cache *ll_file_data_slab;
index da9e04c..b8404a9 100644 (file)
@@ -617,6 +617,12 @@ static void ll_readahead_handle_work(struct work_struct *wq)
        if (rc)
                GOTO(out_put_env, rc);
 
+       /* overwrite jobid inited in vvp_io_init() */
+       if (strncmp(ll_i2info(inode)->lli_jobid, work->lrw_jobid,
+                   sizeof(work->lrw_jobid)))
+               memcpy(ll_i2info(inode)->lli_jobid, work->lrw_jobid,
+                      sizeof(work->lrw_jobid));
+
        vvp_env_io(env)->vui_io_subtype = IO_NORMAL;
        vvp_env_io(env)->vui_fd = fd;
        io->ci_state = CIS_LOCKED;
@@ -1577,6 +1583,8 @@ static int kickoff_async_readahead(struct file *file, unsigned long pages)
                ras->ras_next_readahead_idx = end_idx + 1;
                ras->ras_async_last_readpage_idx = start_idx;
                spin_unlock(&ras->ras_lock);
+               memcpy(lrw->lrw_jobid, ll_i2info(inode)->lli_jobid,
+                      sizeof(lrw->lrw_jobid));
                ll_readahead_work_add(inode, lrw);
        } else {
                return -ENOMEM;