New warning in nvme_setup_discard
Oleksandr Natalenko
oleksandr at natalenko.name
Thu Jul 15 22:53:28 PDT 2021
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)
More information about the Linux-nvme
mailing list