Re: [PATCH 6/7] nvme: also return I/O command effects from nvme_command_effects

Keith Busch
2022-12-13T17:53:20Z

On Tue, Dec 13, 2022 at 05:24:52PM +0100, Christoph Hellwig wrote:
> +static u32 nvme_known_nvm_effects(u8 opcode)
> +{
> + switch (opcode) {
> + case nvme_cmd_write:
> + case nvme_cmd_write_zeroes:
> + return NVME_CMD_EFFECTS_LBCC;
> + default:
> + return 0;
> + }
> +}

Also nvme_cmd_write_uncorr.

I think you'd need to know the namespace's command set to assume these
opcodes, though.

I was thinking instead of appending effects per-IO, we could always set
ns->head->effects even if the device doesn't support the log page, then
overwrite the log page's opcodes with known LBCC effects during
initialization. That way we don't need a per-io check. Does that sound
reasonable?