Re: [PATCH] direct I/O fallback sync simplification

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

 



On Wed 23-09-09 15:07:30, Christoph Hellwig wrote:
> In the case of direct I/O falling back to buffered I/O we sync data
> twice currently: once at the end of generic_file_buffered_write using
> filemap_write_and_wait_range and once a little later in
> __generic_file_aio_write using do_sync_mapping_range with all flags set.
> 
> The wait before write of the do_sync_mapping_range call does not make
> any sense, so just keep the filemap_write_and_wait_range call and move
> it to the right spot.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
  Looks much better. Acked-by: Jan Kara <jack@xxxxxxx>

									Honza
> 
> Index: vfs-2.6.git/mm/filemap.c
> ===================================================================
> --- vfs-2.6.git.orig/mm/filemap.c	2009-09-22 14:20:59.917761567 -0300
> +++ vfs-2.6.git/mm/filemap.c	2009-09-22 14:28:01.833832530 -0300
> @@ -2265,15 +2265,6 @@ generic_file_buffered_write(struct kiocb
>  		*ppos = pos + status;
>    	}
>  	
> -	/*
> -	 * If we get here for O_DIRECT writes then we must have fallen through
> -	 * to buffered writes (block instantiation inside i_size).  So we sync
> -	 * the file data here, to try to honour O_DIRECT expectations.
> -	 */
> -	if (unlikely(file->f_flags & O_DIRECT) && written)
> -		status = filemap_write_and_wait_range(mapping,
> -					pos, pos + written - 1);
> -
>  	return written ? written : status;
>  }
>  EXPORT_SYMBOL(generic_file_buffered_write);
> @@ -2372,10 +2363,7 @@ ssize_t __generic_file_aio_write(struct 
>  		 * semantics.
>  		 */
>  		endbyte = pos + written_buffered - written - 1;
> -		err = do_sync_mapping_range(file->f_mapping, pos, endbyte,
> -					    SYNC_FILE_RANGE_WAIT_BEFORE|
> -					    SYNC_FILE_RANGE_WRITE|
> -					    SYNC_FILE_RANGE_WAIT_AFTER);
> +		err = filemap_write_and_wait_range(file->f_mapping, pos, endbyte);
>  		if (err == 0) {
>  			written = written_buffered;
>  			invalidate_mapping_pages(mapping,
-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux