Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp561868lqs; Thu, 13 Jun 2024 20:44:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKZAckcs0YPhD5Sret8hW+Am7UwWNC1t+017DW9nTI3XDzU6WrCCSP/jdpUvayz/T/BIqi8WcPBSNTk1wRJsn3o3RV0ieJ6XOMnMcxLQ== X-Google-Smtp-Source: AGHT+IH9qSYt7mARMHDmZ1XBtrl1GBNPQ8bxY/XQrEQVQrfNtGnCYqsS4vbuw55tP23TD6VyWgIs X-Received: by 2002:a17:906:c309:b0:a6f:38d0:a3ce with SMTP id a640c23a62f3a-a6f60d294ccmr88173466b.27.1718336677177; Thu, 13 Jun 2024 20:44:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718336677; cv=pass; d=google.com; s=arc-20160816; b=CUHsvBb8wP/q36njFzhQiCxnEyXxdHOOixhQQ10+fcuLos7Z0DixvtjWP80JzMlTSw GqRyv8i7SvNUmAb8P1CIU9tLpn5ZhbBFWAkUOfmYJbBIycSMPMpXmQJujqh5kRTjuKXY qtCPqwQ4CaTiKM7BwJVKFpXTgu5jKnoZHS8+RkEJ1qoWIF49wbk6C0oQI1VpLfBJ+VSF jpFAVQOwMB7Y8qUAbc9EkWf6qFJnOk8oUSM9qanT62FXhXeNomWnbmcwwdir4fFL/Ekd C6x+LN2kbKQ6ODFrfNnllkdB80/lfqCFf4mIYfnblwFL1KOQbfFuPEL2+3EE5l+nY0Bo tKxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7sPbOHVxo/caHF9OjlPdhLEmN3etuFyHDf3FpWPRmfI=; fh=+HdF1SWcNPggmowVZtzfZ2+SYSXLLgvZBECjaw6UQek=; b=MjBUZ1iUJgL4oKfe+05N/iXLdnwtNwCiVcf5jt4zRg0PM2SPzYvMH9ouNAokXzka7+ VEv+5MRWqHkpHVXgYUbZJ1ZyB2fYk4+nsYq6lV+RXxQ9OK5lz3rkTeHLi9ZwV5yq+JP/ etnfukJVBBc1AZNHtEws4C5FWccHJC9j5Sr1ZSVA52Y06eFbwL5G+ElGcSEjJkoYuL6d RwVHgWu6pL9pKc3DQyyvTQv/nEYl8+PwUAwB0oG6BntPkS7C2ZvWHxl5e44SB7GSjT+H PvZz/0Uf5pZx+syc0ICPPRHrFKOgKeUcoXZMUiURHT8xKocY49o3WBthGy72wVcp4zS/ C1VQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gsxibX6Y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3802-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56e3cacfsi126953766b.806.2024.06.13.20.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 20:44:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3802-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gsxibX6Y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3802-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B11521F240BC for ; Fri, 14 Jun 2024 03:44:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DB5E146A83; Fri, 14 Jun 2024 03:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gsxibX6Y" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDDC9ECC for ; Fri, 14 Jun 2024 03:44:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718336671; cv=none; b=BcFd2zvK1rP2EXHgcDdH2HswrBcPizc6aHXRVXvoVGuGBYttxIm5g1OXVPZ9NlTokNmNmgrcwNn5pbxoEU9B99WxW7/0uH6O4Ze0sRdD0SYWdti7jzrLgKolCvD3nFwAGtuYZ37WXZx7hU4kAV7sd5aLoHnZwQGf3ByXysS/iMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718336671; c=relaxed/simple; bh=YJoyVHLFZHGnnH7iXlxdzrZ6OyrIVltCHpztKjaNMD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y/ky37a5qHkOFZ8gHKJtVvd6rKnGc9gV+TKnv2QLsb0knEa/mKBzCkSa/a3i8i/Nd96olKtxd6tBInK9qrFmMoZyX5/DLwKroIW5w50O9xg7Csz+Dj6DCfsOU38kza1O1cxA0YdnpX3hoY9PcX1BZ9CWkW3bpWFlpFZHJaA96nE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gsxibX6Y; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50599C4AF1D; Fri, 14 Jun 2024 03:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718336670; bh=YJoyVHLFZHGnnH7iXlxdzrZ6OyrIVltCHpztKjaNMD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gsxibX6YYcjAv+t/4pCMSfculsyQG8UDirsGBkAeWfqFEZV3UChbm3Sblf1H08zG7 ZhNY2rr0sbkmqFBAIqBM52Ax+Ef8+boIZVu/Ue4ItfPmcqQu8WPS1m18BaRaplAOyf H2KqWJ3Nsl1qclbbcjAFN40EZOZMlUjL3Rqyw3/QPy8XKBWpzBq8OPV78vP76S0jOl woSll/0A7VcXFT3viJc2btf+5EWmaJP0ZpS7y96ksRd2mXADug5tx2giQlZJtOq9wj 2CkdFAfJSxqjYva2gV7uMgN7UBO+G1C4pX8ix9rKAo+eK/3HHbKtUv98H3kJ2dOCIx 3/QPTUJdmu8vA== From: Mike Snitzer To: linux-nfs@vger.kernel.org Cc: Jeff Layton , Chuck Lever , Trond Myklebust , NeilBrown , snitzer@hammerspace.com Subject: [PATCH v3 02/18] nfs: pass descriptor thru nfs_initiate_pgio path Date: Thu, 13 Jun 2024 23:44:10 -0400 Message-ID: <20240614034426.31043-3-snitzer@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240614034426.31043-1-snitzer@kernel.org> References: <20240614034426.31043-1-snitzer@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Weston Andros Adamson This is needed for localio support. Signed-off-by: Weston Andros Adamson Signed-off-by: Peng Tao Signed-off-by: Lance Shelton Signed-off-by: Trond Myklebust Signed-off-by: Mike Snitzer --- fs/nfs/blocklayout/blocklayout.c | 6 ++++-- fs/nfs/filelayout/filelayout.c | 10 ++++++---- fs/nfs/flexfilelayout/flexfilelayout.c | 10 ++++++---- fs/nfs/internal.h | 6 +++--- fs/nfs/pagelist.c | 6 ++++-- fs/nfs/pnfs.c | 24 +++++++++++++----------- fs/nfs/pnfs.h | 6 ++++-- 7 files changed, 40 insertions(+), 28 deletions(-) diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 6be13e0ec170..6a61ddd1835f 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c @@ -227,7 +227,8 @@ bl_end_par_io_read(void *data) } static enum pnfs_try_status -bl_read_pagelist(struct nfs_pgio_header *header) +bl_read_pagelist(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *header) { struct pnfs_block_layout *bl = BLK_LSEG2EXT(header->lseg); struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; @@ -372,7 +373,8 @@ static void bl_end_par_io_write(void *data) } static enum pnfs_try_status -bl_write_pagelist(struct nfs_pgio_header *header, int sync) +bl_write_pagelist(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *header, int sync) { struct pnfs_block_layout *bl = BLK_LSEG2EXT(header->lseg); struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 43e16e9e0176..f9b600c4a2b5 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c @@ -447,7 +447,8 @@ static const struct rpc_call_ops filelayout_commit_call_ops = { }; static enum pnfs_try_status -filelayout_read_pagelist(struct nfs_pgio_header *hdr) +filelayout_read_pagelist(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr) { struct pnfs_layout_segment *lseg = hdr->lseg; struct nfs4_pnfs_ds *ds; @@ -486,7 +487,7 @@ filelayout_read_pagelist(struct nfs_pgio_header *hdr) hdr->mds_offset = offset; /* Perform an asynchronous read to ds */ - nfs_initiate_pgio(ds->ds_clp, ds_clnt, hdr, hdr->cred, + nfs_initiate_pgio(desc, ds->ds_clp, ds_clnt, hdr, hdr->cred, NFS_PROTO(hdr->inode), &filelayout_read_call_ops, 0, RPC_TASK_SOFTCONN); return PNFS_ATTEMPTED; @@ -494,7 +495,8 @@ filelayout_read_pagelist(struct nfs_pgio_header *hdr) /* Perform async writes. */ static enum pnfs_try_status -filelayout_write_pagelist(struct nfs_pgio_header *hdr, int sync) +filelayout_write_pagelist(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr, int sync) { struct pnfs_layout_segment *lseg = hdr->lseg; struct nfs4_pnfs_ds *ds; @@ -528,7 +530,7 @@ filelayout_write_pagelist(struct nfs_pgio_header *hdr, int sync) hdr->args.offset = filelayout_get_dserver_offset(lseg, offset); /* Perform an asynchronous write */ - nfs_initiate_pgio(ds->ds_clp, ds_clnt, hdr, hdr->cred, + nfs_initiate_pgio(desc, ds->ds_clp, ds_clnt, hdr, hdr->cred, NFS_PROTO(hdr->inode), &filelayout_write_call_ops, sync, RPC_TASK_SOFTCONN); return PNFS_ATTEMPTED; diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 327f1a5c9fbe..22c0e8014afb 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1751,7 +1751,8 @@ static const struct rpc_call_ops ff_layout_commit_call_ops_v4 = { }; static enum pnfs_try_status -ff_layout_read_pagelist(struct nfs_pgio_header *hdr) +ff_layout_read_pagelist(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr) { struct pnfs_layout_segment *lseg = hdr->lseg; struct nfs4_pnfs_ds *ds; @@ -1803,7 +1804,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) hdr->mds_offset = offset; /* Perform an asynchronous read to ds */ - nfs_initiate_pgio(ds->ds_clp, ds_clnt, hdr, ds_cred, + nfs_initiate_pgio(desc, ds->ds_clp, ds_clnt, hdr, ds_cred, ds->ds_clp->rpc_ops, vers == 3 ? &ff_layout_read_call_ops_v3 : &ff_layout_read_call_ops_v4, @@ -1822,7 +1823,8 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) /* Perform async writes. */ static enum pnfs_try_status -ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync) +ff_layout_write_pagelist(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr, int sync) { struct pnfs_layout_segment *lseg = hdr->lseg; struct nfs4_pnfs_ds *ds; @@ -1872,7 +1874,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync) hdr->args.offset = offset; /* Perform an asynchronous write */ - nfs_initiate_pgio(ds->ds_clp, ds_clnt, hdr, ds_cred, + nfs_initiate_pgio(desc, ds->ds_clp, ds_clnt, hdr, ds_cred, ds->ds_clp->rpc_ops, vers == 3 ? &ff_layout_write_call_ops_v3 : &ff_layout_write_call_ops_v4, diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index a9c0c29f7804..f6e56fdd8bc2 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -306,9 +306,9 @@ extern const struct nfs_pageio_ops nfs_pgio_rw_ops; struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *); void nfs_pgio_header_free(struct nfs_pgio_header *); int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *); -int nfs_initiate_pgio(struct nfs_client *clp, struct rpc_clnt *rpc_clnt, - struct nfs_pgio_header *hdr, const struct cred *cred, - const struct nfs_rpc_ops *rpc_ops, +int nfs_initiate_pgio(struct nfs_pageio_descriptor *, struct nfs_client *clp, + struct rpc_clnt *rpc_clnt, struct nfs_pgio_header *hdr, + const struct cred *cred, const struct nfs_rpc_ops *rpc_ops, const struct rpc_call_ops *call_ops, int how, int flags); void nfs_free_request(struct nfs_page *req); struct nfs_pgio_mirror * diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index d9b795c538cd..3786d767e2ff 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -844,7 +844,8 @@ static void nfs_pgio_prepare(struct rpc_task *task, void *calldata) rpc_exit(task, err); } -int nfs_initiate_pgio(struct nfs_client *clp, struct rpc_clnt *rpc_clnt, +int nfs_initiate_pgio(struct nfs_pageio_descriptor *desc, + struct nfs_client *clp, struct rpc_clnt *rpc_clnt, struct nfs_pgio_header *hdr, const struct cred *cred, const struct nfs_rpc_ops *rpc_ops, const struct rpc_call_ops *call_ops, int how, int flags) @@ -1071,7 +1072,8 @@ static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) if (ret == 0) { if (NFS_SERVER(hdr->inode)->nfs_client->cl_minorversion) task_flags = RPC_TASK_MOVEABLE; - ret = nfs_initiate_pgio(NFS_SERVER(hdr->inode)->nfs_client, + ret = nfs_initiate_pgio(desc, + NFS_SERVER(hdr->inode)->nfs_client, NFS_CLIENT(hdr->inode), hdr, hdr->cred, diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index b5834728f31b..c9015179b72c 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2885,10 +2885,11 @@ pnfs_write_through_mds(struct nfs_pageio_descriptor *desc, } static enum pnfs_try_status -pnfs_try_to_write_data(struct nfs_pgio_header *hdr, - const struct rpc_call_ops *call_ops, - struct pnfs_layout_segment *lseg, - int how) +pnfs_try_to_write_data(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr, + const struct rpc_call_ops *call_ops, + struct pnfs_layout_segment *lseg, + int how) { struct inode *inode = hdr->inode; enum pnfs_try_status trypnfs; @@ -2898,7 +2899,7 @@ pnfs_try_to_write_data(struct nfs_pgio_header *hdr, dprintk("%s: Writing ino:%lu %u@%llu (how %d)\n", __func__, inode->i_ino, hdr->args.count, hdr->args.offset, how); - trypnfs = nfss->pnfs_curr_ld->write_pagelist(hdr, how); + trypnfs = nfss->pnfs_curr_ld->write_pagelist(desc, hdr, how); if (trypnfs != PNFS_NOT_ATTEMPTED) nfs_inc_stats(inode, NFSIOS_PNFS_WRITE); dprintk("%s End (trypnfs:%d)\n", __func__, trypnfs); @@ -2913,7 +2914,7 @@ pnfs_do_write(struct nfs_pageio_descriptor *desc, struct pnfs_layout_segment *lseg = desc->pg_lseg; enum pnfs_try_status trypnfs; - trypnfs = pnfs_try_to_write_data(hdr, call_ops, lseg, how); + trypnfs = pnfs_try_to_write_data(desc, hdr, call_ops, lseg, how); switch (trypnfs) { case PNFS_NOT_ATTEMPTED: pnfs_write_through_mds(desc, hdr); @@ -3012,9 +3013,10 @@ pnfs_read_through_mds(struct nfs_pageio_descriptor *desc, * Call the appropriate parallel I/O subsystem read function. */ static enum pnfs_try_status -pnfs_try_to_read_data(struct nfs_pgio_header *hdr, - const struct rpc_call_ops *call_ops, - struct pnfs_layout_segment *lseg) +pnfs_try_to_read_data(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr, + const struct rpc_call_ops *call_ops, + struct pnfs_layout_segment *lseg) { struct inode *inode = hdr->inode; struct nfs_server *nfss = NFS_SERVER(inode); @@ -3025,7 +3027,7 @@ pnfs_try_to_read_data(struct nfs_pgio_header *hdr, dprintk("%s: Reading ino:%lu %u@%llu\n", __func__, inode->i_ino, hdr->args.count, hdr->args.offset); - trypnfs = nfss->pnfs_curr_ld->read_pagelist(hdr); + trypnfs = nfss->pnfs_curr_ld->read_pagelist(desc, hdr); if (trypnfs != PNFS_NOT_ATTEMPTED) nfs_inc_stats(inode, NFSIOS_PNFS_READ); dprintk("%s End (trypnfs:%d)\n", __func__, trypnfs); @@ -3058,7 +3060,7 @@ pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) struct pnfs_layout_segment *lseg = desc->pg_lseg; enum pnfs_try_status trypnfs; - trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg); + trypnfs = pnfs_try_to_read_data(desc, hdr, call_ops, lseg); switch (trypnfs) { case PNFS_NOT_ATTEMPTED: pnfs_read_through_mds(desc, hdr); diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index fa5beeaaf5da..92acb837cfa6 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -157,8 +157,10 @@ struct pnfs_layoutdriver_type { * Return PNFS_ATTEMPTED to indicate the layout code has attempted * I/O, else return PNFS_NOT_ATTEMPTED to fall back to normal NFS */ - enum pnfs_try_status (*read_pagelist)(struct nfs_pgio_header *); - enum pnfs_try_status (*write_pagelist)(struct nfs_pgio_header *, int); + enum pnfs_try_status (*read_pagelist)(struct nfs_pageio_descriptor *, + struct nfs_pgio_header *); + enum pnfs_try_status (*write_pagelist)(struct nfs_pageio_descriptor *, + struct nfs_pgio_header *, int); void (*free_deviceid_node) (struct nfs4_deviceid_node *); struct nfs4_deviceid_node * (*alloc_deviceid_node) -- 2.44.0