From patchwork Mon May 25 22:07:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11569549 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D39990 for ; Mon, 25 May 2020 22:09:29 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1689E2071A for ; Mon, 25 May 2020 22:09:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1689E2071A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 6BB7A247097; Mon, 25 May 2020 15:09:04 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id CCAFA21FEF0 for ; Mon, 25 May 2020 15:08:36 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id 336D21005872; Mon, 25 May 2020 18:08:27 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 32C1849A; Mon, 25 May 2020 18:08:27 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 25 May 2020 18:07:58 -0400 Message-Id: <1590444502-20533-22-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590444502-20533-1-git-send-email-jsimmons@infradead.org> References: <1590444502-20533-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 21/45] lustre: llite: fix to make jobstats work for async ra X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wang Shilong , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Wang Shilong 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(). WC-bug-id: https://jira.whamcloud.com/browse/LU-13490 Lustre-commit: da8972322134a ("LU-13490 lustre: fix to make jobstats work for async ra") Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/38426 Reviewed-by: Andreas Dilger Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/llite_internal.h | 1 + fs/lustre/llite/rw.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h index c3f60bb..76715818 100644 --- a/fs/lustre/llite/llite_internal.h +++ b/fs/lustre/llite/llite_internal.h @@ -780,6 +780,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/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index 7018c7c..9e004f4 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -629,6 +629,12 @@ static void ll_readahead_handle_work(struct work_struct *wq) if (rc) goto out_put_env; + /* 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_fd = fd; io->ci_state = CIS_LOCKED; io->ci_async_readahead = true; @@ -1582,6 +1588,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;