From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753904AbZH3QhF (ORCPT ); Sun, 30 Aug 2009 12:37:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753883AbZH3QhE (ORCPT ); Sun, 30 Aug 2009 12:37:04 -0400 Received: from mail2.shareable.org ([80.68.89.115]:41325 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753862AbZH3QhC (ORCPT ); Sun, 30 Aug 2009 12:37:02 -0400 Date: Sun, 30 Aug 2009 17:35:51 +0100 From: Jamie Lokier To: Christoph Hellwig Cc: Jan Kara , LKML , hch@lst.de, linux-fsdevel@vger.kernel.org, Evgeniy Polyakov , ocfs2-devel@oss.oracle.com, Joel Becker , Felix Blyakher , xfs@oss.sgi.com, Anton Altaparmakov , linux-ntfs-dev@lists.sourceforge.net, OGAWA Hirofumi , linux-ext4@vger.kernel.org, tytso@mit.edu Subject: Re: [PATCH 07/17] vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode Message-ID: <20090830163551.GA7129@shareable.org> References: <1250875447-15622-1-git-send-email-jack@suse.cz> <1250875447-15622-8-git-send-email-jack@suse.cz> <20090827173540.GA19115@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090827173540.GA19115@infradead.org> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id n7UGZg6q035958 for ; Sun, 30 Aug 2009 11:35:53 -0500 Date: Sun, 30 Aug 2009 17:35:51 +0100 From: Jamie Lokier Subject: Re: [PATCH 07/17] vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode Message-ID: <20090830163551.GA7129@shareable.org> References: <1250875447-15622-1-git-send-email-jack@suse.cz> <1250875447-15622-8-git-send-email-jack@suse.cz> <20090827173540.GA19115@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090827173540.GA19115@infradead.org> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: xfs-bounces@oss.sgi.com Errors-To: xfs-bounces@oss.sgi.com To: Christoph Hellwig Cc: tytso@mit.edu, linux-ext4@vger.kernel.org, Jan Kara , linux-ntfs-dev@lists.sourceforge.net, LKML , Joel Becker , Anton Altaparmakov , OGAWA Hirofumi , linux-fsdevel@vger.kernel.org, Evgeniy Polyakov , xfs@oss.sgi.com, hch@lst.de, ocfs2-devel@oss.oracle.com 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 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Date: Sun, 30 Aug 2009 16:36:20 -0000 Subject: [Ocfs2-devel] [PATCH 07/17] vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode In-Reply-To: <20090827173540.GA19115@infradead.org> References: <1250875447-15622-1-git-send-email-jack@suse.cz> <1250875447-15622-8-git-send-email-jack@suse.cz> <20090827173540.GA19115@infradead.org> Message-ID: <20090830163551.GA7129@shareable.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Christoph Hellwig Cc: Jan Kara , LKML , hch@lst.de, linux-fsdevel@vger.kernel.org, Evgeniy Polyakov , ocfs2-devel@oss.oracle.com, Joel Becker , Felix Blyakher , xfs@oss.sgi.com, Anton Altaparmakov , linux-ntfs-dev@lists.sourceforge.net, OGAWA Hirofumi , linux-ext4@vger.kernel.org, tytso@mit.edu 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