diff options
author | Tao Ma <tao.ma@oracle.com> | 2009-09-10 03:28:47 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-23 04:54:49 -0400 |
commit | b80474b432913f73cce8db001e9fa3104f9b79ee (patch) | |
tree | ad39c36ce3006167d02ca176eb140012c6530a06 /fs/ocfs2 | |
parent | 83e32d9044a4510fffdf65c2691a25c0ba84e259 (diff) |
ocfs2: Use buffer IO if we are appending a file.
In ocfs2_file_aio_write, we will prevent direct io if
we find that we are appending(changing i_size) and call
generic_file_aio_write_nolock. But actually O_DIRECT flag
is there and this function will call generic_file_direct_write
eventually which will update i_size and leave di->i_size
alone. The bug is
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1173.
So this patch let ocfs2_direct_IO returns 0 directly if we
are appending so that buffered write will be called and
di->i_size get updated successfully. And this is also
what we want in ocfs2_file_aio_write.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/aops.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 33e03c551127..72e76062a900 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -690,6 +690,10 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
690 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 690 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
691 | return 0; | 691 | return 0; |
692 | 692 | ||
693 | /* Fallback to buffered I/O if we are appending. */ | ||
694 | if (i_size_read(inode) <= offset) | ||
695 | return 0; | ||
696 | |||
693 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, | 697 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, |
694 | inode->i_sb->s_bdev, iov, offset, | 698 | inode->i_sb->s_bdev, iov, offset, |
695 | nr_segs, | 699 | nr_segs, |