From: Christoph Hellwig <hch@lst.de> To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 12/12] nvme: export the atomic write limit Date: Tue, 28 Feb 2017 06:57:37 -0800 [thread overview] Message-ID: <20170228145737.19016-13-hch@lst.de> (raw) In-Reply-To: <20170228145737.19016-1-hch@lst.de> Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/nvme/host/core.c | 10 ++++++++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8a3c3e32a704..e86d07589f18 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -926,6 +926,15 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) ns->pi_type = pi_type; blk_queue_logical_block_size(ns->queue, bs); + /* + * Advertisze the maximum atomic write size. Don't bother with the + * per-namespace values due to their alignment constraints. + */ + if (ns->ctrl->awupf > 1) { + blk_queue_max_atomic_write_sectors(ns->queue, + (ns->ctrl->awupf + 1) << (ns->lba_shift - 9)); + } + if (ns->ms && !blk_get_integrity(disk) && !ns->ext) nvme_init_integrity(ns); if (ns->ms && !(ns->ms == 8 && ns->pi_type) && !blk_get_integrity(disk)) @@ -1232,6 +1241,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->vid = le16_to_cpu(id->vid); ctrl->oncs = le16_to_cpup(&id->oncs); + ctrl->awupf = le16_to_cpu(id->awupf); atomic_set(&ctrl->abort_limit, id->acl + 1); ctrl->vwc = id->vwc; ctrl->cntlid = le16_to_cpup(&id->cntlid); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index aead6d08ed2c..020ffd6f7863 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -143,6 +143,7 @@ struct nvme_ctrl { u32 vs; u32 sgls; u16 kas; + u16 awupf; unsigned int kato; bool subsystem; unsigned long quirks; -- 2.11.0
next prev parent reply other threads:[~2017-02-28 14:57 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-28 14:57 [RFC] failure atomic writes for file systems and block devices Christoph Hellwig 2017-02-28 14:57 ` [PATCH 01/12] uapi/fs: add O_ATOMIC to the open flags Christoph Hellwig 2017-02-28 14:57 ` [PATCH 02/12] iomap: pass IOMAP_* flags to actors Christoph Hellwig 2017-02-28 14:57 ` [PATCH 03/12] iomap: add a IOMAP_ATOMIC flag Christoph Hellwig 2017-02-28 14:57 ` [PATCH 04/12] fs: add a BH_Atomic flag Christoph Hellwig 2017-02-28 14:57 ` [PATCH 05/12] fs: add a F_IOINFO fcntl Christoph Hellwig 2017-02-28 16:51 ` Darrick J. Wong 2017-03-01 15:11 ` Christoph Hellwig 2017-02-28 14:57 ` [PATCH 06/12] xfs: cleanup is_reflink checks Christoph Hellwig 2017-02-28 14:57 ` [PATCH 07/12] xfs: implement failure-atomic writes Christoph Hellwig 2017-02-28 23:09 ` Darrick J. Wong 2017-03-01 15:17 ` Christoph Hellwig 2017-02-28 14:57 ` [PATCH 08/12] xfs: implement the F_IOINFO fcntl Christoph Hellwig 2017-02-28 14:57 ` [PATCH 09/12] block: advertize max atomic write limit Christoph Hellwig 2017-02-28 14:57 ` [PATCH 10/12] block_dev: set REQ_NOMERGE for O_ATOMIC writes Christoph Hellwig 2017-02-28 14:57 ` [PATCH 11/12] block_dev: implement the F_IOINFO fcntl Christoph Hellwig 2017-02-28 14:57 ` Christoph Hellwig [this message] 2017-02-28 20:48 ` [RFC] failure atomic writes for file systems and block devices Chris Mason 2017-02-28 20:48 ` Chris Mason 2017-03-01 15:07 ` Christoph Hellwig 2017-02-28 23:22 ` Darrick J. Wong 2017-03-01 15:09 ` Christoph Hellwig 2017-03-01 11:21 ` Amir Goldstein 2017-03-01 15:07 ` Christoph Hellwig 2017-03-01 15:07 ` Christoph Hellwig
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=20170228145737.19016-13-hch@lst.de \ --to=hch@lst.de \ --cc=linux-block@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-xfs@vger.kernel.org \ --subject='Re: [PATCH 12/12] nvme: export the atomic write limit' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.