lkml.org 
[lkml]   [2021]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] nvme: update keep alive interval when kato is modified
On Tue, Aug 24, 2021 at 01:41:44PM -0700, Sagi Grimberg wrote:
>> +{
>> + /*
>> + * Keep alive commands interval on the host should be updated
>> + * when KATO is modified by Set Features commands.
>> + */
>> + if (cmd->opcode == nvme_admin_set_features &&
>> + (cmd->cdw10 & 0xFF) == NVME_FEAT_KATO) {
>> + /* ms -> s */
>
> no need for this comment.
>
>> + unsigned int new_kato = DIV_ROUND_UP(cmd->cdw11, 1000);
>> +
>> + nvme_update_keep_alive(ctrl, new_kato);
>
> I think you can now inline nvme_update_keep_alive here, no need to keep
> it in a function.

Actually, іf thinking ahead I think one helper per fixup would be really
useful to keep the code organized. But the DIV_ROUND_UP should move into
nvme_update_keep_alive to keep it self-contained.
We can then restructure the caller a bit to make it easier to expand:

switch (cmd->opcode) {
case nvme_admin_set_features:
switch (cmd->cdw10 & 0xff) {
case NVME_FEAT_KATO:
nvme_update_keep_alive(ctrl, cmd);
break;
}
}

\
 
 \ /
  Last update: 2021-08-25 11:05    [W:0.062 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site