[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090830163551.GA7129@shareable.org>
Date: Sun, 30 Aug 2009 17:35:51 +0100
From: Jamie Lokier <jamie@...reable.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Jan Kara <jack@...e.cz>, LKML <linux-kernel@...r.kernel.org>,
hch@....de, linux-fsdevel@...r.kernel.org,
Evgeniy Polyakov <zbr@...emap.net>, ocfs2-devel@....oracle.com,
Joel Becker <joel.becker@...cle.com>,
Felix Blyakher <felixb@....com>, xfs@....sgi.com,
Anton Altaparmakov <aia21@...tab.net>,
linux-ntfs-dev@...ts.sourceforge.net,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
linux-ext4@...r.kernel.org, tytso@....edu
Subject: Re: [PATCH 07/17] vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode
Christoph Hellwig wrote:
> 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.
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);
}
(By the way, did I mention Irix has range-fsync and range-fdatasync
system calls too :-) (actually fcntls))
-- Jamie
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists