From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0B6C39DBDB for ; Wed, 15 Jul 2026 14:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784126151; cv=none; b=A/5YMJot7nJijBGlJ6oCzYV6agkL3wkIeENmaVIOPCUJ7+VEjvx8NqV0Gmy6Ca4IgDlW94wm54j3lLJl2c2NLCptsYreSoO6ixQvlbMphXI7Bh8auknu15X9RUCpIesAfmqMQkiNRiFyRrf20aQbANxSXJdLFdT7smYJc4im3Wk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784126151; c=relaxed/simple; bh=EiK/0BOy13dfaHv1/1gIcOGTD4TXhwUWjevKgoWSbpI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YqsfEqSjwI5CxBoAW3lBxnMxQohrl699TrC9tSfEjZn0eju1IZJiIdQ3by689/Zu7OoAYEBj2joBaRLYLH2xkm4Bvxe3/qkSZ2H0YdjPokIEAH6GY3QkqFIzjjSShnI01F2CKlGBz5DHaTzbLoPAc/DWd57RNQdKru2rQe8Fusw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--praan.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Iez82V+J; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--praan.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Iez82V+J" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-38dbf293831so4921358a91.3 for ; Wed, 15 Jul 2026 07:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784126149; x=1784730949; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XhqenuXfmVALy/78xc7WpS0H1qGGlp44q39c/xt3Pa0=; b=Iez82V+JVk+cW8uDA+ieAFq8j4OksRZ497y5JrIKfNiC4zUovZqYufZMwZQVUTR50a 1yaIzbSXVufX+FnhiBL9q9ATNKM/KRKvIN7pG82B9ZStBs2Pzgq8KMXhw2WOwEUsERZN 5GC5WwCpHZtxsvFDjmP40aAtGl7BJKKzxH0YkqSR5FFXm6LJXnSZHBY6CMk/tlWIf2DF G5GIFkIJwKNPJFm3DjO5skIlnK1X2Ta3V5eOgUHOYaVl/o4Cro1czt6HCUD1ZhPHQCoz TmaVQQo7lizjTDls9Kd+4/JNxUJ8Sd66UHoMGAGBzt9GLWEWOUa0/8aPirmV8YdQjvuA 1gGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784126149; x=1784730949; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XhqenuXfmVALy/78xc7WpS0H1qGGlp44q39c/xt3Pa0=; b=HtZiEuZB+6exgLc4bo4Zh/4bITzYxL8JK3Wd2YdiZKbvq+DRNA0cmtQoSrA6eKQ+TE iWyfl4o9SCvPkR/4W6B66VSoEbA2EC79MTCzwdvAnoPHWMymR9NIvbcibufyg3SXKFxo NF/SlLIl7igfGt7MXtHXjXo+hSkxTQX//y3JxiBKzOOXaFrGkh8XzvfDyfIURKb+0eCT 0SHhLMK5EypQF28ZP9j/CU6lcx3KqB6Dmz/EC/Jkfd9nZFtUkz49jnMR8EPjtYJoUg9i s9SFRg6KiT781c7Muhpzfx3MCB10JN6xSvToDrpFlaYpJVsTQai2vCdRVn9CK3l9H4iz ln5w== X-Forwarded-Encrypted: i=1; AHgh+RoR+DQRsYKJgdRoDIl0qNKa2yFO3gV3qeesjnie8a1c95/IEJILAjNl3rQHgOTIketqCjBQT8YyT4BzpRE=@vger.kernel.org X-Gm-Message-State: AOJu0YwFbRLulCnSnlrapAYk4CB0LXXEXyGl3cIvjD4bQpHiyIPX3/fb w2JAQVOdIBYuYUYQiio7PVjnjf/g5omETKIzVxKHHOJljKPIARsFlEoKEhdgALTa2xzK5RBPceF SEQ== X-Received: from pjqq12.prod.google.com ([2002:a17:90b:584c:b0:381:71cf:62c]) (user=praan job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4c89:b0:387:e0db:3fb2 with SMTP id 98e67ed59e1d1-38dc779ac27mr16439182a91.43.1784126149280; Wed, 15 Jul 2026 07:35:49 -0700 (PDT) Date: Wed, 15 Jul 2026 14:35:38 +0000 In-Reply-To: <20260715143540.3597616-1-praan@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260715143540.3597616-1-praan@google.com> X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Message-ID: <20260715143540.3597616-4-praan@google.com> Subject: [PATCH v3 3/5] nfs: Introduce nfs_release_request_list helper From: Pranjal Shrivastava To: Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Cc: Chuck Lever , Jeff Layton , linux-kernel@vger.kernel.org, Christoph Hellwig , Logan Gunthorpe , Jason Gunthorpe , linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, Shivaji Kant , Pranjal Shrivastava Content-Type: text/plain; charset="UTF-8" Introduce a centralized helper, nfs_release_request_list, to handle the bulk release of nfs_page requests from a list. This serves as a preparatory step for two upcoming improvements: 1. Pin-Aware Cleanup: As we migrate to iov_iter_extract_* API, requests will hold pins (GUP) instead of standard references. The helper ensures that the correct unpinning logic gets applied consistently across all requests in a list. 2. Folio Support: In subsequent patches where nfs_page structures will cover multi-page folios, this helper provides a clean infrastructure to unlock these larger units of I/O in bulk during completion, similat to the pattern in bio_release_pages. Additionally, refactor nfs_read_sync_pgio_error() to utilize this new helper. Signed-off-by: Pranjal Shrivastava --- fs/nfs/direct.c | 8 +------- fs/nfs/pagelist.c | 18 ++++++++++++++++++ include/linux/nfs_page.h | 4 ++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 19792a38c924..96995736fac2 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -314,13 +314,7 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) static void nfs_read_sync_pgio_error(struct list_head *head, int error) { - struct nfs_page *req; - - while (!list_empty(head)) { - req = nfs_list_entry(head->next); - nfs_list_remove_request(req); - nfs_release_request(req); - } + nfs_release_request_list(head); } static void nfs_direct_pgio_init(struct nfs_pgio_header *hdr) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 7d51e10fe97a..569bac4faff7 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -622,6 +622,24 @@ void nfs_release_request(struct nfs_page *req) } EXPORT_SYMBOL_GPL(nfs_release_request); +/* + * nfs_release_request_list - Release a list of NFS read/write requests + * @head: list of requests to release + * + * Removes each request from the list and drops it's refcount. + */ +void nfs_release_request_list(struct list_head *head) +{ + struct nfs_page *req; + + while (!list_empty(head)) { + req = nfs_list_entry(head->next); + nfs_list_remove_request(req); + nfs_release_request(req); + } +} +EXPORT_SYMBOL_GPL(nfs_release_request_list); + /* * nfs_generic_pg_test - determine if requests can be coalesced * @desc: pointer to descriptor diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 080fa3e23580..d23208ed3a33 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -136,8 +136,8 @@ extern struct nfs_page *nfs_page_create_from_folio(struct nfs_open_context *ctx, bool pinned, unsigned int offset, unsigned int count); -extern void nfs_release_request(struct nfs_page *); - +extern void nfs_release_request(struct nfs_page *req); +extern void nfs_release_request_list(struct list_head *head); extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, struct inode *inode, -- 2.55.0.229.g6434b31f56-goog