|
@@ -195,7 +195,7 @@ nfs_page_find_swap_request(struct page *page)
|
|
|
struct nfs_page *req = NULL;
|
|
|
if (!PageSwapCache(page))
|
|
|
return NULL;
|
|
|
- spin_lock(&inode->i_lock);
|
|
|
+ mutex_lock(&nfsi->commit_mutex);
|
|
|
if (PageSwapCache(page)) {
|
|
|
req = nfs_page_search_commits_for_head_request_locked(nfsi,
|
|
|
page);
|
|
@@ -204,7 +204,7 @@ nfs_page_find_swap_request(struct page *page)
|
|
|
kref_get(&req->wb_kref);
|
|
|
}
|
|
|
}
|
|
|
- spin_unlock(&inode->i_lock);
|
|
|
+ mutex_unlock(&nfsi->commit_mutex);
|
|
|
return req;
|
|
|
}
|
|
|
|
|
@@ -856,7 +856,8 @@ nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi,
|
|
|
* number of outstanding requests requiring a commit as well as
|
|
|
* the MM page stats.
|
|
|
*
|
|
|
- * The caller must hold cinfo->inode->i_lock, and the nfs_page lock.
|
|
|
+ * The caller must hold NFS_I(cinfo->inode)->commit_mutex, and the
|
|
|
+ * nfs_page lock.
|
|
|
*/
|
|
|
void
|
|
|
nfs_request_add_commit_list_locked(struct nfs_page *req, struct list_head *dst,
|
|
@@ -884,9 +885,9 @@ EXPORT_SYMBOL_GPL(nfs_request_add_commit_list_locked);
|
|
|
void
|
|
|
nfs_request_add_commit_list(struct nfs_page *req, struct nfs_commit_info *cinfo)
|
|
|
{
|
|
|
- spin_lock(&cinfo->inode->i_lock);
|
|
|
+ mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
|
|
|
nfs_request_add_commit_list_locked(req, &cinfo->mds->list, cinfo);
|
|
|
- spin_unlock(&cinfo->inode->i_lock);
|
|
|
+ mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex);
|
|
|
if (req->wb_page)
|
|
|
nfs_mark_page_unstable(req->wb_page, cinfo);
|
|
|
}
|
|
@@ -964,11 +965,11 @@ nfs_clear_request_commit(struct nfs_page *req)
|
|
|
struct nfs_commit_info cinfo;
|
|
|
|
|
|
nfs_init_cinfo_from_inode(&cinfo, inode);
|
|
|
- spin_lock(&inode->i_lock);
|
|
|
+ mutex_lock(&NFS_I(inode)->commit_mutex);
|
|
|
if (!pnfs_clear_request_commit(req, &cinfo)) {
|
|
|
nfs_request_remove_commit_list(req, &cinfo);
|
|
|
}
|
|
|
- spin_unlock(&inode->i_lock);
|
|
|
+ mutex_unlock(&NFS_I(inode)->commit_mutex);
|
|
|
nfs_clear_page_commit(req->wb_page);
|
|
|
}
|
|
|
}
|
|
@@ -1027,7 +1028,7 @@ nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
|
|
|
return cinfo->mds->ncommit;
|
|
|
}
|
|
|
|
|
|
-/* cinfo->inode->i_lock held by caller */
|
|
|
+/* NFS_I(cinfo->inode)->commit_mutex held by caller */
|
|
|
int
|
|
|
nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
|
|
|
struct nfs_commit_info *cinfo, int max)
|
|
@@ -1039,13 +1040,12 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
|
|
|
if (!nfs_lock_request(req))
|
|
|
continue;
|
|
|
kref_get(&req->wb_kref);
|
|
|
- if (cond_resched_lock(&cinfo->inode->i_lock))
|
|
|
- list_safe_reset_next(req, tmp, wb_list);
|
|
|
nfs_request_remove_commit_list(req, cinfo);
|
|
|
nfs_list_add_request(req, dst);
|
|
|
ret++;
|
|
|
if ((ret == max) && !cinfo->dreq)
|
|
|
break;
|
|
|
+ cond_resched();
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
@@ -1065,7 +1065,7 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst,
|
|
|
{
|
|
|
int ret = 0;
|
|
|
|
|
|
- spin_lock(&cinfo->inode->i_lock);
|
|
|
+ mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
|
|
|
if (cinfo->mds->ncommit > 0) {
|
|
|
const int max = INT_MAX;
|
|
|
|
|
@@ -1073,7 +1073,7 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst,
|
|
|
cinfo, max);
|
|
|
ret += pnfs_scan_commit_lists(inode, cinfo, max - ret);
|
|
|
}
|
|
|
- spin_unlock(&cinfo->inode->i_lock);
|
|
|
+ mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex);
|
|
|
return ret;
|
|
|
}
|
|
|
|