Re: [PATCH V4 1/8] null_blk: allow REQ_OP_WRITE_ZEROES
From: Shinichiro Kawasaki
Date: Wed Nov 30 2022 - 20:21:22 EST
On Nov 30, 2022 / 23:29, Chaitanya Kulkarni wrote:
> >> Signed-off-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
> >
> > This motivation sounds good. I tried this patch. With a quick test it looks
> > working good for me. Please find minor comments in line.
> >
> > [...]
> >
> >> +static void null_zero_sector(struct nullb_device *d, sector_t sect,
> >> + sector_t nr_sects, bool cache)
> >> +{
> >> + struct radix_tree_root *root = cache ? &d->cache : &d->data;
> >> + struct nullb_page *t_page;
> >> + unsigned int offset;
> >> + void *dest;
> >> +
> >> + t_page = radix_tree_lookup(root, sect >> PAGE_SECTORS_SHIFT);
> >> + if (!t_page)
> >> + return;
> >> +
> >> + offset = (sect & SECTOR_MASK) << SECTOR_SHIFT;
> >> + dest = kmap_atomic(t_page->page);
> >> + memset(dest + offset, 0, SECTOR_SIZE * nr_sects);
> >> + kunmap_atomic(dest);
> >> +}
> >
> > Did you consider to call null_lookup_page() for __null_lookup_page() from
> > null_zero_sector()? It may simplify this function a bit.
> >
>
> I found this clear and easy than going over call chain when
> debugging.
Okay, then the patch looks good to me :)
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
--
Shin'ichiro Kawasaki