Skip to contentSkip to conversation

nvmet-tcp: simplify nvmet_process_resp_list

PATCH Applied Sagi Grimberg 2 participants 2 messages Jun 24, 2020 – Jun 26, 2020

Subsystems (2)
lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvmet-tcp: simplify nvmet_process_resp_list

We can make it shorter and simpler without some
redundant checks.

---
Christoph, your version looks so good that I want to take it to the target code as well.

 drivers/nvme/target/tcp.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/nvme/target/tcp.c +3 -9
index 38eb8797b3c0..dfcbc6522aba 100644
@@ -463,17 +463,11 @@ static void nvmet_setup_response_pdu(struct nvmet_tcp_cmd *cmd)
 static void nvmet_tcp_process_resp_list(struct nvmet_tcp_queue *queue)
 {
 	struct llist_node *node;
+	struct nvmet_tcp_cmd *cmd;
 
-	node = llist_del_all(&queue->resp_list);
-	if (!node)
-		return;
-
-	while (node) {
-		struct nvmet_tcp_cmd *cmd = llist_entry(node,
-					struct nvmet_tcp_cmd, lentry);
-
+	for (node = llist_del_all(&queue->resp_list); node; node = node->next) {
+		cmd = llist_entry(node, struct nvmet_tcp_cmd, lentry);
 		list_add(&cmd->entry, &queue->resp_send_list);
-		node = node->next;
 		queue->send_list_len++;
 	}
 }
Signature · 7 lines
2.25.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme