[Ocfs2-devel] [PATCH] ocfs2: avoid direct write if we fall back to buffered v2

Joel Becker Joel.Becker at oracle.com
Fri Apr 16 03:07:36 PDT 2010


On Thu, Apr 15, 2010 at 09:01:56PM +0800, Li Dongyang wrote:
> -	if (direct_io) {
> -		ret = generic_segment_checks(iov, &nr_segs, &ocount,
> -					     VERIFY_READ);
> -		if (ret)
> -			goto out_dio;
> +	ret = generic_segment_checks(iov, &nr_segs, &ocount,
> +				     VERIFY_READ);
> +	if (ret)
> +		goto out_dio;
>  
> -		count = ocount;
> -		ret = generic_write_checks(file, ppos, &count,
> -					   S_ISBLK(inode->i_mode));
> -		if (ret)
> -			goto out_dio;
> +	count = ocount;
> +	ret = generic_write_checks(file, ppos, &count,
> +				   S_ISBLK(inode->i_mode));
> +	if (ret)
> +		goto out_dio;

	Make sure you add the management of current->backing_dev_info
just like __generic_file_aio_write() does.  We want to ensure that page
writeback works OK.

Joel

-- 

"If the human brain were so simple we could understand it, we would
 be so simple that we could not."
	- W. A. Clouston

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-devel mailing list