xfs
[Top] [All Lists]

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

To: Jamie Lokier <jamie@xxxxxxxxxxxxx>
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@xxxxxx>
Date: Sun, 30 Aug 2009 18:39:17 +0200
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxx>, 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: <20090830163551.GA7129@xxxxxxxxxxxxx>
References: <1250875447-15622-1-git-send-email-jack@xxxxxxx> <1250875447-15622-8-git-send-email-jack@xxxxxxx> <20090827173540.GA19115@xxxxxxxxxxxxx> <20090830163551.GA7129@xxxxxxxxxxxxx>
User-agent: Mutt/1.3.28i
On Sun, Aug 30, 2009 at 05:35:51PM +0100, Jamie Lokier wrote:
> I like that.  It looks really clear and self-documenting, if
> vfs_fsync_range does what it sounds like, which is a nice change.
> 
> If I've guessed right what that code does, proper O_RSYNC will be easy:
> 
> int generic_sync_before_read(struct file *file, loff_t pos, loff_t count)
> {
>       int is_sync = ((file->f_flags & O_SYNC)
>                      || IS_SYNC(file->f_mapping->host));
>       int is_dsync = is_sync || (file->f_flags & O_DSYNC);
> 
>       if (!is_dsync || !(file->f_flags & O_RSYNC))
>               return 0;
>       return vfs_fsync_range(file, file->f_ath.denty, pos,
>                              pos + count - 1, is_sync);
> }

Yes. something like this.

> (By the way, did I mention Irix has range-fsync and range-fdatasync
> system calls too :-) (actually fcntls))

Linux has sync_file_range which currently is a perfect way to lose your
synced' data, but with two more flags and calls to ->fsync we could
turn it into range-fsync/fdatasync.  I'm not sure if that's a good
idea or if we should just add a sys_fdatasync_rage systems call.

I don't quite see the point of a range-fsync, but it could be easily
implemented as a flag.

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