linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Jonmichael Hands <jm@chia.net>, Logan Gunthorpe <logang@deltatee.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
	Jes Sorensen <jes@trained-monkey.org>,
	Guoqing Jiang <guoqing.jiang@linux.dev>, Xiao Ni <xni@redhat.com>,
	Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>,
	Coly Li <colyli@suse.de>, Stephen Bates <sbates@raithlin.com>,
	Martin Oliveira <Martin.Oliveira@eideticom.com>,
	David Sloan <David.Sloan@eideticom.com>
Subject: Re: [PATCH mdadm v7 0/7] Write Zeroes option for Creating Arrays
Date: Thu, 2 Mar 2023 02:53:28 +0000	[thread overview]
Message-ID: <69b408c3-7357-ad43-e28d-dc25523a3682@nvidia.com> (raw)
In-Reply-To: <CABdXBAOAJAPmKC66WNnJSL5N72JZiM=AWBxhu_Yi1ojz3jn_Jg@mail.gmail.com>

On 3/1/2023 4:38 PM, Jonmichael Hands wrote:
> Hi Logan, Martin,
> just to be clear, the Linux implementation of write zeros is correctly 
> tagging DEAC to 1 during the NVMe write zeros command? This should be 
> very fast on drives that support write zeros with TRIM (most controllers 
> will have the same internal path as a TRIM updating the FTL to 
> deallocate the LBAs). Size of the command really shouldn't affect it 
> much, it is much more correlated with the firmware implementation of above.
> Thanks!
> JM
> Screenshot 2023-03-01 at 4.35.43 PM.png


Yes, it does please see [1].

-ck

1. NVMe DEC bit tagging in NVMe write-zeroes command setup.

static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
		struct request *req, struct nvme_command *cmnd)
{
	memset(cmnd, 0, sizeof(*cmnd));

	if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
		return nvme_setup_discard(ns, req, cmnd);

	cmnd->write_zeroes.opcode = nvme_cmd_write_zeroes;
	cmnd->write_zeroes.nsid = cpu_to_le32(ns->head->ns_id);
	cmnd->write_zeroes.slba =
		cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req)));
	cmnd->write_zeroes.length =
		cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);

	if (!(req->cmd_flags & REQ_NOUNMAP) && (ns->features & NVME_NS_DEAC))
		*cmnd->write_zeroes.control |= cpu_to_le16(NVME_WZ_DEAC);*

	if (nvme_ns_has_pi(ns)) {
		cmnd->write_zeroes.control |= cpu_to_le16(NVME_RW_PRINFO_PRACT);

		switch (ns->pi_type) {
		case NVME_NS_DPS_PI_TYPE1:
		case NVME_NS_DPS_PI_TYPE2:
			nvme_set_ref_tag(ns, cmnd, req);
			break;
		}
	}

	return BLK_STS_OK;
}

  parent reply	other threads:[~2023-03-02  2:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 20:41 [PATCH mdadm v7 0/7] Write Zeroes option for Creating Arrays Logan Gunthorpe
2023-03-01 20:41 ` [PATCH mdadm v7 1/7] Create: goto abort_locked instead of return 1 in error path Logan Gunthorpe
2023-03-01 20:41 ` [PATCH mdadm v7 2/7] Create: remove safe_mode_delay local variable Logan Gunthorpe
2023-03-01 20:41 ` [PATCH mdadm v7 3/7] Create: Factor out add_disks() helpers Logan Gunthorpe
2023-03-01 20:41 ` [PATCH mdadm v7 4/7] mdadm: Introduce pr_info() Logan Gunthorpe
2023-03-03 10:35   ` Paul Menzel
2023-03-01 20:41 ` [PATCH mdadm v7 5/7] mdadm: Add --write-zeros option for Create Logan Gunthorpe
2023-03-03  8:35   ` Coly Li
2023-03-01 20:41 ` [PATCH mdadm v7 6/7] tests/00raid5-zero: Introduce test to exercise --write-zeros Logan Gunthorpe
2023-03-01 20:41 ` [PATCH mdadm v7 7/7] manpage: Add --write-zeroes option to manpage Logan Gunthorpe
     [not found] ` <CABdXBAOAJAPmKC66WNnJSL5N72JZiM=AWBxhu_Yi1ojz3jn_Jg@mail.gmail.com>
2023-03-02  2:53   ` Chaitanya Kulkarni [this message]
2023-03-02  2:55 ` [PATCH mdadm v7 0/7] Write Zeroes option for Creating Arrays Chaitanya Kulkarni
2023-03-02 16:56 ` Martin K. Petersen
2023-03-13 14:08 ` Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69b408c3-7357-ad43-e28d-dc25523a3682@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=David.Sloan@eideticom.com \
    --cc=Martin.Oliveira@eideticom.com \
    --cc=colyli@suse.de \
    --cc=guoqing.jiang@linux.dev \
    --cc=jes@trained-monkey.org \
    --cc=jm@chia.net \
    --cc=linux-raid@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=mariusz.tkaczyk@linux.intel.com \
    --cc=sbates@raithlin.com \
    --cc=xni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).