From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 18D7737CD59 for ; Wed, 3 Jun 2026 05:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780464645; cv=none; b=LNLt4FB/D7/nSZ/BFcuzJGdLnDX/nUo1Pi/p5/taAHUNrkEMa9RZqN3ZWNiQymE6osJ4lQGYRpD2HzElgto6oDm72rayBOuWIGEJbmpQmFiljOU+GyVYVG7LZu2msJ7OWAyZl4eiwI5KQkKii2sHJaRv8bn2C3+lANsABH85vBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780464645; c=relaxed/simple; bh=xlRKe2tV08/PB0El33PK0KOegIfZJWy1WXcRZqpSlyQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=SPwVF7RqT9Q3aChOAyduZcKvJ4NBIknfQZjCyeHg+BDNYo0w3Fw/+yJWAtURNFxqeaL9Z3WCG72dyrCgUz7Uo+JQEZIGzhVirO5yal/wiqzjtxrfMv8Gw1u6FS1Vxp15chxs7ibgc21rnf5IRy1u4q6cxUndoAuSo8YrEonqE0s= 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=teRhLAjA; arc=none smtp.client-ip=209.85.215.201 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="teRhLAjA" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c85a2c0b56fso3551051a12.0 for ; Tue, 02 Jun 2026 22:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780464643; x=1781069443; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2nehAld8TJlI8mrxna1q/NWiJX18b33YpMiePw0zAq0=; b=teRhLAjAKokOdx6KTZqvF8z3KoJgoEWcJTvY9nPgKQyDqiXhDbgN+UUF2Xo8Fx0hlS FSrUNp8NxIZCsWP1FytPiClIiRw5fAvY6DRoXj3d8wNJ/pxI7AMXhiYR4rq/Vr2Q1/dv hNL+PaDTauzDzRNppb4NCiH1MJB+w/mvNwqBb/xGaF+4aoPgYfZPWkYPVn/84GJPduL9 7N/SNMY3t4PO0vPhtxR4clNQnR2fuM5hUkZ3vWzR+moMB3wmnDkjuEmp9Z/o+0gNErFN hoNXR8642DIAqvwJmT0/3qAdhmP8yYoVfGbD17g28QgUaBrG0DeN712VQCxwwnI96jgP dBGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780464643; x=1781069443; h=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; bh=2nehAld8TJlI8mrxna1q/NWiJX18b33YpMiePw0zAq0=; b=YMFRImIINerKchTr9SYNRsbkx7xXAcehPdQMdh5BD+3JOdgWvgVnlWp3eGzr9q4POh vrN+U3iQEZ/QA4EyrAq64hQa8vDoJlTIOiBHTmOUrjjkyX8BPsC7ba5SxcACxFT5iMra urmVe2mMRFpLGpHC2rYE6MFXPI8KG4bQpLHWLtIi69cJLk8CW6mlhPHcOzjoCU9eBY9L zoaD8MmTB4MCc8IjelrnhA1uUBZUZzriM2pqQ+F2+XSVYY82URsebRb4PvHoWcgkjkdK o4sr9XsgQytBvM8npXx9wYPpE6ds4AOe+41QrO4aZOjOeuC46QTyq6ShidL1vWt5RNJW AoKQ== X-Forwarded-Encrypted: i=1; AFNElJ9QnRlG5KAdoE0QVD1d/0XjOao3QdiD3UdD+GmtM6g/LF8zNIHCwUwZqrot/z5OXBZ0rrQaVZXfWsYYC8Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxhFOH3xkSpSRs7kbCl0ruXULzR3BpaSbcmoJf4fBZXGBIVmxK3 VHuhcBjnnMzKok4kAA++KjJ2bGObzF5qP4ck0oREU8MrCH6q1zftrolNPvBX+xYF6Wu77X1PtiD FPA== X-Received: from pgal123.prod.google.com ([2002:a63:3e81:0:b0:c7c:4b52:febd]) (user=praan job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:7314:b0:3a8:21e0:1ffa with SMTP id adf61e73a8af0-3b49782cd85mr2233044637.27.1780464642818; Tue, 02 Jun 2026 22:30:42 -0700 (PDT) Date: Wed, 3 Jun 2026 05:30:29 +0000 In-Reply-To: <20260603053033.3300318-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: <20260603053033.3300318-1-praan@google.com> X-Mailer: git-send-email 2.54.0.1013.g208068f2d8-goog Message-ID: <20260603053033.3300318-4-praan@google.com> Subject: [PATCH v1 3/7] nfs: Introduce nfs_release_request_list helper From: Pranjal Shrivastava To: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Trond Myklebust , Anna Schumaker , Christoph Hellwig , Christoph Hellwig , 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 80319c5eeed4..2691eeaaeb8c 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 f59449918be7..74ae91151f83 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -620,6 +620,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 295280fe9571..14eb5de64d2f 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -135,8 +135,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.54.0.1013.g208068f2d8-goog