From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: add sync_inode_metadata
Date: Wed, 20 Oct 2010 12:02:43 +0200 [thread overview]
Message-ID: <20101020100243.GA3335@quack.suse.cz> (raw)
In-Reply-To: <20101006084820.GD8093@lst.de>
On Wed 06-10-10 10:48:20, Christoph Hellwig wrote:
> Add a new helper to write out the inode using the writeback code,
> that is including the correct dirty bit and list manipulation. A few
> of filesystems already opencode this, and a lot of others should be
> using it instead of using write_inode_now which also writes out the
> data.
I'm reacting late but anyways:
> Index: linux-2.6/fs/fs-writeback.c
> ===================================================================
> --- linux-2.6.orig/fs/fs-writeback.c 2010-10-05 10:51:24.611023726 +0200
> +++ linux-2.6/fs/fs-writeback.c 2010-10-05 10:53:24.684255876 +0200
> @@ -1209,3 +1209,23 @@ int sync_inode(struct inode *inode, stru
> return ret;
> }
> EXPORT_SYMBOL(sync_inode);
> +
> +/**
> + * sync_inode - write an inode to disk
> + * @inode: the inode to sync
> + * @wait: wait for I/O to complete.
> + *
> + * Write an inode to disk and adjust it's dirty state after completion.
> + *
> + * Note: only writes the actual inode, no associated data or other metadata.
> + */
> +int sync_inode_metadata(struct inode *inode, int wait)
> +{
> + struct writeback_control wbc = {
> + .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
> + .nr_to_write = 0, /* metadata-only */
This is a catch in write_cache_pages() code. If you call it in
WB_SYNC_ALL mode, they will just ignore the .nr_to_write argument. So what
actually ensures that we do not write data is that .range_start and
.range_end are implicitely set to 0. In fact, write_cache_pages() will
write page with index 0 in that case. So setting .range_start to 1 would be
even better.
Otherwise the patch looks OK.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
prev parent reply other threads:[~2010-10-20 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 8:48 [PATCH] fs: add sync_inode_metadata Christoph Hellwig
2010-10-20 10:02 ` Jan Kara [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=20101020100243.GA3335@quack.suse.cz \
--to=jack@suse.cz \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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.