Re: New warning in nvme_setup_discard
From: Oleksandr Natalenko
Date: Fri Jul 16 2021 - 01:53:42 EST
Hello.
On pátek 16. července 2021 4:16:18 CEST Ming Lei wrote:
> > 850 if (WARN_ON_ONCE(n != segments)) {
>
> What is 'n' and 'segments'?
So, I used this change to check that:
```
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 66973bb56305..0a64f2f77daf 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -847,7 +847,8 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns,
struct request *req,
n++;
}
- if (WARN_ON_ONCE(n != segments)) {
+ if (unlikely(n != segments)) {
+ pr_warn("nvme_setup_discard: n != segments (%u != %u)\n", n,
segments);
if (virt_to_page(range) == ns->ctrl->discard_page)
clear_bit_unlock(0, &ns->ctrl->discard_page_busy);
else
```
and the result is:
```
nvme_setup_discard: n != segments (3 != 2)
nvme_setup_discard: n != segments (12 != 11)
```
(those are from different boots)
Thanks.
--
Oleksandr Natalenko (post-factum)