From: Wang Shilong Date: Thu, 30 Apr 2020 11:42:29 +0000 (+0800) Subject: LU-13490 lustre: fix to make jobstats work for async ra X-Git-Tag: 2.13.54~104 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=da8972322134ae5741e7176312fca1f980c0f69a LU-13490 lustre: fix to make jobstats work for async ra 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 Reviewed-on: https://review.whamcloud.com/38426 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 0ca22e4..150e6a8 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -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; diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index da9e04c..b8404a9 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -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;