Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5390295rdb; Wed, 13 Dec 2023 07:25:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH64gZ2k8ZUZqlHXFvu59Dx/PG8bypPa7IILzp51ndxPJhFBDjKo4GLPJp5VxcypzQ67OwC X-Received: by 2002:a05:6e02:1785:b0:35f:6607:28b0 with SMTP id y5-20020a056e02178500b0035f660728b0mr3196256ilu.17.1702481118561; Wed, 13 Dec 2023 07:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702481118; cv=none; d=google.com; s=arc-20160816; b=PBLWn8LB1+CyXr90R033aO/nkBXp8QtFJh81FfUStqjcwpRBnN9/fc+6K1XnVDaI1K SveAHgpdyf6XFSjL3DnaXNYQ/3AjfulyGY+dnq5wB1otjLKUMBKqHb9v9INZ6FEGdx+5 oRJ0lW4/WcUDTqTm3XlSWG9sJCga3P7JQMxMq6rFUfzAdfuNvVg+af9QUZW+0SiLPgYR Ji9QmVyyi7XT4/yCiU53pErk+IKb7xRWzW4fHixHG6/6cZNs5iXdav+Kv9QA0HLnn0ID 3bSNa12Tog5aX3Xv7S4i4/sA6X5y6KEim/bpZUsnhG7wXYh59jaEg9Ua9CG446KXP1Mb GohQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4hViO3AGp6pToaoN8VF8Iwb+OF6je+qeF4CeyLwe0vY=; fh=ib4gl95HfLmZdfX9QIMf3rTepWCH9JlNymcDKJTPhJg=; b=IIL/dWiTkM19tHIPFoYZC6vQv6o5mlA04V1EOCMit9oKDBX4N0x4p+1tRqjWYlZf0I 33Z+zwPZpsY3gOiqac6Q0lxdOX22Z9vrSzL+oAwRd2kYWKDYWkAyVHjEAkY7QjED3+DY eN4C8voAq7NrN7WUhNoWVxaXWozv2lCuF0TqeFPx5JfDynqMWxaDenpFj8W5h/ibniEf iOIEh1Dpn20DDj+cNmpdKseePo7+ldy4Ca1HXybkj958ZqUPdOI1sNWbZYFW0OiKwSos Xjm4R1gZ4ehilGT5DarEUAkYIEETuLUvPSzUQp3PaoJHPNeR3pa/HB6aYV6STR9BowTx 97uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WIOleZUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b13-20020a630c0d000000b005c6091a7ebcsi9289450pgl.231.2023.12.13.07.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:25:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WIOleZUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D3DB580C8DE0; Wed, 13 Dec 2023 07:25:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442579AbjLMPYi (ORCPT + 99 others); Wed, 13 Dec 2023 10:24:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442490AbjLMPYV (ORCPT ); Wed, 13 Dec 2023 10:24:21 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB742E4 for ; Wed, 13 Dec 2023 07:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702481067; 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=4hViO3AGp6pToaoN8VF8Iwb+OF6je+qeF4CeyLwe0vY=; b=WIOleZUVq4BvcKe35ehXvFXi3JcG8KntZLCABcTRx07LeVGLg+oAmADZ+sSjypHwU5nlBb bsmAA5bZzNlUu6XGN2toW3tVAZIyh2e5smF4jcg563YWvG0x69bBaXM7rW/YUFtUv7kQDb kSIDwn7XaoVSXcPXSoOYJr4OXdkT1Ck= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-146-hdgHiFcROYScI5wxcv-SWw-1; Wed, 13 Dec 2023 10:24:23 -0500 X-MC-Unique: hdgHiFcROYScI5wxcv-SWw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 1F3CC3C0E64B; Wed, 13 Dec 2023 15:24:22 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id F10D1C15968; Wed, 13 Dec 2023 15:24:18 +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 v4 07/39] netfs: Allow the netfs to make the io (sub)request alloc larger Date: Wed, 13 Dec 2023 15:23:17 +0000 Message-ID: <20231213152350.431591-8-dhowells@redhat.com> In-Reply-To: <20231213152350.431591-1-dhowells@redhat.com> References: <20231213152350.431591-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 07:25:11 -0800 (PST) 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 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);