[Devel] [vzlin-dev] [PATCH rh7 4/4] ploop: get rid of direct calls to file->f_op->fsync()

Dmitry Monakhov dmonakhov at openvz.org
Fri May 20 06:02:56 PDT 2016


Maxim Patlasov <mpatlasov at virtuozzo.com> writes:

> The patch hides file->f_op->fsync() in dio_sync. The only exception is
> dio_truncate where "file" may come from userspace fd.
>
> Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
Acked-by:dmonakhov at openvz.org
> ---
>  drivers/block/ploop/io_direct.c |   13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
> index 1ff848c..8096110 100644
> --- a/drivers/block/ploop/io_direct.c
> +++ b/drivers/block/ploop/io_direct.c
> @@ -405,8 +405,7 @@ try_again:
>  			}
>  
>  			/* flush new i_size to disk */
> -			err = io->files.file->f_op->fsync(io->files.file, 0,
> -							  LLONG_MAX, 0);
> +			err = io->ops->sync(io);
>  			if (err)
>  				goto end_write;
>  
> @@ -524,8 +523,8 @@ dio_post_submit(struct ploop_io *io, struct ploop_request * preq)
>  					      FALLOC_FL_CONVERT_UNWRITTEN,
>  					      (loff_t)sec << 9, clu_siz);
>  	if (!err)
> -		err = io->files.file->f_op->fsync(io->files.file, 0,
> -						  LLONG_MAX, 0);
> +		err = io->ops->sync(io);
> +
>  	file_end_write(io->files.file);
>  	if (err) {
>  		PLOOP_REQ_SET_ERROR(preq, err);
> @@ -814,8 +813,7 @@ static int dio_fsync_thread(void * data)
>  		/* filemap_fdatawrite() has been made already */
>  		filemap_fdatawait(io->files.mapping);
>  
> -		err = io->files.file->f_op->fsync(io->files.file, 0,
> -						  LLONG_MAX, 0);
> +		err = io->ops->sync(io);
>  
>  		/* Do we need to invalidate page cache? Not really,
>  		 * because we use it only to create full new pages,
> @@ -1367,8 +1365,7 @@ static int dio_alloc_sync(struct ploop_io * io, loff_t pos, loff_t len)
>  	if (err)
>  		goto fail;
>  
> -	err = io->files.file->f_op->fsync(io->files.file, 0,
> -					  LLONG_MAX, 0);
> +	err = io->ops->sync(io);
>  	if (err)
>  		goto fail;
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160520/66c17bac/attachment.sig>


More information about the Devel mailing list