From patchwork Wed Jul 21 13:44:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 12390965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8BACC12002 for ; Wed, 21 Jul 2021 13:45:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 55F7C6100C for ; Wed, 21 Jul 2021 13:45:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55F7C6100C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA9F16B0070; Wed, 21 Jul 2021 09:45:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5A2C6B0071; Wed, 21 Jul 2021 09:45:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4AC26B0073; Wed, 21 Jul 2021 09:45:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id B99A46B0070 for ; Wed, 21 Jul 2021 09:45:10 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6835A1854ADE2 for ; Wed, 21 Jul 2021 13:45:10 +0000 (UTC) X-FDA: 78386716380.31.AB4BF27 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 08EC83002906 for ; Wed, 21 Jul 2021 13:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626875109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J5baltngtCF+TZPYyjQGfSjHE6wKJdApaIxxJbNWIuk=; b=GQ58vZitHUMPR55/4FxSVf1rO5O/8QubNviFch0OukO8otx7BvKwZBtxBlexqaPtybw/K+ zkPRWxAPOH9x6kuATm4zeL33IfCMrXgULv1pkx3XURZtNfTBmpuQ4HA7GPkAbrFct9kCGy Psw99ZSYaIhCI029ekwxJRU49fR2XiM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-juduQtDvMdOf3GwQ6nMtaw-1; Wed, 21 Jul 2021 09:45:08 -0400 X-MC-Unique: juduQtDvMdOf3GwQ6nMtaw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07317804142; Wed, 21 Jul 2021 13:45:06 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-62.rdu2.redhat.com [10.10.112.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C4BB5DD86; Wed, 21 Jul 2021 13:44:53 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [RFC PATCH 02/12] netfs: Add an iov_iter to the read subreq for the network fs/cache to use From: David Howells To: linux-fsdevel@vger.kernel.org Cc: dhowells@redhat.com, Jeff Layton , "Matthew Wilcox (Oracle)" , Anna Schumaker , Steve French , Dominique Martinet , Mike Marshall , David Wysochanski , Shyam Prasad N , Miklos Szeredi , Linus Torvalds , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, devel@lists.orangefs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 21 Jul 2021 14:44:53 +0100 Message-ID: <162687509306.276387.7579641363406546284.stgit@warthog.procyon.org.uk> In-Reply-To: <162687506932.276387.14456718890524355509.stgit@warthog.procyon.org.uk> References: <162687506932.276387.14456718890524355509.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GQ58vZit; spf=none (imf09.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam02 X-Stat-Signature: bu9d9em6mtqdodgcji31unnx6og4fyfh X-Rspamd-Queue-Id: 08EC83002906 X-HE-Tag: 1626875109-861490 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add an iov_iter to the read subrequest and set it up to define the destination buffer to write into. This will allow future patches to point to a bounce buffer instead for purposes of handling oversize writes, decryption (where we want to save the encrypted data to the cache) and decompression. Signed-off-by: David Howells --- fs/afs/file.c | 6 +----- fs/netfs/read_helper.c | 5 ++++- include/linux/netfs.h | 2 ++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/afs/file.c b/fs/afs/file.c index c9c21ad0e7c9..ca529f23515a 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -319,11 +319,7 @@ static void afs_req_issue_op(struct netfs_read_subrequest *subreq) fsreq->len = subreq->len - subreq->transferred; fsreq->key = subreq->rreq->netfs_priv; fsreq->vnode = vnode; - fsreq->iter = &fsreq->def_iter; - - iov_iter_xarray(&fsreq->def_iter, READ, - &fsreq->vnode->vfs_inode.i_mapping->i_pages, - fsreq->pos, fsreq->len); + fsreq->iter = &subreq->iter; afs_fetch_data(fsreq->vnode, fsreq); } diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c index 0b6cd3b8734c..715f3e9c380d 100644 --- a/fs/netfs/read_helper.c +++ b/fs/netfs/read_helper.c @@ -150,7 +150,7 @@ static void netfs_clear_unread(struct netfs_read_subrequest *subreq) { struct iov_iter iter; - iov_iter_xarray(&iter, WRITE, &subreq->rreq->mapping->i_pages, + iov_iter_xarray(&iter, READ, &subreq->rreq->mapping->i_pages, subreq->start + subreq->transferred, subreq->len - subreq->transferred); iov_iter_zero(iov_iter_count(&iter), &iter); @@ -745,6 +745,9 @@ netfs_rreq_prepare_read(struct netfs_read_request *rreq, if (WARN_ON(subreq->len == 0)) source = NETFS_INVALID_READ; + iov_iter_xarray(&subreq->iter, READ, &rreq->mapping->i_pages, + subreq->start, subreq->len); + out: subreq->source = source; trace_netfs_sreq(subreq, netfs_sreq_trace_prepare); diff --git a/include/linux/netfs.h b/include/linux/netfs.h index fe9887768292..5e4fafcc9480 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -17,6 +17,7 @@ #include #include #include +#include /* * Overload PG_private_2 to give us PG_fscache - this is used to indicate that @@ -112,6 +113,7 @@ struct netfs_cache_resources { struct netfs_read_subrequest { struct netfs_read_request *rreq; /* Supervising read request */ struct list_head rreq_link; /* Link in rreq->subrequests */ + struct iov_iter iter; /* Iterator for this subrequest */ loff_t start; /* Where to start the I/O */ size_t len; /* Size of the I/O */ size_t transferred; /* Amount of data transferred */