All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	adilger@dilger.ca, hch@infradead.org, martin.petersen@oracle.com
Subject: Re: [PATCH 11/11] nvme: add support for streams and directives
Date: Fri, 16 Jun 2017 11:09:42 -0700	[thread overview]
Message-ID: <20170616180942.GD27996@infradead.org> (raw)
In-Reply-To: <1497633883-21230-12-git-send-email-axboe@kernel.dk>

> We default to allocating 4 streams per name space, but it is
> configurable with the 'streams_per_ns' module option.

What's your strategy for multi-namespace devices?  You won't even get
your 4 streams for a handful namespaces with devices today or the near
future.  Should we cut down the number of streams per namespace?  Or
just not set aside streams for namespace exclusive use?  Or so far
you simply don't care about the multi-ns case?

> +static void nvme_write_hint_work(struct work_struct *work)
> +{
	struct nvme_ns *ns = container_of(work, struct nvme_ns, write_hint_work);

nasty 81 character line :)

> +	nr_streams = streams_per_ns;
> +	if (nr_streams > ns->ctrl->nssa)
> +		nr_streams = ns->ctrl->nssa;

min() ?

> +static enum rw_hint nvme_get_write_stream(struct nvme_ns *ns,
> +					   struct request *req)
> +{
> +	enum rw_hint streamid = req->cmd_flags & REQ_WRITE_LIFE_MASK;
> +
> +	if (req_op(req) != REQ_OP_WRITE ||
> +	    !(ns->ctrl->oacs & NVME_CTRL_OACS_DIRECTIVES))
> +		return WRITE_LIFE_NONE;

How about moving this to the caller?

> +	/*
> +	 * If we support streams and this request is a write with a valid
> +	 * hint, then flag it as such. If we haven't allocated streams on
> +	 * this ns before, do so lazily.
> +	 */
> +	stream = nvme_get_write_stream(ns, req);
> +	if (stream != WRITE_LIFE_NONE) {
> +		if (ns->nr_streams) {
> +			control |= NVME_RW_DTYPE_STREAMS;
> +			dsmgmt |= (stream << 16);
> +		} else
> +			nvme_configure_streams(ns);
> +	}

.. and instead pass control and dsmgmt to nvme_get_write_stream by
reference to isolate the functionality there.  And move the
nvme_configure_streams call into it as well.


Last but not least this will need some tweaks in the deallocate
code due to:

"If the host issues a Dataset Management command to deallocate logical
 blocks that are associated with a stream, it should specify a starting
 LBA and length that is aligned to and in multiples of the Stream
 Granularity Size"

  reply	other threads:[~2017-06-16 18:09 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 17:24 [PATCHSET v6] Add support for write life time hints Jens Axboe
2017-06-16 17:24 ` [PATCH 01/11] fs: add support for an inode to carry write hint related data Jens Axboe
2017-06-16 17:24 ` [PATCH 02/11] block: add support for write hints in a bio Jens Axboe
2017-06-16 17:24 ` [PATCH 03/11] blk-mq: expose stream write hints through debugfs Jens Axboe
2017-06-16 17:24 ` [PATCH 04/11] fs: add support for allowing applications to pass in write life time hints Jens Axboe
2017-06-16 17:24 ` [PATCH 05/11] fs: add fcntl() interface for setting/getting " Jens Axboe
2017-06-16 17:24 ` [PATCH 06/11] fs: add O_DIRECT support for sending down " Jens Axboe
2017-06-16 17:24 ` [PATCH 07/11] fs: add support for buffered writeback to pass down write hints Jens Axboe
2017-06-16 17:24 ` [PATCH 08/11] ext4: add support for passing in write hints for buffered writes Jens Axboe
2017-06-16 17:24 ` [PATCH 09/11] xfs: " Jens Axboe
2017-06-16 17:24 ` [PATCH 10/11] btrfs: " Jens Axboe
2017-06-16 17:24 ` [PATCH 11/11] nvme: add support for streams and directives Jens Axboe
2017-06-16 18:09   ` Christoph Hellwig [this message]
2017-06-16 19:41     ` Jens Axboe
2017-06-16 19:56       ` Jens Axboe
2017-06-17 12:21       ` Christoph Hellwig
2017-06-17 14:20         ` Jens Axboe
2017-06-17 15:03           ` Christoph Hellwig
2017-06-17 15:11             ` Jens Axboe
2017-06-17 15:43               ` Jens Axboe
2017-06-19  6:25               ` Christoph Hellwig
2017-06-19 14:31                 ` Jens Axboe
2017-06-19 14:53                   ` Jens Axboe
2017-06-19 18:53                     ` Christoph Hellwig
2017-06-19 19:03                       ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2017-06-17 19:59 [PATCHSET v7] Add support for write life time hints Jens Axboe
2017-06-17 19:59 ` [PATCH 11/11] nvme: add support for streams and directives Jens Axboe
2017-06-19  6:35   ` Christoph Hellwig
2017-06-19 15:04     ` Jens Axboe
2017-06-15  3:45 [PATCHSET v4] Add support for write life time hints Jens Axboe
2017-06-15  3:45 ` [PATCH 11/11] nvme: add support for streams and directives Jens Axboe
2017-06-14 19:05 [PATCHSET v3] Add support for write life time hints Jens Axboe
2017-06-14 19:05 ` [PATCH 11/11] nvme: add support for streams and directives Jens Axboe
2017-06-14 20:32   ` Christoph Hellwig
2017-06-14 20:43     ` Jens Axboe
2017-06-13 17:15 [PATCH 0/11] Add support for write life time hints Jens Axboe
2017-06-13 17:15 ` [PATCH 11/11] nvme: add support for streams and directives Jens Axboe
2017-06-13 19:47   ` Andreas Dilger
2017-06-13 20:25     ` Jens Axboe
2017-06-13 21:12   ` Andreas Dilger
2017-06-13 21:18     ` Jens Axboe

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=20170616180942.GD27996@infradead.org \
    --to=hch@infradead.org \
    --cc=adilger@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin.petersen@oracle.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 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.