aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@primarydata.com>2014-09-05 18:20:21 -0400
committerTom Haynes <loghyr@primarydata.com>2015-02-03 14:06:45 -0500
commitb57ff1303a2d4d1484c7a82bd80a3e014d6cdf5e (patch)
treeda3d760d94a39ecbf89e4ea5b0ed5e5017f26fde
parent6cccbb6f52dceec5f4faed8846ac05ae830640e6 (diff)
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>
-rw-r--r--fs/nfs/direct.c5
-rw-r--r--fs/nfs/filelayout/filelayout.c3
-rw-r--r--fs/nfs/internal.h6
-rw-r--r--fs/nfs/pnfs.h9
-rw-r--r--fs/nfs/pnfs_nfs.c4
-rw-r--r--fs/nfs/write.c14
6 files changed, 24 insertions, 17 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index d7c2d430b04d..1ee41d74c31c 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -649,7 +649,7 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
649 nfs_list_remove_request(req); 649 nfs_list_remove_request(req);
650 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) { 650 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) {
651 /* Note the rewrite will go through mds */ 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 } else 653 } else
654 nfs_release_request(req); 654 nfs_release_request(req);
655 nfs_unlock_and_release_request(req); 655 nfs_unlock_and_release_request(req);
@@ -748,7 +748,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
748 nfs_list_remove_request(req); 748 nfs_list_remove_request(req);
749 if (request_commit) { 749 if (request_commit) {
750 kref_get(&req->wb_kref); 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 nfs_unlock_and_release_request(req); 754 nfs_unlock_and_release_request(req);
754 } 755 }
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 520cbc53e035..3c9769441f36 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -954,7 +954,8 @@ static u32 select_bucket_index(struct nfs4_filelayout_segment *fl, u32 j)
954static void 954static void
955filelayout_mark_request_commit(struct nfs_page *req, 955filelayout_mark_request_commit(struct nfs_page *req,
956 struct pnfs_layout_segment *lseg, 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 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); 961 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index e9305e98b782..05f9a87cdab4 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -450,13 +450,15 @@ int nfs_scan_commit(struct inode *inode, struct list_head *dst,
450 struct nfs_commit_info *cinfo); 450 struct nfs_commit_info *cinfo);
451void nfs_mark_request_commit(struct nfs_page *req, 451void nfs_mark_request_commit(struct nfs_page *req,
452 struct pnfs_layout_segment *lseg, 452 struct pnfs_layout_segment *lseg,
453 struct nfs_commit_info *cinfo); 453 struct nfs_commit_info *cinfo,
454 u32 ds_commit_idx);
454int nfs_write_need_commit(struct nfs_pgio_header *); 455int nfs_write_need_commit(struct nfs_pgio_header *);
455int nfs_generic_commit_list(struct inode *inode, struct list_head *head, 456int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
456 int how, struct nfs_commit_info *cinfo); 457 int how, struct nfs_commit_info *cinfo);
457void nfs_retry_commit(struct list_head *page_list, 458void nfs_retry_commit(struct list_head *page_list,
458 struct pnfs_layout_segment *lseg, 459 struct pnfs_layout_segment *lseg,
459 struct nfs_commit_info *cinfo); 460 struct nfs_commit_info *cinfo,
461 u32 ds_commit_idx);
460void nfs_commitdata_release(struct nfs_commit_data *data); 462void nfs_commitdata_release(struct nfs_commit_data *data);
461void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst, 463void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
462 struct nfs_commit_info *cinfo); 464 struct nfs_commit_info *cinfo);
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 59c831efb5de..a0ab81cc9cf3 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -137,7 +137,8 @@ struct pnfs_layoutdriver_type {
137 struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode); 137 struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode);
138 void (*mark_request_commit) (struct nfs_page *req, 138 void (*mark_request_commit) (struct nfs_page *req,
139 struct pnfs_layout_segment *lseg, 139 struct pnfs_layout_segment *lseg,
140 struct nfs_commit_info *cinfo); 140 struct nfs_commit_info *cinfo,
141 u32 ds_commit_idx);
141 void (*clear_request_commit) (struct nfs_page *req, 142 void (*clear_request_commit) (struct nfs_page *req,
142 struct nfs_commit_info *cinfo); 143 struct nfs_commit_info *cinfo);
143 int (*scan_commit_lists) (struct nfs_commit_info *cinfo, 144 int (*scan_commit_lists) (struct nfs_commit_info *cinfo,
@@ -389,14 +390,14 @@ pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
389 390
390static inline bool 391static inline bool
391pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 392pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
392 struct nfs_commit_info *cinfo) 393 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
393{ 394{
394 struct inode *inode = req->wb_context->dentry->d_inode; 395 struct inode *inode = req->wb_context->dentry->d_inode;
395 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; 396 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
396 397
397 if (lseg == NULL || ld->mark_request_commit == NULL) 398 if (lseg == NULL || ld->mark_request_commit == NULL)
398 return false; 399 return false;
399 ld->mark_request_commit(req, lseg, cinfo); 400 ld->mark_request_commit(req, lseg, cinfo, ds_commit_idx);
400 return true; 401 return true;
401} 402}
402 403
@@ -574,7 +575,7 @@ pnfs_get_ds_info(struct inode *inode)
574 575
575static inline bool 576static inline bool
576pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 577pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
577 struct nfs_commit_info *cinfo) 578 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
578{ 579{
579 return false; 580 return false;
580} 581}
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
index 55bff41180e8..fdc4f6562bb7 100644
--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -188,7 +188,7 @@ static void pnfs_generic_retry_commit(struct nfs_commit_info *cinfo, int idx)
188 bucket = &fl_cinfo->buckets[i]; 188 bucket = &fl_cinfo->buckets[i];
189 if (list_empty(&bucket->committing)) 189 if (list_empty(&bucket->committing))
190 continue; 190 continue;
191 nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); 191 nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo, i);
192 spin_lock(cinfo->lock); 192 spin_lock(cinfo->lock);
193 freeme = bucket->clseg; 193 freeme = bucket->clseg;
194 bucket->clseg = NULL; 194 bucket->clseg = NULL;
@@ -247,7 +247,7 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
247 list_add(&data->pages, &list); 247 list_add(&data->pages, &list);
248 nreq++; 248 nreq++;
249 } else { 249 } else {
250 nfs_retry_commit(mds_pages, NULL, cinfo); 250 nfs_retry_commit(mds_pages, NULL, cinfo, 0);
251 pnfs_generic_retry_commit(cinfo, 0); 251 pnfs_generic_retry_commit(cinfo, 0);
252 cinfo->completion_ops->error_cleanup(NFS_I(inode)); 252 cinfo->completion_ops->error_cleanup(NFS_I(inode));
253 return -ENOMEM; 253 return -ENOMEM;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index e9974574b19a..2bee165fddcf 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -847,9 +847,9 @@ EXPORT_SYMBOL_GPL(nfs_init_cinfo);
847 */ 847 */
848void 848void
849nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 849nfs_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 return; 853 return;
854 nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo); 854 nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo);
855} 855}
@@ -905,7 +905,8 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
905 } 905 }
906 if (nfs_write_need_commit(hdr)) { 906 if (nfs_write_need_commit(hdr)) {
907 memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf)); 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 goto next; 910 goto next;
910 } 911 }
911remove_req: 912remove_req:
@@ -1560,14 +1561,15 @@ EXPORT_SYMBOL_GPL(nfs_init_commit);
1560 1561
1561void nfs_retry_commit(struct list_head *page_list, 1562void nfs_retry_commit(struct list_head *page_list,
1562 struct pnfs_layout_segment *lseg, 1563 struct pnfs_layout_segment *lseg,
1563 struct nfs_commit_info *cinfo) 1564 struct nfs_commit_info *cinfo,
1565 u32 ds_commit_idx)
1564{ 1566{
1565 struct nfs_page *req; 1567 struct nfs_page *req;
1566 1568
1567 while (!list_empty(page_list)) { 1569 while (!list_empty(page_list)) {
1568 req = nfs_list_entry(page_list->next); 1570 req = nfs_list_entry(page_list->next);
1569 nfs_list_remove_request(req); 1571 nfs_list_remove_request(req);
1570 nfs_mark_request_commit(req, lseg, cinfo); 1572 nfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx);
1571 if (!cinfo->dreq) { 1573 if (!cinfo->dreq) {
1572 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1574 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1573 dec_bdi_stat(page_file_mapping(req->wb_page)->backing_dev_info, 1575 dec_bdi_stat(page_file_mapping(req->wb_page)->backing_dev_info,
@@ -1598,7 +1600,7 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how,
1598 return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode), 1600 return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode),
1599 data->mds_ops, how, 0); 1601 data->mds_ops, how, 0);
1600 out_bad: 1602 out_bad:
1601 nfs_retry_commit(head, NULL, cinfo); 1603 nfs_retry_commit(head, NULL, cinfo, 0);
1602 cinfo->completion_ops->error_cleanup(NFS_I(inode)); 1604 cinfo->completion_ops->error_cleanup(NFS_I(inode));
1603 return -ENOMEM; 1605 return -ENOMEM;
1604} 1606}