From: andros@netapp.com Subject: [PATCH 6/6] SQUASHME pnfs-submit: move layoutcommit to nfs_write_inode Date: Wed, 2 Jun 2010 11:54:27 -0400 Message-ID: <1275494067-4058-7-git-send-email-andros@netapp.com> References: <1275494067-4058-1-git-send-email-andros@netapp.com> <1275494067-4058-2-git-send-email-andros@netapp.com> <1275494067-4058-3-git-send-email-andros@netapp.com> <1275494067-4058-4-git-send-email-andros@netapp.com> <1275494067-4058-5-git-send-email-andros@netapp.com> <1275494067-4058-6-git-send-email-andros@netapp.com> Cc: linux-nfs@vger.kernel.org, Andy Adamson To: bhalevy@panasas.com Return-path: Received: from mx2.netapp.com ([216.240.18.37]:18338 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758345Ab0FBRz0 (ORCPT ); Wed, 2 Jun 2010 13:55:26 -0400 In-Reply-To: <1275494067-4058-6-git-send-email-andros@netapp.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: From: Andy Adamson The LAYOUTCOMMIT call indicates an update to the file meta data is needed, and should be called when clearing the I_DIRTY_SYNC state. A call to LAYOUTCOMMIT in nfs_write_inode replaces the calls in nfs_wb_all, nfs_commit_inode, and __nfs4_close. Signed-off-by: Andy Adamson --- fs/nfs/nfs4state.c | 2 -- fs/nfs/write.c | 22 ++++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index d0dbdd4..e1207fa 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -589,8 +589,6 @@ static void __nfs4_close(struct path *path, struct nfs4_state *state, fmode_t fm #ifdef CONFIG_NFS_V4_1 struct nfs_inode *nfsi = NFS_I(state->inode); - if (layoutcommit_needed(nfsi)) - pnfs_layoutcommit_inode(state->inode, wait); if (has_layout(nfsi) && nfsi->layout.roc_iomode) { struct nfs4_pnfs_layout_segment range; diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 0fd33cb..875d07f 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1489,13 +1489,6 @@ static int nfs_commit_inode(struct inode *inode, int how) wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT, nfs_wait_bit_killable, TASK_KILLABLE); -#ifdef CONFIG_NFS_V4_1 - if (may_wait && layoutcommit_needed(NFS_I(inode))) { - error = pnfs_layoutcommit_inode(inode, 1); - if (error < 0) - return error; - } -#endif /* CONFIG_NFS_V4_1 */ } else nfs_commit_clear_lock(NFS_I(inode)); out: @@ -1545,7 +1538,16 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr int nfs_write_inode(struct inode *inode, struct writeback_control *wbc) { - return nfs_commit_unstable_pages(inode, wbc); + int ret; + ret = nfs_commit_unstable_pages(inode, wbc); +#ifdef CONFIG_NFS_V4_1 + if (ret >= 0 && layoutcommit_needed(NFS_I(inode))) { + int err = pnfs_layoutcommit_inode(inode, 1); + if (err < 0) + ret = err; + } +#endif /* CONFIG_NFS_V4_1 */ + return ret; } /* @@ -1562,10 +1564,6 @@ int nfs_wb_all(struct inode *inode) }; ret = sync_inode(inode, &wbc); -#ifdef CONFIG_NFS_V4_1 - if (!ret && layoutcommit_needed(NFS_I(inode))) - ret = pnfs_layoutcommit_inode(inode, 1); -#endif return ret; } -- 1.6.6