Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp145817rdb; Thu, 21 Dec 2023 05:28:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqMsxS0NsvoR7SSBHnoFUmJcKqnKNCHuFWcgXmSvqeUAksKD6QGp9MHyioHXyBbp/5dpX7 X-Received: by 2002:a05:6214:19c8:b0:67f:2cd8:6bd with SMTP id j8-20020a05621419c800b0067f2cd806bdmr11286854qvc.73.1703165336571; Thu, 21 Dec 2023 05:28:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703165336; cv=none; d=google.com; s=arc-20160816; b=Bxc4ICLKHowDeOk9SAgemtBUDf9eOMUdoxeqIDoy4Kajy5gaiLxKF4Y3c17+9Kdazb 4F+e1bDwTKlKTJtyUC3PcBrAbt388V/D8PT/CpdpL4O00xm3AQjmrc78wR3W9PQYmA2B dZ7LyNM3nHCeRuK7L0gZKhCRiV5GI568WRe8njPtHFd98YxK/4eTaLOte63pmJAN/60x zA7tXSFW9hZACaGULcZuuMunhq6us/xgfTG9pQzCJzE340HCXT1zmeNM/Ks/60+dMaQi b107W7ohAI6890MVnyA81C+ozn8gg+LimbV4dJ0jzisU//JxtKc5R33GW5Y1+ORBtC2n ruZg== ARC-Message-Signature: i=1; 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=OUiNmCjPvqOiTp/4UL00+cVpBnekg0L/g2EBDkgOp3k=; fh=ib4gl95HfLmZdfX9QIMf3rTepWCH9JlNymcDKJTPhJg=; b=xTzTQrmuaUu4Df40mxrLssPumGyByQVOqgO0+fpnDSOmDPWyq/vZmS/rcRe4cU4uSj iUD8Q/Bjnxx4kt/JjKs4ecwdSw4E9AS7r6YXnLU8n3tBKHye2k2+dypow61rMeda43k7 berhG7JhujxVGdPe9PAWf1lRxvjQ57EBwe+NoNTQDMQwRFMWii76doyjfh8XL4hM1DAg ZyW3CAcpMzAcq7J1cQzC5HZwr6wezglRP5iSHqIAp7mbrBG9klZUsOCvdqkWnsTgDaud 8qv5Z6+ytapTek6IIsssqwQJ8EX0LOKL9CvSC6mhw2veE9XBms2EL6W04HOxM/dYP4Al BZ+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DQMSBwS2; spf=pass (google.com: domain of linux-kernel+bounces-8454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k1-20020a0cf281000000b0067f8a6faa71si519518qvl.224.2023.12.21.05.28.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 05:28:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DQMSBwS2; spf=pass (google.com: domain of linux-kernel+bounces-8454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4C4CF1C2106A for ; Thu, 21 Dec 2023 13:28:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F18D07AE6D; Thu, 21 Dec 2023 13:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DQMSBwS2" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 D09AE7A229 for ; Thu, 21 Dec 2023 13:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703165083; 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=DQMSBwS2KB+Uz1rRg8mN55CWTFbEWmJLfpWk3XN+zS8aMq9WU0ZtbxK0WhSQG6xbDxUP2P K/PfDJtzTviqbiu5Qe66ry+6oIf9wrvqYgfE2HEsjMXwos0pZXL9pZZv7kbPnJ3GcSqo0A EqAudlc7/bHaADlbddBiomnSxlpjILM= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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);