Re: [PATCH] fs: push i_mutex and filemap_write_and_wait down into->fsync() handlers

From: Ted Ts'o
Date: Mon Jul 25 2011 - 13:38:30 EST


On Wed, Jun 29, 2011 at 02:05:16PM -0400, Josef Bacik wrote:
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index ce66d2f..da3bed3 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -151,6 +151,32 @@ static int ext4_sync_parent(struct inode *inode)
> return ret;
> }
>
> +/**
> + * __sync_file - generic_file_fsync without the locking and filemap_write
> + * @inode: inode to sync
> + * @datasync: only sync essential metadata if true
> + *
> + * This is just generic_file_fsync without the locking. This is needed for
> + * nojournal mode to make sure this inodes data/metadata makes it to disk
> + * properly. The i_mutex should be held already.
> + */
> +static int __sync_inode(struct inode *inode, int datasync)

The comment calls this __sync_file, instead of __sync_inode.

Maybe it would be better to define a generic_file_fsync_nolock() in
fs/libfs.c and then have generic_file_fsync() call the _nolock()
function? That way we don't have the code duplicated in two different
places, and eventually risking it going out of sync with each other.

- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/