From patchwork Thu Dec 21 13:23:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13501923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CECF8C35274 for ; Thu, 21 Dec 2023 13:24:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86E808D0017; Thu, 21 Dec 2023 08:24:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F36D8D0014; Thu, 21 Dec 2023 08:24:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61FD18D0017; Thu, 21 Dec 2023 08:24:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4DCB08D0014 for ; Thu, 21 Dec 2023 08:24:47 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2DD89140CB7 for ; Thu, 21 Dec 2023 13:24:47 +0000 (UTC) X-FDA: 81590895414.26.37B5B66 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 84A5CC001F for ; Thu, 21 Dec 2023 13:24:45 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IYVIOrkP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf10.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703165085; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OUiNmCjPvqOiTp/4UL00+cVpBnekg0L/g2EBDkgOp3k=; b=7um4hVbbgP/qLad9fhRk4eV8vxminH1L+Csj/dKhyVpgdUKZjgC4yhtjYLRP5DgJWLzW3q bVcaTTfxYihxUlgS5t/v/TFQFCQeoR7iaiHoOHC4RowBMvQ619OeouOPbS43/P6JvgKPQj IpGjQrfkZAYTJmFR1KAI+wCfmYeFidg= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IYVIOrkP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf10.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703165085; a=rsa-sha256; cv=none; b=3DY52myxqWrJ7nWWePqiH+MHBGEY9OREYanPUKDoENhysQo30Pvp2Rrd26bmYADEZpb3gV uHGTgdUdlZD6hhsKogjNjxM+jge6wFshh58HdJcCC5hP0IsogV7UO84dQ/SjTRsdO+35UP TOWhpZdRL7Tn+w3QzW57pY2dltaCeB4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703165084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OUiNmCjPvqOiTp/4UL00+cVpBnekg0L/g2EBDkgOp3k=; b=IYVIOrkPLQSEGXEphPBOgvz31yzQXZX32sdbcIH18ZhQNJG3Z7oNVJcXHTA0e2LAO55b7G Zj+2MHZNOdTi7aedbBL8DwEu/R/wtwquF2vLMnTKrrY2zHRN106tBH+SRVwfou5NOl7mC4 Im28zAZn7RNY51PT4oZqkX6EZGcAiUs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-SL0um2dhP2aWOnnR2kR2cw-1; Thu, 21 Dec 2023 08:24:41 -0500 X-MC-Unique: SL0um2dhP2aWOnnR2kR2cw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E6B2185A78A; Thu, 21 Dec 2023 13:24:40 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.39.195.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FD1B40C6EB9; Thu, 21 Dec 2023 13:24:37 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Eric Van Hensbergen , Ilya Dryomov , Christian Brauner , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 09/40] netfs: Allow the netfs to make the io (sub)request alloc larger Date: Thu, 21 Dec 2023 13:23:04 +0000 Message-ID: <20231221132400.1601991-10-dhowells@redhat.com> In-Reply-To: <20231221132400.1601991-1-dhowells@redhat.com> References: <20231221132400.1601991-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Rspamd-Queue-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th/OOJ3hEFhzaQ/QBs4M7DFnh X+nkwjtR F1izjZSaOW7+PkfNGHR5jpHmNm6HfrRg2UWbSzjbWZJz+sNZvRmq/yzONHP8Iv3wGlwYSMdj4gbTg5Un5lu3ihisWzC3bu174LdTrHtyo2nONg2t01yXfzN/IMf/RHhcUhkwmTNrzEcGhj0rRr3PRvPnxq/UVYuraPxLEjNc1LKzzlEOWSZXCf8cfzsUH6DadO5XNJgjYcp1/rqQmzmysu56uLN3RRpih3sTt8cU+j2J2c5FQ0lCcFIOsznSvhCG7sGfP8KBdW06p4NwmApY3TKgebFSqoW9uqAsSPB+QCmPkktM= 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: List-Subscribe: List-Unsubscribe: Allow the network filesystem to specify extra space to be allocated on the end of the io (sub)request. This allows cifs, for example, to use this space rather than allocating its own cifs_readdata struct. Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/objects.c | 7 +++++-- include/linux/netfs.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c index 85f428fc52e6..c4229c5f3f54 100644 --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -22,7 +22,8 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping, struct netfs_io_request *rreq; int ret; - rreq = kzalloc(sizeof(struct netfs_io_request), GFP_KERNEL); + rreq = kzalloc(ctx->ops->io_request_size ?: sizeof(struct netfs_io_request), + GFP_KERNEL); if (!rreq) return ERR_PTR(-ENOMEM); @@ -114,7 +115,9 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq { struct netfs_io_subrequest *subreq; - subreq = kzalloc(sizeof(struct netfs_io_subrequest), GFP_KERNEL); + subreq = kzalloc(rreq->netfs_ops->io_subrequest_size ?: + sizeof(struct netfs_io_subrequest), + GFP_KERNEL); if (subreq) { INIT_LIST_HEAD(&subreq->rreq_link); refcount_set(&subreq->ref, 2); diff --git a/include/linux/netfs.h b/include/linux/netfs.h index 7244ddebd974..d6f27000eeb0 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -210,6 +210,8 @@ struct netfs_io_request { * Operations the network filesystem can/must provide to the helpers. */ struct netfs_request_ops { + unsigned int io_request_size; /* Alloc size for netfs_io_request struct */ + unsigned int io_subrequest_size; /* Alloc size for netfs_io_subrequest struct */ int (*init_request)(struct netfs_io_request *rreq, struct file *file); void (*free_request)(struct netfs_io_request *rreq);