Skip to content

Commit b57ff13

Browse files
westonandrosadamsonTom Haynes
authored andcommitted
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>
1 parent 6cccbb6 commit b57ff13

6 files changed

Lines changed: 24 additions & 17 deletions

File tree

‎fs/nfs/direct.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
649649
nfs_list_remove_request(req);
650650
if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) {
651651
/* Note the rewrite will go through mds */
652-
nfs_mark_request_commit(req, NULL, &cinfo);
652+
nfs_mark_request_commit(req, NULL, &cinfo, 0);
653653
} else
654654
nfs_release_request(req);
655655
nfs_unlock_and_release_request(req);
@@ -748,7 +748,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
748748
nfs_list_remove_request(req);
749749
if (request_commit) {
750750
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);
752753
}
753754
nfs_unlock_and_release_request(req);
754755
}

‎fs/nfs/filelayout/filelayout.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,8 @@ static u32 select_bucket_index(struct nfs4_filelayout_segment *fl, u32 j)
954954
static void
955955
filelayout_mark_request_commit(struct nfs_page *req,
956956
struct pnfs_layout_segment *lseg,
957-
struct nfs_commit_info *cinfo)
957+
struct nfs_commit_info *cinfo,
958+
u32 ds_commit_idx)
958959

959960
{
960961
struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);

‎fs/nfs/internal.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,15 @@ int nfs_scan_commit(struct inode *inode, struct list_head *dst,
450450
struct nfs_commit_info *cinfo);
451451
void nfs_mark_request_commit(struct nfs_page *req,
452452
struct pnfs_layout_segment *lseg,
453-
struct nfs_commit_info *cinfo);
453+
struct nfs_commit_info *cinfo,
454+
u32 ds_commit_idx);
454455
int nfs_write_need_commit(struct nfs_pgio_header *);
455456
int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
456457
int how, struct nfs_commit_info *cinfo);
457458
void nfs_retry_commit(struct list_head *page_list,
458459
struct pnfs_layout_segment *lseg,
459-
struct nfs_commit_info *cinfo);
460+
struct nfs_commit_info *cinfo,
461+
u32 ds_commit_idx);
460462
void nfs_commitdata_release(struct nfs_commit_data *data);
461463
void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
462464
struct nfs_commit_info *cinfo);

‎fs/nfs/pnfs.h‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ struct pnfs_layoutdriver_type {
137137
struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode);
138138
void (*mark_request_commit) (struct nfs_page *req,
139139
struct pnfs_layout_segment *lseg,
140-
struct nfs_commit_info *cinfo);
140+
struct nfs_commit_info *cinfo,
141+
u32 ds_commit_idx);
141142
void (*clear_request_commit) (struct nfs_page *req,
142143
struct nfs_commit_info *cinfo);
143144
int (*scan_commit_lists) (struct nfs_commit_info *cinfo,
@@ -389,14 +390,14 @@ pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
389390

390391
static inline bool
391392
pnfs_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)
393394
{
394395
struct inode *inode = req->wb_context->dentry->d_inode;
395396
struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
396397

397398
if (lseg == NULL || ld->mark_request_commit == NULL)
398399
return false;
399-
ld->mark_request_commit(req, lseg, cinfo);
400+
ld->mark_request_commit(req, lseg, cinfo, ds_commit_idx);
400401
return true;
401402
}
402403

@@ -574,7 +575,7 @@ pnfs_get_ds_info(struct inode *inode)
574575

575576
static inline bool
576577
pnfs_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)
578579
{
579580
return false;
580581
}

‎fs/nfs/pnfs_nfs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static void pnfs_generic_retry_commit(struct nfs_commit_info *cinfo, int idx)
188188
bucket = &fl_cinfo->buckets[i];
189189
if (list_empty(&bucket->committing))
190190
continue;
191-
nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo);
191+
nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo, i);
192192
spin_lock(cinfo->lock);
193193
freeme = bucket->clseg;
194194
bucket->clseg = NULL;
@@ -247,7 +247,7 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
247247
list_add(&data->pages, &list);
248248
nreq++;
249249
} else {
250-
nfs_retry_commit(mds_pages, NULL, cinfo);
250+
nfs_retry_commit(mds_pages, NULL, cinfo, 0);
251251
pnfs_generic_retry_commit(cinfo, 0);
252252
cinfo->completion_ops->error_cleanup(NFS_I(inode));
253253
return -ENOMEM;

‎fs/nfs/write.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,9 @@ EXPORT_SYMBOL_GPL(nfs_init_cinfo);
847847
*/
848848
void
849849
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)
851851
{
852-
if (pnfs_mark_request_commit(req, lseg, cinfo))
852+
if (pnfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx))
853853
return;
854854
nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo);
855855
}
@@ -905,7 +905,8 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
905905
}
906906
if (nfs_write_need_commit(hdr)) {
907907
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);
909910
goto next;
910911
}
911912
remove_req:
@@ -1560,14 +1561,15 @@ EXPORT_SYMBOL_GPL(nfs_init_commit);
15601561

15611562
void nfs_retry_commit(struct list_head *page_list,
15621563
struct pnfs_layout_segment *lseg,
1563-
struct nfs_commit_info *cinfo)
1564+
struct nfs_commit_info *cinfo,
1565+
u32 ds_commit_idx)
15641566
{
15651567
struct nfs_page *req;
15661568

15671569
while (!list_empty(page_list)) {
15681570
req = nfs_list_entry(page_list->next);
15691571
nfs_list_remove_request(req);
1570-
nfs_mark_request_commit(req, lseg, cinfo);
1572+
nfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx);
15711573
if (!cinfo->dreq) {
15721574
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
15731575
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,
15981600
return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode),
15991601
data->mds_ops, how, 0);
16001602
out_bad:
1601-
nfs_retry_commit(head, NULL, cinfo);
1603+
nfs_retry_commit(head, NULL, cinfo, 0);
16021604
cinfo->completion_ops->error_cleanup(NFS_I(inode));
16031605
return -ENOMEM;
16041606
}

0 commit comments

Comments
 (0)