[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Re: [GFS2] Don't flush everything on fdatasync [70/70]



On Thu, 30 Nov 2006 12:24:08 +0000
Steven Whitehouse <swhiteho redhat com> wrote:

>  static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
>  {
> -	struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
> +	struct inode *inode = dentry->d_inode;
> +	int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC);
> +	int ret = 0;
> +	struct writeback_control wbc = {
> +		.sync_mode = WB_SYNC_ALL,
> +		.nr_to_write = 0,
> +	};
> +
> +	if (gfs2_is_jdata(GFS2_I(inode))) {
> +		gfs2_log_flush(GFS2_SB(inode), GFS2_I(inode)->i_gl);
> +		return 0;
> +	}
>  
> -	gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
> +	if (sync_state != 0) {
> +		if (!datasync)
> +			ret = sync_inode(inode, &wbc);

filemap_fdatawrite() would be simpler.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]