[Devel] [PATCH 1/3] ploop: skip redundant fsync for REQ_FUA in post_submit

Maxim Patlasov mpatlasov at virtuozzo.com
Wed Jun 15 10:34:29 PDT 2016


ACK-ed, but see a minor nit below

On 06/15/2016 07:49 AM, Dmitry Monakhov wrote:
> Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
> ---
>   drivers/block/ploop/io_direct.c | 22 +++++++++++++---------
>   1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
> index b844a80..74a554a 100644
> --- a/drivers/block/ploop/io_direct.c
> +++ b/drivers/block/ploop/io_direct.c
> @@ -517,16 +517,18 @@ dio_post_submit(struct ploop_io *io, struct ploop_request * preq)
>   	struct ploop_device *plo = preq->plo;
>   	sector_t sec = (sector_t)preq->iblock << preq->plo->cluster_log;
>   	loff_t clu_siz = 1 << (preq->plo->cluster_log + 9);
> +	int force_sync = preq->req_rw & REQ_FUA;
>   	int err;
>   
>   	file_start_write(io->files.file);
>   
> -	/* Here io->io_count is even ... */
> -	spin_lock_irq(&plo->lock);
> -	io->io_count++;
> -	set_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state);
> -	spin_unlock_irq(&plo->lock);
> -
> +	if (!force_sync) {
> +		/* Here io->io_count is even ... */
> +		spin_lock_irq(&plo->lock);
> +		io->io_count++;
> +		set_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state);
> +		spin_unlock_irq(&plo->lock);
> +	}
>   	err = io->files.file->f_op->fallocate(io->files.file,
>   					      FALLOC_FL_CONVERT_UNWRITTEN,
>   					      (loff_t)sec << 9, clu_siz);
> @@ -535,9 +537,11 @@ dio_post_submit(struct ploop_io *io, struct ploop_request * preq)
>   	if (!err && (preq->req_rw & REQ_FUA))

s/(preq->req_rw & REQ_FUA)/force_sync

Thanks,
Max

>   		err = io->ops->sync(io);
>   
> -	spin_lock_irq(&plo->lock);
> -	io->io_count++;
> -	spin_unlock_irq(&plo->lock);
> +	if (!force_sync) {
> +		spin_lock_irq(&plo->lock);
> +		io->io_count++;
> +		spin_unlock_irq(&plo->lock);
> +	}
>   	/* and here io->io_count is even (+2) again. */
>   
>   	file_end_write(io->files.file);



More information about the Devel mailing list