Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1947138rdb; Thu, 7 Dec 2023 13:24:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDY1enka0mwLwgnV2XGKL+f7WAJ7Tl0sMMjrGUTYvoarwBBYFxeqYdvF5V+9WolIPiMc4m X-Received: by 2002:a17:906:7499:b0:a16:f41c:3714 with SMTP id e25-20020a170906749900b00a16f41c3714mr1923570ejl.22.1701984248268; Thu, 07 Dec 2023 13:24:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701984248; cv=none; d=google.com; s=arc-20160816; b=MhHajtoVgTJ0+wI9bVmgkg/TbTLQclf6mUnpIYaLSRJMLHh4XkptuMCY8L+1BLDkzV iouSw7fLL5Lie3HF3lDzSTNJha/tHFxLP7kFTqt5RX5Nlv+gMYme+TcIVywA2c1esaW8 F0pv7UKLFTvefc9h+S+qq9aVUL3zEbtI2Nehn+AKZJxku1MYgbAgH91l1RciJjU+1ygU hkHLbgKzIiD+qlO+9AZWVAjeVibx7IsNFsQmA80wPzRR92ziwmIk7ztHtUq6wiUiLtkB Howzjtt1nkciB31P0jjqGcUBkTXvGUSflRLxUngNFT6j9QDW4BPZ6db97A5RcfMUrBKK 2zHw== 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=4hViO3AGp6pToaoN8VF8Iwb+OF6je+qeF4CeyLwe0vY=; fh=ib4gl95HfLmZdfX9QIMf3rTepWCH9JlNymcDKJTPhJg=; b=QFdFNvY/cPBcOeOek+Ow9pVsmhZKpJY8qmk5EBiJPZSUfeZG3/+JHMODY2no/5WE7k W4rPQWCaSovVEAQV/znPPlZz++08zMHIedLLU/rhbQypXfVCKJMm+xD1Qy3MTHei3h1b Hj5oGI7WJlkM39xFd4yXegtaHPSUv/U/8eXubQZz4hl5GGX4/V1YkMOA4n0TnJ841nR+ +j+UE6fZ/kZ1JVQAD/ZWfHBHALAur8qijDZanzUXdk6ae6BbuoM6iw9YtUqHVvwNvMnr lDE2utwr/b7AKfLrCqAdpNzxLcoJ80MeaZoX97JJQ68kMIptQWOiSnEGCSBmXG+QLi0J CAUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h400DgtW; spf=pass (google.com: domain of linux-nfs+bounces-396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bl2-20020a170906c24200b00a1d991c3a0asi158472ejb.296.2023.12.07.13.24.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 13:24:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h400DgtW; spf=pass (google.com: domain of linux-nfs+bounces-396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-396-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 035CF1F21242 for ; Thu, 7 Dec 2023 21:24:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 229FF58AD4; Thu, 7 Dec 2023 21:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h400DgtW" X-Original-To: linux-nfs@vger.kernel.org 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 287B21721 for ; Thu, 7 Dec 2023 13:22:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701984159; 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=h400DgtWIQZerJu4jdTtr/E6GJD/tOgleqj+ELYl0FJQbXg6cVHVdc1Myz61+GQctkkjtC n3iwl4N8fK2XxWVFoCwgDOpSQi3ASYfqyqF3ff2GCP8lrB5SzP3UklVcV4yoptfaZ4IP4X j8ud7R4FGLcztPPgqsAmHKnGwuD1v2c= 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-138-0vOy4vOkP1GYro-mJ4m-9A-1; Thu, 07 Dec 2023 16:22:36 -0500 X-MC-Unique: 0vOy4vOkP1GYro-mJ4m-9A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 14345863062; Thu, 7 Dec 2023 21:22:35 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 776CB3C2E; Thu, 7 Dec 2023 21:22:32 +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 v3 07/59] netfs: Allow the netfs to make the io (sub)request alloc larger Date: Thu, 7 Dec 2023 21:21:14 +0000 Message-ID: <20231207212206.1379128-8-dhowells@redhat.com> In-Reply-To: <20231207212206.1379128-1-dhowells@redhat.com> References: <20231207212206.1379128-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-nfs@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.1 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);