Re: [PATCH v2 0/7] nfs: Modernize Direct I/O path
Pranjal Shrivastava <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jun 16, 2026 at 01:39:53PM +0000, Pranjal Shrivastava wrote: > Modernize the NFS Direct I/O path as a preparatory step to enable PCI > Peer-to-Peer DMA (P2PDMA) support. Following feedback on the initial > RFC [1], the modernization and architectural changes are split into > this standalone series. > > Currently, NFS O_DIRECT relies on the legacy iov_iter_get_pages_alloc2() > API which does not support the pinning requirements for P2P memory. > The implementation moves NFS to the modern iov_iter_extract_pages() API > and migrates NFS direct I/O away from pages to use folios. > > Design > ====== > > 1. Pin-Awareness > Standard NFS requests use get_page() and put_page() for memory > management. However, memory extracted via iov_iter_extract_pages() > requires explicit pinning. > > Introduce a PG_PINNED flag and a wb_nr_pinned count to struct nfs_page. > This allows the request lifecycle to track ownership of physical pins > and ensure that unpinning is performed only when the I/O is complete. > > 2. API Migration > Migrate the Direct I/O path to the modern iov_iter_extract_pages() > API. This aligns NFS with the modern extraction model and serves as > the foundation for passing ITER_ALLOW_P2PDMA in a follow-up series. > > 3. Extraction Helper and Folio Support > Introduce a new extraction helper in direct.c to group contiguous > pages from the same folio into a single struct nfs_page. This > effectively migrates the Direct I/O path from being page-based to being > folio-based. > > Note: zone_device_pages_have_same_pgmap() checks are intentionally > omitted in the extraction helper since P2PDMA enablement will be > introduced in a follow-up series. > > Bisectability > ============= > The series attempts to remain bisectable. > > [Patches 1-2] Introduce pin-aware infrastructure and accounting. > [Patch 3] Adds a centralized request release helper. > [Patch 4] Migrates the Direct I/O path to iov_iter_extract_pages(). > [Patches 5-6] Implement the extraction helper and folio-based grouping. > [Patch 7] Removes orphaned page-based helpers. > > Testing > ======= > This series has been tested with xfstests [2] on RDMA & TCP transports: > > ./check generic/091 generic/130 generic/139 generic/143 generic/154 \ > generic/155 generic/183 generic/188 generic/190 generic/196 \ > generic/198 generic/203 generic/214 generic/240 generic/263 \ > generic/287 generic/290 generic/292 generic/330 generic/444 \ > generic/450 generic/451 generic/586 generic/647 generic/708 \ > generic/729 generic/760 > > The following summary was tabulated via a custom script [3] (on github). > [...] > > [1] https://lore.kernel.org/all/[email protected]/ > [2] https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git Missed [3] https://github.com/pran005/tools/blob/main/display.py > > > [v2] > - Fix data corruption in nfs_direct_extract_pages() by correctly > calculating intra-page offsets using offset_in_page(). > - Fix requested_bytes accounting in direct read/write paths to only > increment after successful RPC scheduling. > - Add missing kernel-doc descriptions for the @pinned parameter in > nfs_page_create_from_page() and nfs_page_create_from_folio(). > - Rebase on fs-next/ Thanks, Praan