[PATCH] nvme: module parameter to disable pi checks

Tokunori Ikegami ikegami_to at yahoo.co.jp
Wed Oct 23 18:33:33 PDT 2024


Seems can be changed as below also.

tokunori at tokunori-desktop:~/linux$ git diff
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 5a7f7ce2bc49..59bb656a1d5e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1768,6 +1768,12 @@ static bool nvme_init_integrity(struct 
nvme_ns_head *head,
             !(head->features & NVME_NS_METADATA_SUPPORTED))
                 return nvme_ns_supports_pract(head);

+       bi->tuple_size = head->ms;
+       bi->pi_offset = info->pi_offset;
+
+       if (disable_pi)
+               return true;
+
         switch (head->pi_type) {
         case NVME_NS_DPS_PI_TYPE3:
                 switch (head->guard_type) {
@@ -1808,8 +1814,6 @@ static bool nvme_init_integrity(struct 
nvme_ns_head *head,
                 break;
         }

-       bi->tuple_size = head->ms;
-       bi->pi_offset = info->pi_offset;
         return true;
  }

On 2024/10/24 6:21, David Wei wrote:
> On 2024-10-23 13:21, Keith Busch wrote:
>> On Wed, Oct 23, 2024 at 08:01:43PM +0000, Chaitanya Kulkarni wrote:
>>> @@ -1774,9 +1773,9 @@ static bool nvme_init_integrity(struct
>>> nvme_ns_head *head,
>>>                   return nvme_ns_has_pi(head);
>>>
>>>           if (disable_pi)
>>> -               pi_type = 0;
>>> +               goto out;
>> I'm not against 'goto' in principle, but I try to restrict it to
>> unwinding an error, and this isn't an error. I know, personal preference
>> and all...
> Agreed. This is more unreadable and a modern compiler will most likely
> do the right thing anyway.
>
>



More information about the Linux-nvme mailing list