From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 44/47] nfs: limit the range of commits Date: Mon, 13 Dec 2010 14:43:33 +0800 Message-ID: <20101213064842.427980918@intel.com> References: <20101213064249.648862451@intel.com> Return-path: Received: from kanga.kvack.org ([205.233.56.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PS2F1-0005gi-5c for glkm-linux-mm-2@m.gmane.org; Mon, 13 Dec 2010 07:50:35 +0100 Received: from mail190.messagelabs.com (mail190.messagelabs.com [216.82.249.51]) by kanga.kvack.org (Postfix) with SMTP id 96DCF6B0099 for ; Mon, 13 Dec 2010 01:49:41 -0500 (EST) Content-Disposition: inline; filename=nfs-commit-range.patch Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: Jan Kara , Trond Myklebust , Wu Fengguang , Christoph Hellwig , Dave Chinner , Theodore Ts'o , Chris Mason , Peter Zijlstra , Mel Gorman , Rik van Riel , KOSAKI Motohiro , Greg Thelen , Minchan Kim , linux-mm , linux-fsdevel@vger.kernel.org, LKML List-Id: linux-mm.kvack.org Hopefully this will help limit the number of unstable pages to be synced at one time, more timely return of the commit request and reduce dirty throttle fluctuations. CC: Trond Myklebust Signed-off-by: Wu Fengguang --- fs/nfs/write.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) --- linux-next.orig/fs/nfs/write.c 2010-12-08 22:54:08.000000000 +0800 +++ linux-next/fs/nfs/write.c 2010-12-08 22:54:13.000000000 +0800 @@ -1333,7 +1333,7 @@ static void nfs_commitdata_release(void */ static int nfs_commit_rpcsetup(struct list_head *head, struct nfs_write_data *data, - int how) + int how, pgoff_t offset, pgoff_t count) { struct nfs_page *first = nfs_list_entry(head->next); struct inode *inode = first->wb_context->path.dentry->d_inode; @@ -1365,8 +1365,8 @@ static int nfs_commit_rpcsetup(struct li data->args.fh = NFS_FH(data->inode); /* Note: we always request a commit of the entire inode */ - data->args.offset = 0; - data->args.count = 0; + data->args.offset = offset; + data->args.count = count; data->args.context = get_nfs_open_context(first->wb_context); data->res.count = 0; data->res.fattr = &data->fattr; @@ -1389,7 +1389,8 @@ static int nfs_commit_rpcsetup(struct li * Commit dirty pages */ static int -nfs_commit_list(struct inode *inode, struct list_head *head, int how) +nfs_commit_list(struct inode *inode, struct list_head *head, int how, + pgoff_t offset, pgoff_t count) { struct nfs_write_data *data; struct nfs_page *req; @@ -1400,7 +1401,7 @@ nfs_commit_list(struct inode *inode, str goto out_bad; /* Set up the argument struct */ - return nfs_commit_rpcsetup(head, data, how); + return nfs_commit_rpcsetup(head, data, how, offset, count); out_bad: while (!list_empty(head)) { req = nfs_list_entry(head->next); @@ -1485,6 +1486,8 @@ static const struct rpc_call_ops nfs_com int nfs_commit_inode(struct inode *inode, int how) { LIST_HEAD(head); + pgoff_t first_index; + pgoff_t last_index; int sync = how & FLUSH_SYNC; int res = 0; @@ -1494,9 +1497,14 @@ int nfs_commit_inode(struct inode *inode nfs_commit_wait(NFS_SERVER(inode)); spin_lock(&inode->i_lock); res = nfs_scan_commit(inode, &head, 0, 0); + if (res) { + first_index = nfs_list_entry(head.next)->wb_index; + last_index = nfs_list_entry(head.prev)->wb_index; + } spin_unlock(&inode->i_lock); if (res) { - int error = nfs_commit_list(inode, &head, how); + int error = nfs_commit_list(inode, &head, how, first_index, + last_index - first_index + 1); if (error < 0) return error; if (sync) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: email@kvack.org