aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/write.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 77a00c66c7d9..a44a87268a6e 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -922,19 +922,20 @@ out:
922 * extend the write to cover the entire page in order to avoid fragmentation 922 * extend the write to cover the entire page in order to avoid fragmentation
923 * inefficiencies. 923 * inefficiencies.
924 * 924 *
925 * If the file is opened for synchronous writes or if we have a write delegation 925 * If the file is opened for synchronous writes then we can just skip the rest
926 * from the server then we can just skip the rest of the checks. 926 * of the checks.
927 */ 927 */
928static int nfs_can_extend_write(struct file *file, struct page *page, struct inode *inode) 928static int nfs_can_extend_write(struct file *file, struct page *page, struct inode *inode)
929{ 929{
930 if (file->f_flags & O_DSYNC) 930 if (file->f_flags & O_DSYNC)
931 return 0; 931 return 0;
932 if (!nfs_write_pageuptodate(page, inode))
933 return 0;
932 if (NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE)) 934 if (NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE))
933 return 1; 935 return 1;
934 if (nfs_write_pageuptodate(page, inode) && (inode->i_flock == NULL || 936 if (inode->i_flock == NULL || (inode->i_flock->fl_start == 0 &&
935 (inode->i_flock->fl_start == 0 &&
936 inode->i_flock->fl_end == OFFSET_MAX && 937 inode->i_flock->fl_end == OFFSET_MAX &&
937 inode->i_flock->fl_type != F_RDLCK))) 938 inode->i_flock->fl_type != F_RDLCK))
938 return 1; 939 return 1;
939 return 0; 940 return 0;
940} 941}