From 642afcf865a4ecf1433537654f462e69e02f57f6 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Wed, 22 Jun 2005 17:16:30 +0000 Subject: [PATCH] --- yaml --- r: 2803 b: refs/heads/master c: ab0a3dbedc51037f3d2e22ef67717a987b3d15e2 h: refs/heads/master i: 2801: ad1dff8201960adf10f1e4edb2859f2e3532abe0 2799: ef9c96c1e5b74b2af91ea28abbaa6e5d8b605c27 v: v3 --- [refs] | 2 +- trunk/fs/nfs/write.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index bef619518c22..17d0a5c4281d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fe51beecc55d0b0dce289e4758e7c529a642f63e +refs/heads/master: ab0a3dbedc51037f3d2e22ef67717a987b3d15e2 diff --git a/trunk/fs/nfs/write.c b/trunk/fs/nfs/write.c index c574d551f029..79b621a545b2 100644 --- a/trunk/fs/nfs/write.c +++ b/trunk/fs/nfs/write.c @@ -750,7 +750,7 @@ int nfs_updatepage(struct file *file, struct page *page, * is entirely in cache, it may be more efficient to avoid * fragmenting write requests. */ - if (PageUptodate(page) && inode->i_flock == NULL) { + if (PageUptodate(page) && inode->i_flock == NULL && !(file->f_mode & O_SYNC)) { loff_t end_offs = i_size_read(inode) - 1; unsigned long end_index = end_offs >> PAGE_CACHE_SHIFT; @@ -1342,8 +1342,16 @@ static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, spin_lock(&nfsi->req_lock); res = nfs_scan_dirty(inode, &head, idx_start, npages); spin_unlock(&nfsi->req_lock); - if (res) - error = nfs_flush_list(&head, NFS_SERVER(inode)->wpages, how); + if (res) { + struct nfs_server *server = NFS_SERVER(inode); + + /* For single writes, FLUSH_STABLE is more efficient */ + if (res == nfsi->npages && nfsi->npages <= server->wpages) { + if (res > 1 || nfs_list_entry(head.next)->wb_bytes <= server->wsize) + how |= FLUSH_STABLE; + } + error = nfs_flush_list(&head, server->wpages, how); + } if (error < 0) return error; return res;