From: Chris Mason <chris.mason@oracle.com>
To: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: call mark_inode_dirty when i_size is updated
Date: Mon, 02 Feb 2009 20:04:52 -0500 [thread overview]
Message-ID: <1233623092.20109.2.camel@think.oraclecorp.com> (raw)
In-Reply-To: <6.0.0.20.2.20090203092917.06abcde0@172.19.0.2>
On Tue, 2009-02-03 at 09:36 +0900, Hisashi Hifumi wrote:
> At 23:12 09/02/02, Chris Mason wrote:
> >On Mon, 2009-02-02 at 20:00 +0900, Hisashi Hifumi wrote:
> >> Hi Chris.
> >>
> >> I think it is needed to call mark_inode_dirty() when file size expands
> >> in order to flush metadata updates to HDD through sync() syscall or
> >> background_writeout().
> >>
> >
> >Thanks for reading through this code and sending the patch.
> >
> >I find the I_DIRTY flags one of the more confusing parts of the generic
> >fs writeback cdoe. But, I think what happens is the
> >btrfs_set_page_dirty function calls __set_page_dirty_nobuffers() which
> >does:
> >
> >if (mapping->host) {
> > /* !PageAnon && !swapper_space */
> > __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
> >}
> >
> >This should be enough to make sure the btrfs inodes are processed by
> >background writeout and sync(). Please let me know if I'm misreading
> >things.
>
> Surely, as you pointed out, btrfs_set_page_dirty calls
> if (mapping->host) {
> /* !PageAnon && !swapper_space */
> __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
> }
> through _set_page_dirty_nobuffers.
> But I_DIRTY_PAGES is not sufficient.
> To flush metadata update to HDD through sync(), I_DIRTY_SYNC or
> I_DIRTY_DATASYNC flag is needed. see __sync_single_inode.
Since btrfs uses a dirty_inode callback, our inodes are never really
dirty. The btree metadata always has the same information as the in-core
inode does.
The extra transaction commit steps taken at sync time are enough to get
all the relevant metadata on disk.
So, I think what happens is that I_DIRTY_PAGES is enough to get the data
pages on disk and the transaction commit gets the metadata on disk.
-chris
next prev parent reply other threads:[~2009-02-03 1:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-02 11:00 [PATCH] btrfs: call mark_inode_dirty when i_size is updated Hisashi Hifumi
2009-02-02 14:12 ` Chris Mason
2009-02-03 0:36 ` Hisashi Hifumi
2009-02-03 1:04 ` Chris Mason [this message]
2009-02-03 2:43 ` Hisashi Hifumi
2009-02-03 16:22 ` Chris Mason
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=1233623092.20109.2.camel@think.oraclecorp.com \
--to=chris.mason@oracle.com \
--cc=hifumi.hisashi@oss.ntt.co.jp \
--cc=linux-btrfs@vger.kernel.org \
/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.