[Devel] [PATCH RH7] ploop: Enable 1M holes with zeroing indexes for io_kaio

Kirill Tkhai ktkhai at virtuozzo.com
Mon Aug 17 18:26:15 MSK 2020


https://jira.sw.ru/browse/PSBM-105347

On 17.08.2020 18:25, Kirill Tkhai wrote:
> This just enables the functionality for testing.
> 1M allocation is not implemented yet.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  drivers/block/ploop/fmt_ploop1.c |    2 +-
>  drivers/block/ploop/io_kaio.c    |   14 ++++++++++++--
>  2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
> index 2180dfcb3580..b5f95946c801 100644
> --- a/drivers/block/ploop/fmt_ploop1.c
> +++ b/drivers/block/ploop/fmt_ploop1.c
> @@ -333,7 +333,7 @@ ploop1_open(struct ploop_delta * delta)
>  	    ((u64)ph->bd_size + ph->l1_off) << 9)
>  		delta->flags |= PLOOP_FMT_PREALLOCATED;
>  
> -	if (delta->io.ops->id != PLOOP_IO_DIRECT || kaio_backed_ext4)
> +	if (delta->io.ops->id != PLOOP_IO_DIRECT && !kaio_backed_ext4)
>  		set_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
>  
>  	return 0;
> diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
> index 1151b862407e..2052dac43c1a 100644
> --- a/drivers/block/ploop/io_kaio.c
> +++ b/drivers/block/ploop/io_kaio.c
> @@ -17,6 +17,7 @@
>  #include <linux/aio.h>
>  
>  #include <linux/ploop/ploop.h>
> +#include <uapi/linux/falloc.h>
>  
>  #define KAIO_PREALLOC (128 * 1024 * 1024) /* 128 MB */
>  
> @@ -183,8 +184,17 @@ static int kaio_kernel_submit(struct file *file, struct kaio_req *kreq,
>  
>  	if (rw & REQ_DISCARD) {
>  		op = IOCB_CMD_UNMAP_ITER;
> -		if (file_inode(file)->i_sb->s_magic == EXT4_SUPER_MAGIC)
> -			return -ENOTSUPP;
> +		if (file_inode(file)->i_sb->s_magic == EXT4_SUPER_MAGIC) {
> +			err = file->f_op->fallocate(file,
> +				    FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE,
> +				    pos, count);
> +			if (err == 0) {
> +				kaio_complete_io_request(kreq->preq);
> +				/* Otherwise, caller decrements counter */
> +			}
> +			return err;
> +		}
> +
>  	} else if (rw & REQ_WRITE)
>  		op = IOCB_CMD_WRITE_ITER;
>  	else
> 
> 



More information about the Devel mailing list