Re: [PATCH 3/7] nvmet: allow async passthrough of commands that change logical block contents

Christoph Hellwig
2022-12-14T07:59:46Z

On Wed, Dec 14, 2022 at 04:52:47AM +0000, Chaitanya Kulkarni wrote:
> > - effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
> > - if (req->p.use_workqueue || effects) {
> > + if (nvme_command_effects(ctrl, ns, req->cmd->common.opcode) &
> > + ~NVME_CMD_EFFECTS_LBCC)
> > + req->p.use_workqueue = true;
> > +
>
> How about this instead of calling function in if which is much cleaner
> unless it has a bug ?
>
> effect = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
>
> req->p.use_workqueue = effetcs & ~NVME_CMD_EFFECTS_LBCC;

This would clear the bit if it is already set. The being said
I'm not a fan of how the use_workqueue flag is set, and I now have
an idea on how to remove it entirely.