xfs
[Top] [All Lists]

Re: [PATCH 07/17] vfs: Introduce new helpers for syncing after writing t

To: Jan Kara <jack@xxxxxxx>
Subject: Re: [PATCH 07/17] vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 27 Aug 2009 13:35:40 -0400
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, hch@xxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, Evgeniy Polyakov <zbr@xxxxxxxxxxx>, ocfs2-devel@xxxxxxxxxxxxxx, Joel Becker <joel.becker@xxxxxxxxxx>, Felix Blyakher <felixb@xxxxxxx>, xfs@xxxxxxxxxxx, Anton Altaparmakov <aia21@xxxxxxxxxx>, linux-ntfs-dev@xxxxxxxxxxxxxxxxxxxxx, OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>, linux-ext4@xxxxxxxxxxxxxxx, tytso@xxxxxxx
In-reply-to: <1250875447-15622-8-git-send-email-jack@xxxxxxx>
References: <1250875447-15622-1-git-send-email-jack@xxxxxxx> <1250875447-15622-8-git-send-email-jack@xxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
> +int generic_write_sync(struct file *file, loff_t pos, loff_t count)
> +{
> +     if (!(file->f_flags & O_SYNC) && !IS_SYNC(file->f_mapping->host))
> +             return 0;
> +     return generic_sync_file(file, file->f_path.dentry, pos,
> +                              pos + count - 1,
> +                              SYNC_SUBMIT_DATA | SYNC_WAIT_DATA);
> +}
> +EXPORT_SYMBOL(generic_write_sync);

>  
> +/* Flags for generic_sync_file */
> +#define SYNC_INODE           1
> +#define SYNC_SUBMIT_DATA     2
> +#define SYNC_WAIT_DATA               4

When I think about this more I really hate the latter two flags.
There's really no reason to just do only either the submit or wait.
I'd say kill the flags for now and just implement generic_write_sync
as:

int generic_write_sync(struct file *file, loff_t pos, loff_t count)
{
        if (!(file->f_flags & O_SYNC) && !IS_SYNC(file->f_mapping->host))
                return 0;
        return vfs_fsync_range(file, file->f_path.dentry, pos,
                               pos + count - 1, 1);
}

and we can look into replacing the datasync flag with something more
meaningfull later through the whole fsync stack.

<Prev in Thread] Current Thread [Next in Thread>