Re: [RFC PATCH 3/8] nvme: add support for the Verify command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 03, 2021 at 11:46:29PM -0700, Chaitanya Kulkarni wrote:
> +static inline blk_status_t nvme_setup_verify(struct nvme_ns *ns,
> +		struct request *req, struct nvme_command *cmnd)
> +{

Due to recent driver changes, you need a "memset(cmnd, 0, sizeof(*cmnd))"
prior to setting up the rest of the command, or you need to set each
command dword individually.

> +	cmnd->verify.opcode = nvme_cmd_verify;
> +	cmnd->verify.nsid = cpu_to_le32(ns->head->ns_id);
> +	cmnd->verify.slba =
> +		cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req)));
> +	cmnd->verify.length =
> +		cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
> +	cmnd->verify.control = 0;
> +	return BLK_STS_OK;
> +}

> +static void nvme_config_verify(struct gendisk *disk, struct nvme_ns *ns)
> +{
> +	u64 max_blocks;
> +
> +	if (!(ns->ctrl->oncs & NVME_CTRL_ONCS_VERIFY))
> +		return;
> +
> +	if (ns->ctrl->max_hw_sectors == UINT_MAX)
> +		max_blocks = (u64)USHRT_MAX + 1;
> +	else
> +		max_blocks = ns->ctrl->max_hw_sectors + 1;

If supported by the controller, this maximum is defined in the non-mdts
command limits in NVM command set specific Identify Controller VSL field.

> +
> +	/* keep same as discard */
> +	if (blk_queue_flag_test_and_set(QUEUE_FLAG_VERIFY, disk->queue))
> +		return;
> +
> +	blk_queue_max_verify_sectors(disk->queue,
> +				     nvme_lba_to_sect(ns, max_blocks));
> +
> +}



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux