Re: [PATCH V2 2/3] block/loop: use FALLOC_FL_ZERO_RANGE for REQ_OP_WRITE_ZEROES

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

 



On Thu, Sep 7, 2017 at 8:13 AM, Shaohua Li <shli@xxxxxxxxxx> wrote:
> From: Shaohua Li <shli@xxxxxx>
>
> REQ_OP_WRITE_ZEROES really means zero the data. And in blkdev_fallocate,
> FALLOC_FL_ZERO_RANGE will retry but FALLOC_FL_PUNCH_HOLE not, even loop
> request doesn't have BLKDEV_ZERO_NOFALLBACK set.
>
> Signed-off-by: Shaohua Li <shli@xxxxxx>
> ---
>  drivers/block/loop.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 715b762..8934e25 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -426,6 +426,9 @@ static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos)
>         int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
>         int ret;
>
> +       if (req_op(rq) == REQ_OP_WRITE_ZEROES)
> +               mode = FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE;
> +
>         if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) {
>                 ret = -EOPNOTSUPP;
>                 goto out;
> --
> 2.9.5
>

Looks fine,

      Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>


-- 
Ming Lei



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux