From patchwork Fri Oct 13 15:56:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13421070 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 60F14CDB482 for ; Fri, 13 Oct 2023 15:58:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 208528001E; Fri, 13 Oct 2023 11:58:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18FD78D0015; Fri, 13 Oct 2023 11:58:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE3AB8001E; Fri, 13 Oct 2023 11:58:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C90718D0015 for ; Fri, 13 Oct 2023 11:58:00 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9596A1A036E for ; Fri, 13 Oct 2023 15:58:00 +0000 (UTC) X-FDA: 81340894320.20.A1B271E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id E3B6DA0020 for ; Fri, 13 Oct 2023 15:57:58 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Q0V/oTM1"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1697212678; 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=gcj4568/Cja75cJgRJVpO1Pa05t3rY5GzidcrAxRiJc=; b=MqAXSpEK7a+Z6dWn/53TM2LNPDaGeY881/uiIGgHdWyMbgOIOSVzeJWJtf2KiU+7BzJBV9 UwGmQ4qRqDqZck+t1lPsOAGtZYs3/c7l56LTQZvBk7pkarN2lZ6rBp6FlTp3PFeS4Z0DW+ haaAsUAxNLt0Dsdzf/YdvCzMeKOb8A8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Q0V/oTM1"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697212678; a=rsa-sha256; cv=none; b=wzMgjeb61QM5kXi8jxSn1x0lWCba378n1XLbtH85WjZZO48vfcBjehDJ6LA+GFxcqcPsFo Zxf/1Kk1Z7YCHacXGkav4RGpGXDIqf1NizpOBcb3wwuRJRHvdL6YegH7rxe5ERt2V8y4Df LfqcZk/U3B2CzBM+mweQRXax1nDddH8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697212678; 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=gcj4568/Cja75cJgRJVpO1Pa05t3rY5GzidcrAxRiJc=; b=Q0V/oTM1jytjTmOXIuc/wq1OQaU1UsTAPe+Qc2rGPkXwKU8XOyXlZEH8iMUFBlCyFlPSrK Vq/vXp0rC61qEZbfJhunxg1mEHfZnbkESOvgKDO9YuEubBavg60WQQFdJO0e1gDh1Jtwle dsaXL8WVefc3FaITitQSb7MKsQd5E+w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-pbz5bDgbMkSmeASAhSIaXA-1; Fri, 13 Oct 2023 11:57:46 -0400 X-MC-Unique: pbz5bDgbMkSmeASAhSIaXA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EB33862F29; Fri, 13 Oct 2023 15:57:45 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0621C492BD9; Fri, 13 Oct 2023 15:57:42 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Dominique Martinet , Ilya Dryomov , Christian Brauner , 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, linux-cachefs@redhat.com Subject: [RFC PATCH 04/53] netfs: Allow the netfs to make the io (sub)request alloc larger Date: Fri, 13 Oct 2023 16:56:37 +0100 Message-ID: <20231013155727.2217781-5-dhowells@redhat.com> In-Reply-To: <20231013155727.2217781-1-dhowells@redhat.com> References: <20231013155727.2217781-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Rspamd-Queue-Id: E3B6DA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8yNNGrU Vpx5eU8w+sOTDpSXe9vf75foWNaXgNY834rXrq4PluSitUXqwQHWzi2nZCWTabipkixng/IT+LIxforgh4BuFwpQwPyYsbMXHuKVph3q7LLWrkjvU0D05NxBs9vsEzRgT3MXM4QOfbiu5iiOmWmJDgbfYD8XPxKC8vaojgnr+VksSSuJKU/yfazRJZ7qLilEouzJ6kd8NXV6yxySOas8BW2dKqx2ChZnku3vCAeC87hXVUjIk9PN4WCBc0cyU+rv5kk5OJpGfsbQiq44VGitcA95bFKKz1P/5sbJXzZf4F5Muw8o= 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: 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 cc: 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 e41f9fc9bdd2..2f1865ff7cce 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); @@ -116,7 +117,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 b92e982ac4a0..6942b8cf03dc 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -214,6 +214,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); int (*begin_cache_operation)(struct netfs_io_request *rreq);