aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@huawei.com>2015-02-16 19:00:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-16 20:56:05 -0500
commitd943d59dd32d33cd8a44a2f9caf373ede11200da (patch)
tree9d631612c7fdc222c4d81e75cffca36acab72c29
parent49255dce65dba3d06a0f642fee788f0a50d48d5b (diff)
ocfs2: do not fallback to buffer I/O write if appending
Now we can do direct io and do not fallback to buffered IO any more in case of append O_DIRECT write. Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Cc: Weiwei Wang <wangww631@huawei.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Xuejiufei <xuejiufei@huawei.com> Cc: alex chen <alex.chen@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ocfs2/file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 2fce3c40ad27..1055a2ece738 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2116,6 +2116,9 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
2116 struct dentry *dentry = file->f_path.dentry; 2116 struct dentry *dentry = file->f_path.dentry;
2117 struct inode *inode = dentry->d_inode; 2117 struct inode *inode = dentry->d_inode;
2118 loff_t saved_pos = 0, end; 2118 loff_t saved_pos = 0, end;
2119 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2120 int full_coherency = !(osb->s_mount_opt &
2121 OCFS2_MOUNT_COHERENCY_BUFFERED);
2119 2122
2120 /* 2123 /*
2121 * We start with a read level meta lock and only jump to an ex 2124 * We start with a read level meta lock and only jump to an ex
@@ -2204,7 +2207,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
2204 * one node could wind up truncating another 2207 * one node could wind up truncating another
2205 * nodes writes. 2208 * nodes writes.
2206 */ 2209 */
2207 if (end > i_size_read(inode)) { 2210 if (end > i_size_read(inode) && !full_coherency) {
2208 *direct_io = 0; 2211 *direct_io = 0;
2209 break; 2212 break;
2210 } 2213 }