aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs_nfs.c
diff options
context:
space:
mode:
authorTom Haynes <loghyr@primarydata.com>2014-12-11 13:04:55 -0500
committerTom Haynes <loghyr@primarydata.com>2015-02-03 14:06:31 -0500
commit085d1e33a6a8495d9afa58ad2b8b7ea74d613515 (patch)
tree3f39d90c0ccbce5f8f67ab3667304f18d22de70b /fs/nfs/pnfs_nfs.c
parentf54bcf2ecee982da47c2baf8bd87fd9ad9984651 (diff)
pnfs: Do not grab the commit_info lock twice when rescheduling writes
Acked-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs_nfs.c')
-rw-r--r--fs/nfs/pnfs_nfs.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
index e5f841cb6227..fd2a2f0e8cbb 100644
--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(pnfs_generic_commit_release);
66 66
67/* The generic layer is about to remove the req from the commit list. 67/* The generic layer is about to remove the req from the commit list.
68 * If this will make the bucket empty, it will need to put the lseg reference. 68 * If this will make the bucket empty, it will need to put the lseg reference.
69 * Note this is must be called holding the inode (/cinfo) lock 69 * Note this must be called holding the inode (/cinfo) lock
70 */ 70 */
71void 71void
72pnfs_generic_clear_request_commit(struct nfs_page *req, 72pnfs_generic_clear_request_commit(struct nfs_page *req,
@@ -115,7 +115,6 @@ pnfs_generic_transfer_commit_list(struct list_head *src, struct list_head *dst,
115 return ret; 115 return ret;
116} 116}
117 117
118/* Note called with cinfo->lock held. */
119static int 118static int
120pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket, 119pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
121 struct nfs_commit_info *cinfo, 120 struct nfs_commit_info *cinfo,
@@ -125,6 +124,7 @@ pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
125 struct list_head *dst = &bucket->committing; 124 struct list_head *dst = &bucket->committing;
126 int ret; 125 int ret;
127 126
127 lockdep_assert_held(cinfo->lock);
128 ret = pnfs_generic_transfer_commit_list(src, dst, cinfo, max); 128 ret = pnfs_generic_transfer_commit_list(src, dst, cinfo, max);
129 if (ret) { 129 if (ret) {
130 cinfo->ds->nwritten -= ret; 130 cinfo->ds->nwritten -= ret;
@@ -138,14 +138,15 @@ pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
138 return ret; 138 return ret;
139} 139}
140 140
141/* Move reqs from written to committing lists, returning count of number moved. 141/* Move reqs from written to committing lists, returning count
142 * Note called with cinfo->lock held. 142 * of number moved.
143 */ 143 */
144int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, 144int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo,
145 int max) 145 int max)
146{ 146{
147 int i, rv = 0, cnt; 147 int i, rv = 0, cnt;
148 148
149 lockdep_assert_held(cinfo->lock);
149 for (i = 0; i < cinfo->ds->nbuckets && max != 0; i++) { 150 for (i = 0; i < cinfo->ds->nbuckets && max != 0; i++) {
150 cnt = pnfs_generic_scan_ds_commit_list(&cinfo->ds->buckets[i], 151 cnt = pnfs_generic_scan_ds_commit_list(&cinfo->ds->buckets[i],
151 cinfo, max); 152 cinfo, max);
@@ -156,7 +157,7 @@ int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo,
156} 157}
157EXPORT_SYMBOL_GPL(pnfs_generic_scan_commit_lists); 158EXPORT_SYMBOL_GPL(pnfs_generic_scan_commit_lists);
158 159
159/* Pull everything off the committing lists and dump into @dst */ 160/* Pull everything off the committing lists and dump into @dst. */
160void pnfs_generic_recover_commit_reqs(struct list_head *dst, 161void pnfs_generic_recover_commit_reqs(struct list_head *dst,
161 struct nfs_commit_info *cinfo) 162 struct nfs_commit_info *cinfo)
162{ 163{
@@ -164,8 +165,8 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst,
164 struct pnfs_layout_segment *freeme; 165 struct pnfs_layout_segment *freeme;
165 int i; 166 int i;
166 167
168 lockdep_assert_held(cinfo->lock);
167restart: 169restart:
168 spin_lock(cinfo->lock);
169 for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) { 170 for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) {
170 if (pnfs_generic_transfer_commit_list(&b->written, dst, 171 if (pnfs_generic_transfer_commit_list(&b->written, dst,
171 cinfo, 0)) { 172 cinfo, 0)) {
@@ -173,11 +174,11 @@ restart:
173 b->wlseg = NULL; 174 b->wlseg = NULL;
174 spin_unlock(cinfo->lock); 175 spin_unlock(cinfo->lock);
175 pnfs_put_lseg(freeme); 176 pnfs_put_lseg(freeme);
177 spin_lock(cinfo->lock);
176 goto restart; 178 goto restart;
177 } 179 }
178 } 180 }
179 cinfo->ds->nwritten = 0; 181 cinfo->ds->nwritten = 0;
180 spin_unlock(cinfo->lock);
181} 182}
182EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs); 183EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs);
183 184