Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp803759rdb; Fri, 17 Nov 2023 13:17:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEujEbb1/bkNzuaKPY/9H5/o8SGN8HqlJjUwHH6Y+2ew0CznaOfzScBXw8EezErbV2WHahC X-Received: by 2002:a05:6a00:10c8:b0:6c3:7cd0:3d7b with SMTP id d8-20020a056a0010c800b006c37cd03d7bmr753902pfu.10.1700255839727; Fri, 17 Nov 2023 13:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700255839; cv=none; d=google.com; s=arc-20160816; b=B8VX8d4udwc6t58VwECRf1wAawDH9zMbmWWcwVnKAnLT1aPqJJsZUV/zLO9mdoOEPk vaxGXCaUOwrTOyDnN5xzHdKHjWqF3MnA4TvRnUcBti/J95WcpDTvVtCaPEdefV6zT09q z014J/4DSaCcl+Yj3PQzduqmjpGj3HjwxgnM2bP2BTNdOEdmFPPvAA53CC/mgVRgyvMJ FpfX6Hfp6zRbJ0xv6dD8yVAwRdroRy4p1UbC2eMSEEO/jUs2rRUmiuUJI//BFAIjzA/D QtFJgLj2mo6RkUnxyr8De5ugkEFdLs6w3RGblf3p0kdwTAFYdvH0b91xyJ33bRsAEZfG orIQ== 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=7qvF7oi+5oPEkyJjoyrJDk/ZinoWK2nXUcq9LPlZaNY=; fh=lVY/c7gYUTDnyYYKKvGQU3Q29dA69hck6eN/HP5dBQ0=; b=TlSTGBC+tVA7DaTvUO1OtS88ifAdXaxWHXrXlaDoEeeq/hfJ15YMSkJ/XBtNAmuwK/ 2SkDhM3E/OdcokfcXz5rmh1qIuCDBNyUAH+NOl/vpTFekTYULm897yDDelFnN8/ClsRq oXvt9a6R8VduaZobdc++9At7XRzbbH4uOffgITuVdsyWTt9aCMScgxNc4Zqb6Lh/5yGw /3kFa4qEX/OBWfrLIbngXe720+NUMiCTnG/VLjsVTuD1qXnu5B0ZRbZjyu8r5SKa51OA 9VeRTxwaN1qGK97A6vutKm8VZPA6zOeVpvz/cfYDDfE8San364LkRRdKmGi+t5QJBTAH XdWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i0kSt1+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y5-20020aa793c5000000b006b7884dcd6csi2692101pff.14.2023.11.17.13.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:17:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i0kSt1+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 8E2C1804F621; Fri, 17 Nov 2023 13:16:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346210AbjKQVQS (ORCPT + 99 others); Fri, 17 Nov 2023 16:16:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235755AbjKQVQN (ORCPT ); Fri, 17 Nov 2023 16:16:13 -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 AC6D81981 for ; Fri, 17 Nov 2023 13:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700255766; 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=7qvF7oi+5oPEkyJjoyrJDk/ZinoWK2nXUcq9LPlZaNY=; b=i0kSt1+dqx1JI+0aIkG1BqrVJIroVP/x9DAgro1ig4f767Frj3wz0wSorqZg4F1u4Bl4rl CJQZpxP7bV7x2vTuHqJ/HNEDpTveiP5VrcCTgf7AVlY+yo0mV8AieDZLSK+odRwtlkjsIR 0oRm7WuxeDokfb9XutOhLfvGk6hpJ5s= 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-594-x5gpf7xiNoOgwEtpMqQMiA-1; Fri, 17 Nov 2023 16:16:00 -0500 X-MC-Unique: x5gpf7xiNoOgwEtpMqQMiA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 7EC613821341; Fri, 17 Nov 2023 21:15:59 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8DB75036; Fri, 17 Nov 2023 21:15:56 +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 , 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 v2 03/51] netfs: Allow the netfs to make the io (sub)request alloc larger Date: Fri, 17 Nov 2023 21:14:55 +0000 Message-ID: <20231117211544.1740466-4-dhowells@redhat.com> In-Reply-To: <20231117211544.1740466-1-dhowells@redhat.com> References: <20231117211544.1740466-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 13:16:28 -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 282511090ead..ddd55b35e650 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -212,6 +212,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);