public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Utako Kusaka <u-kusaka@wm.jp.nec.com>
To: xfs <xfs@oss.sgi.com>
Subject: direct IO question
Date: Tue, 10 May 2011 14:41:51 +0900	[thread overview]
Message-ID: <4DC8D01F.5060704@wm.jp.nec.com> (raw)

Hi,

When I tested concurrent mmap write and direct IO to the same file,
it was corrupted. Kernel version is 2.6.39-rc4.
I have two questions concerning xfs direct IO.

The first is dirty pages are released in direct read. xfs direct IO uses
xfs_flushinval_pages(), which writes out and releases dirty pages.
If pages are marked as dirty after filemap_write_and_wait_range(),
they will be released in truncate_inode_pages_range() without writing out.

sys_read()
  vfs_read()
    do_sync_read()
      xfs_file_aio_read()
        xfs_flushinval_pages()
          filemap_write_and_wait_range()
          truncate_inode_pages_range()      <---
        generic_file_aio_read()
          filemap_write_and_wait_range()
          xfs_vm_direct_IO()

ext3 calls generic_file_aio_read() only and does not call
truncate_inode_pages_range().

sys_read()
  vfs_read()
    do_sync_read()
      generic_file_aio_read()
        filemap_write_and_wait_range()
        ext3_direct_IO()

xfs_file_aio_read() and xfs_file_dio_aio_write() call generic function. And
both xfs functions and generic functions call filemap_write_and_wait_range().
So I wonder whether xfs_flushinval_pages() is necessary.


Then, the write range in xfs_flushinval_pages() called from direct IO is
from start pos to -1, or LLONG_MAX, and is not IO range. Is there any reason?
In generic_file_aio_read and generic_file_direct_write(), it is from start pos
to (pos + len - 1).
I think xfs_flushinval_pages() should be called with same range.

Regards,
Utako

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2011-05-10  5:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10  5:41 Utako Kusaka [this message]
2011-05-10 13:23 ` direct IO question Dave Chinner

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=4DC8D01F.5060704@wm.jp.nec.com \
    --to=u-kusaka@wm.jp.nec.com \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox