Skip to content

Commit ed5d588

Browse files
author
Trond Myklebust
committed
NFS: Try to join page groups before an O_DIRECT retransmission
If we have to retransmit requests, try to join their page groups first. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent e00ed89 commit ed5d588

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

fs/nfs/direct.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,24 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter)
505505
return result;
506506
}
507507

508+
static void
509+
nfs_direct_join_group(struct list_head *list, struct inode *inode)
510+
{
511+
struct nfs_page *req, *next;
512+
513+
list_for_each_entry(req, list, wb_list) {
514+
if (req->wb_head != req || req->wb_this_page == req)
515+
continue;
516+
for (next = req->wb_this_page;
517+
next != req->wb_head;
518+
next = next->wb_this_page) {
519+
nfs_list_remove_request(next);
520+
nfs_release_request(next);
521+
}
522+
nfs_join_page_group(req, inode);
523+
}
524+
}
525+
508526
static void
509527
nfs_direct_write_scan_commit_list(struct inode *inode,
510528
struct list_head *list,
@@ -527,6 +545,8 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
527545
nfs_init_cinfo_from_dreq(&cinfo, dreq);
528546
nfs_direct_write_scan_commit_list(dreq->inode, &reqs, &cinfo);
529547

548+
nfs_direct_join_group(&reqs, dreq->inode);
549+
530550
dreq->count = 0;
531551
dreq->max_count = 0;
532552
list_for_each_entry(req, &reqs, wb_list)

fs/nfs/write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list,
501501
* the (former) group. All subrequests are removed from any write or commit
502502
* lists, unlinked from the group and destroyed.
503503
*/
504-
static void
504+
void
505505
nfs_join_page_group(struct nfs_page *head, struct inode *inode)
506506
{
507507
struct nfs_page *subreq;

include/linux/nfs_page.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ extern void nfs_unlock_request(struct nfs_page *req);
141141
extern void nfs_unlock_and_release_request(struct nfs_page *);
142142
extern struct nfs_page *nfs_page_group_lock_head(struct nfs_page *req);
143143
extern int nfs_page_group_lock_subrequests(struct nfs_page *head);
144+
extern void nfs_join_page_group(struct nfs_page *head, struct inode *inode);
144145
extern int nfs_page_group_lock(struct nfs_page *);
145146
extern void nfs_page_group_unlock(struct nfs_page *);
146147
extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);

0 commit comments

Comments
 (0)