mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
nfs: introduce nfs_release_request_list helper
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, similar to the pattern in bio_release_pages.
Additionally, refactor nfs_read_sync_pgio_error() to utilize this new
helper.
Signed-off-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Shivaji Kant <shivajikant@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
This commit is contained in:
parent
00ba5f7320
commit
43280750bc
|
|
@ -294,13 +294,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)
|
||||
|
|
|
|||
|
|
@ -628,6 +628,23 @@ 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)
|
||||
{
|
||||
while (!list_empty(head)) {
|
||||
struct nfs_page *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
|
||||
|
|
|
|||
|
|
@ -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 *);
|
||||
|
||||
void nfs_release_request(struct nfs_page *req);
|
||||
void nfs_release_request_list(struct list_head *head);
|
||||
|
||||
extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
|
||||
struct inode *inode,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user