linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH v2 2/5] block: add support for REQ_OP_WRITE_ZEROES
Date: Thu, 17 Nov 2016 23:46:15 -0800	[thread overview]
Message-ID: <20161118074615.GA9077@infradead.org> (raw)
In-Reply-To: <1479421031-6060-1-git-send-email-ckulkarnilinux@gmail.com>

On Thu, Nov 17, 2016@02:17:11PM -0800, Chaitanya Kulkarni wrote:
> From: Chaitanya Kulkarni <chaitanya.kulkarni at hgst.com>
> 
> This adds a new block layer operation to zero out a range of
> LBAs. This allows to implement zeroing for devices that don't use
> either discard with a predictable zero pattern or WRITE SAME of zeroes.
> The prominent example of that is NVMe with the Write Zeroes command,
> but in the future this should also help with improving the way
> zeroing discards work.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at hgst.com>

I think you'll need to resend the whole series so that nvme can set
the maximum discard sectors value.

> @@ -575,9 +575,10 @@ static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio *bio)
>  	const int op = bio_op(bio);
>  
>  	/*
> -	 * If not a WRITE (or a discard), do nothing
> +	 * If not a WRITE (or a discard or write zeroes), do nothing
>  	 */
> -	if (!(op == REQ_OP_WRITE || op == REQ_OP_DISCARD))
> +	if (!(op == REQ_OP_WRITE || op == REQ_OP_DISCARD ||
> +				op == REQ_OP_WRITE_ZEROES))
>  		return false;

Jens: should we really throttle for discard or write zeroes here?
Those aren't really writeback driven..

> +static inline unsigned int bdev_write_zeroes(struct block_device *bdev)
> +{
> +	struct request_queue *q = bdev_get_queue(bdev);
> +
> +	if (q)
> +		return q->limits.max_write_zeroes_sectors;
> +
> +	return 0;

If this returns a sector value I'd name it bdev_write_zeroes_sectors.

Otherwise this looks great.

  parent reply	other threads:[~2016-11-18  7:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 22:17 [PATCH v2 2/5] block: add support for REQ_OP_WRITE_ZEROES Chaitanya Kulkarni
2016-11-18  2:22 ` Martin K. Petersen
2016-11-18  7:46 ` Christoph Hellwig [this message]
2016-11-18  8:25   ` chaitany kulkarni
2016-11-18 15:41 ` Keith Busch
  -- strict thread matches above, loose matches on Subject: below --
2016-11-30 20:28 [PATCH V2 1/5] block: add async variant of blkdev_issue_zeroout Chaitanya Kulkarni
2016-11-30 20:28 ` [PATCH V2 2/5] block: add support for REQ_OP_WRITE_ZEROES Chaitanya Kulkarni
2016-12-01 10:00   ` 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=20161118074615.GA9077@infradead.org \
    --to=hch@infradead.org \
    /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).