All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: Use buffer IO if we are appending a file.
Date: Thu, 10 Sep 2009 16:38:13 -0700	[thread overview]
Message-ID: <4AA98DE5.4080709@oracle.com> (raw)
In-Reply-To: <1252567727-7571-1-git-send-email-tao.ma@oracle.com>

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>

Tao Ma wrote:

> 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 that
> 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>
> ---
>  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 c4c567e..769e5d0 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -690,6 +690,10 @@ static ssize_t ocfs2_direct_IO(int rw,
>  	if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
>  		return 0;
>  
> +	/* Fallback to buffered I/O if we are appending. */
> +	if (i_size_read(inode) <= offset)
> +		return 0;
> +
>  	ret = blockdev_direct_IO_no_locking(rw, iocb, inode,
>  					    inode->i_sb->s_bdev, iov, offset,
>  					    nr_segs, 
>   

      reply	other threads:[~2009-09-10 23:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10  7:28 [Ocfs2-devel] [PATCH] ocfs2: Use buffer IO if we are appending a file Tao Ma
2009-09-10 23:38 ` Sunil Mushran [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AA98DE5.4080709@oracle.com \
    --to=sunil.mushran@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.