Messages in this thread | | | From | Chaitanya Kulkarni <> | Subject | Re: [PATCH V4 1/8] null_blk: allow REQ_OP_WRITE_ZEROES | Date | Wed, 30 Nov 2022 23:29:00 +0000 |
| |
>> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com> > > 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.
>> + >> static struct nullb_page *null_radix_tree_insert(struct nullb *nullb, u64 idx,
[...]
>> >> +static void null_config_write_zeroes(struct nullb *nullb) >> +{ >> + if (!nullb->dev->write_zeroes) >> + return; >> + blk_queue_max_write_zeroes_sectors(nullb->q, UINT_MAX >> 9); > > Just comment: this value UINT_MAX >> 9 sounds a bit weird, but probably ok. This > value was introduced by commit 306eb6b4ad4f ("nullb: support discard") to call > blk_queue_max_discard_sectors(). I guess you chose the same value for write > zeroes. >
Yes indeed, plz have a look end patches to allow user to set this value.
-ck
| |