Thread (13 messages) 13 messages, 2 authors, 2020-12-16

Re: [PATCH V7 4/6] nvmet: add ZBD over ZNS backend support

From: Damien Le Moal <hidden>
Date: 2020-12-15 23:15:38
Also in: linux-nvme

On 2020/12/16 8:06, Chaitanya Kulkarni wrote:
[...]
quoted
quoted
+void nvmet_bdev_execute_zone_mgmt_recv(struct nvmet_req *req)
+{
+	sector_t sect = nvmet_lba_to_sect(req->ns, req->cmd->zmr.slba);
+	u32 bufsize = (le32_to_cpu(req->cmd->zmr.numd) + 1) << 2;
+	struct nvmet_report_zone_data data = { .ns = req->ns };
+	unsigned int nr_zones;
+	int reported_zones;
+	u16 status;
+
+	nr_zones = (bufsize - sizeof(struct nvme_zone_report)) /
+			sizeof(struct nvme_zone_descriptor);
You could move this right before the vmalloc call since it is first used there.
There are only three lines between the this and the vmalloc, does that
really
going to make any difference ?
It makes the code far easier to read and understand at a quick glance without
having to go up and down reading to be reminded what nr_zones was. That also
would avoid changes to sneak in between these related statements, making things
even harder to read.

I personally like to think of code as a natural language text: if statements
related to each other are not grouped in a single paragraph, the text is really
hard to understand...


-- 
Damien Le Moal
Western Digital Research
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help