Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pnfs: pass ds_commit_idx through the commit path

Pass ds_commit_idx through the nfs commit path. It's used to select
the commit bucket when using pnfs and is ignored when not using pnfs.
Several functions had to be changed: nfs_retry_commit,
nfs_mark_request_commit, pnfs_mark_request_commit and the pnfs layout
driver .mark_request_commit functions.

Signed-off-by: Tom Haynes <loghyr@primarydata.com>

authored by

Weston Andros Adamson and committed by
Tom Haynes
b57ff130 6cccbb6f

+24 -17
+3 -2
fs/nfs/direct.c
··· 649 649 nfs_list_remove_request(req); 650 650 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) { 651 651 /* Note the rewrite will go through mds */ 652 - nfs_mark_request_commit(req, NULL, &cinfo); 652 + nfs_mark_request_commit(req, NULL, &cinfo, 0); 653 653 } else 654 654 nfs_release_request(req); 655 655 nfs_unlock_and_release_request(req); ··· 748 748 nfs_list_remove_request(req); 749 749 if (request_commit) { 750 750 kref_get(&req->wb_kref); 751 - nfs_mark_request_commit(req, hdr->lseg, &cinfo); 751 + nfs_mark_request_commit(req, hdr->lseg, &cinfo, 752 + hdr->ds_commit_idx); 752 753 } 753 754 nfs_unlock_and_release_request(req); 754 755 }
+2 -1
fs/nfs/filelayout/filelayout.c
··· 954 954 static void 955 955 filelayout_mark_request_commit(struct nfs_page *req, 956 956 struct pnfs_layout_segment *lseg, 957 - struct nfs_commit_info *cinfo) 957 + struct nfs_commit_info *cinfo, 958 + u32 ds_commit_idx) 958 959 959 960 { 960 961 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
+4 -2
fs/nfs/internal.h
··· 450 450 struct nfs_commit_info *cinfo); 451 451 void nfs_mark_request_commit(struct nfs_page *req, 452 452 struct pnfs_layout_segment *lseg, 453 - struct nfs_commit_info *cinfo); 453 + struct nfs_commit_info *cinfo, 454 + u32 ds_commit_idx); 454 455 int nfs_write_need_commit(struct nfs_pgio_header *); 455 456 int nfs_generic_commit_list(struct inode *inode, struct list_head *head, 456 457 int how, struct nfs_commit_info *cinfo); 457 458 void nfs_retry_commit(struct list_head *page_list, 458 459 struct pnfs_layout_segment *lseg, 459 - struct nfs_commit_info *cinfo); 460 + struct nfs_commit_info *cinfo, 461 + u32 ds_commit_idx); 460 462 void nfs_commitdata_release(struct nfs_commit_data *data); 461 463 void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst, 462 464 struct nfs_commit_info *cinfo);
+5 -4
fs/nfs/pnfs.h
··· 137 137 struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode); 138 138 void (*mark_request_commit) (struct nfs_page *req, 139 139 struct pnfs_layout_segment *lseg, 140 - struct nfs_commit_info *cinfo); 140 + struct nfs_commit_info *cinfo, 141 + u32 ds_commit_idx); 141 142 void (*clear_request_commit) (struct nfs_page *req, 142 143 struct nfs_commit_info *cinfo); 143 144 int (*scan_commit_lists) (struct nfs_commit_info *cinfo, ··· 390 389 391 390 static inline bool 392 391 pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 393 - struct nfs_commit_info *cinfo) 392 + struct nfs_commit_info *cinfo, u32 ds_commit_idx) 394 393 { 395 394 struct inode *inode = req->wb_context->dentry->d_inode; 396 395 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; 397 396 398 397 if (lseg == NULL || ld->mark_request_commit == NULL) 399 398 return false; 400 - ld->mark_request_commit(req, lseg, cinfo); 399 + ld->mark_request_commit(req, lseg, cinfo, ds_commit_idx); 401 400 return true; 402 401 } 403 402 ··· 575 574 576 575 static inline bool 577 576 pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 578 - struct nfs_commit_info *cinfo) 577 + struct nfs_commit_info *cinfo, u32 ds_commit_idx) 579 578 { 580 579 return false; 581 580 }
+2 -2
fs/nfs/pnfs_nfs.c
··· 188 188 bucket = &fl_cinfo->buckets[i]; 189 189 if (list_empty(&bucket->committing)) 190 190 continue; 191 - nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); 191 + nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo, i); 192 192 spin_lock(cinfo->lock); 193 193 freeme = bucket->clseg; 194 194 bucket->clseg = NULL; ··· 247 247 list_add(&data->pages, &list); 248 248 nreq++; 249 249 } else { 250 - nfs_retry_commit(mds_pages, NULL, cinfo); 250 + nfs_retry_commit(mds_pages, NULL, cinfo, 0); 251 251 pnfs_generic_retry_commit(cinfo, 0); 252 252 cinfo->completion_ops->error_cleanup(NFS_I(inode)); 253 253 return -ENOMEM;
+8 -6
fs/nfs/write.c
··· 847 847 */ 848 848 void 849 849 nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 850 - struct nfs_commit_info *cinfo) 850 + struct nfs_commit_info *cinfo, u32 ds_commit_idx) 851 851 { 852 - if (pnfs_mark_request_commit(req, lseg, cinfo)) 852 + if (pnfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx)) 853 853 return; 854 854 nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo); 855 855 } ··· 905 905 } 906 906 if (nfs_write_need_commit(hdr)) { 907 907 memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf)); 908 - nfs_mark_request_commit(req, hdr->lseg, &cinfo); 908 + nfs_mark_request_commit(req, hdr->lseg, &cinfo, 909 + 0); 909 910 goto next; 910 911 } 911 912 remove_req: ··· 1561 1560 1562 1561 void nfs_retry_commit(struct list_head *page_list, 1563 1562 struct pnfs_layout_segment *lseg, 1564 - struct nfs_commit_info *cinfo) 1563 + struct nfs_commit_info *cinfo, 1564 + u32 ds_commit_idx) 1565 1565 { 1566 1566 struct nfs_page *req; 1567 1567 1568 1568 while (!list_empty(page_list)) { 1569 1569 req = nfs_list_entry(page_list->next); 1570 1570 nfs_list_remove_request(req); 1571 - nfs_mark_request_commit(req, lseg, cinfo); 1571 + nfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx); 1572 1572 if (!cinfo->dreq) { 1573 1573 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1574 1574 dec_bdi_stat(page_file_mapping(req->wb_page)->backing_dev_info, ··· 1600 1598 return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode), 1601 1599 data->mds_ops, how, 0); 1602 1600 out_bad: 1603 - nfs_retry_commit(head, NULL, cinfo); 1601 + nfs_retry_commit(head, NULL, cinfo, 0); 1604 1602 cinfo->completion_ops->error_cleanup(NFS_I(inode)); 1605 1603 return -ENOMEM; 1606 1604 }