aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/filelayout/filelayout.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/filelayout/filelayout.c')
-rw-r--r--fs/nfs/filelayout/filelayout.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 504d58a51d35..a928f92bcb10 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -1035,18 +1035,22 @@ out:
1035 pnfs_put_lseg(freeme); 1035 pnfs_put_lseg(freeme);
1036} 1036}
1037 1037
1038static struct list_head * 1038static void
1039filelayout_choose_commit_list(struct nfs_page *req, 1039filelayout_mark_request_commit(struct nfs_page *req,
1040 struct pnfs_layout_segment *lseg, 1040 struct pnfs_layout_segment *lseg,
1041 struct nfs_commit_info *cinfo) 1041 struct nfs_commit_info *cinfo)
1042
1042{ 1043{
1043 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); 1044 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
1044 u32 i, j; 1045 u32 i, j;
1045 struct list_head *list; 1046 struct list_head *list;
1046 struct pnfs_commit_bucket *buckets; 1047 struct pnfs_commit_bucket *buckets;
1047 1048
1048 if (fl->commit_through_mds) 1049 if (fl->commit_through_mds) {
1049 return &cinfo->mds->list; 1050 list = &cinfo->mds->list;
1051 spin_lock(cinfo->lock);
1052 goto mds_commit;
1053 }
1050 1054
1051 /* Note that we are calling nfs4_fl_calc_j_index on each page 1055 /* Note that we are calling nfs4_fl_calc_j_index on each page
1052 * that ends up being committed to a data server. An attractive 1056 * that ends up being committed to a data server. An attractive
@@ -1070,19 +1074,22 @@ filelayout_choose_commit_list(struct nfs_page *req,
1070 } 1074 }
1071 set_bit(PG_COMMIT_TO_DS, &req->wb_flags); 1075 set_bit(PG_COMMIT_TO_DS, &req->wb_flags);
1072 cinfo->ds->nwritten++; 1076 cinfo->ds->nwritten++;
1073 spin_unlock(cinfo->lock);
1074 return list;
1075}
1076 1077
1077static void 1078mds_commit:
1078filelayout_mark_request_commit(struct nfs_page *req, 1079 /* nfs_request_add_commit_list(). We need to add req to list without
1079 struct pnfs_layout_segment *lseg, 1080 * dropping cinfo lock.
1080 struct nfs_commit_info *cinfo) 1081 */
1081{ 1082 set_bit(PG_CLEAN, &(req)->wb_flags);
1082 struct list_head *list; 1083 nfs_list_add_request(req, list);
1083 1084 cinfo->mds->ncommit++;
1084 list = filelayout_choose_commit_list(req, lseg, cinfo); 1085 spin_unlock(cinfo->lock);
1085 nfs_request_add_commit_list(req, list, cinfo); 1086 if (!cinfo->dreq) {
1087 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1088 inc_bdi_stat(page_file_mapping(req->wb_page)->backing_dev_info,
1089 BDI_RECLAIMABLE);
1090 __mark_inode_dirty(req->wb_context->dentry->d_inode,
1091 I_DIRTY_DATASYNC);
1092 }
1086} 1093}
1087 1094
1088static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i) 1095static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)