Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / fs / nfs / write.c
index 75a35a1afa7944d4ac54bd94994cddf1fd05ab54..388f48079c43839fa9c8222d78556282920858f2 100644 (file)
@@ -767,6 +767,28 @@ nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi,
        return NULL;
 }
 
+/**
+ * nfs_request_add_commit_list_locked - add request to a commit list
+ * @req: pointer to a struct nfs_page
+ * @dst: commit list head
+ * @cinfo: holds list lock and accounting info
+ *
+ * This sets the PG_CLEAN bit, updates the cinfo count of
+ * number of outstanding requests requiring a commit as well as
+ * the MM page stats.
+ *
+ * The caller must hold the cinfo->lock, and the nfs_page lock.
+ */
+void
+nfs_request_add_commit_list_locked(struct nfs_page *req, struct list_head *dst,
+                           struct nfs_commit_info *cinfo)
+{
+       set_bit(PG_CLEAN, &req->wb_flags);
+       nfs_list_add_request(req, dst);
+       cinfo->mds->ncommit++;
+}
+EXPORT_SYMBOL_GPL(nfs_request_add_commit_list_locked);
+
 /**
  * nfs_request_add_commit_list - add request to a commit list
  * @req: pointer to a struct nfs_page
@@ -784,13 +806,10 @@ void
 nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
                            struct nfs_commit_info *cinfo)
 {
-       set_bit(PG_CLEAN, &(req)->wb_flags);
        spin_lock(cinfo->lock);
-       nfs_list_add_request(req, dst);
-       cinfo->mds->ncommit++;
+       nfs_request_add_commit_list_locked(req, dst, cinfo);
        spin_unlock(cinfo->lock);
-       if (!cinfo->dreq)
-               nfs_mark_page_unstable(req->wb_page);
+       nfs_mark_page_unstable(req->wb_page, cinfo);
 }
 EXPORT_SYMBOL_GPL(nfs_request_add_commit_list);
 
@@ -1793,7 +1812,7 @@ out_mark_dirty:
        return res;
 }
 
-static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc)
+int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
        struct nfs_inode *nfsi = NFS_I(inode);
        int flags = FLUSH_SYNC;
@@ -1828,11 +1847,6 @@ out_mark_dirty:
        __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
        return ret;
 }
-
-int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
-{
-       return nfs_commit_unstable_pages(inode, wbc);
-}
 EXPORT_SYMBOL_GPL(nfs_write_inode);
 
 /*