All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: linux-block@vger.kernel.org, hch@lst.de, bvanassche@acm.org,
	axboe@kernel.dk
Subject: Re: [PATCH 4/5] null_blk: create a helper for zoned devices
Date: Mon, 1 Jul 2019 08:30:22 +0200	[thread overview]
Message-ID: <20190701063022.GH20073@lst.de> (raw)
In-Reply-To: <20190629050442.8459-5-chaitanya.kulkarni@wdc.com>

On Fri, Jun 28, 2019 at 10:04:41PM -0700, Chaitanya Kulkarni wrote:
> This patch creates a helper function for handling zoned block device
> operations.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/block/null_blk_main.c | 50 +++++++++++++++++++++--------------
>  1 file changed, 30 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
> index e75d187c7393..824392681a28 100644
> --- a/drivers/block/null_blk_main.c
> +++ b/drivers/block/null_blk_main.c
> @@ -1214,6 +1214,34 @@ static inline int nullb_handle_memory_backed(struct nullb_cmd *cmd)
>  	return null_handle_rq(cmd);
>  }
>  
> +static inline void nullb_handle_zoned(struct nullb_cmd *cmd)
> +{
> +	unsigned int nr_sectors;
> +	sector_t sector;
> +	req_opf op;
> +
> +	if (cmd->nq->dev->queue_mode == NULL_Q_BIO) {
> +		op = bio_op(cmd->bio);
> +		sector = cmd->bio->bi_iter.bi_sector;
> +		nr_sectors = cmd->bio->bi_iter.bi_size >> 9;
> +	} else {
> +		op = req_op(cmd->rq);
> +		sector = blk_rq_pos(cmd->rq);
> +		nr_sectors = blk_rq_sectors(cmd->rq);
> +	}

And this checks for the same info as the previous one.
You probably just want to pass sector and nr_sectors as an argument
to null_handle_cmd early in the series.

> +	switch ((op)) {

No need for the double braces.

  reply	other threads:[~2019-07-01  6:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-29  5:04 [PATCH 0/5] null_blk: simplify null_handle_cmd() Chaitanya Kulkarni
2019-06-29  5:04 ` [PATCH 1/5] null_blk: create a helper for throttling Chaitanya Kulkarni
2019-07-01  6:22   ` Christoph Hellwig
2019-06-29  5:04 ` [PATCH 2/5] null_blk: create a helper for badblocks Chaitanya Kulkarni
2019-07-01  6:29   ` Christoph Hellwig
2019-06-29  5:04 ` [PATCH 3/5] null_blk: create a helper for mem-backed ops Chaitanya Kulkarni
2019-06-29  5:04 ` [PATCH 4/5] null_blk: create a helper for zoned devices Chaitanya Kulkarni
2019-07-01  6:30   ` Christoph Hellwig [this message]
2019-06-29  5:04 ` [PATCH 5/5] null_blk: create a helper for req completion Chaitanya Kulkarni
2019-07-01  6:31   ` 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=20190701063022.GH20073@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=linux-block@vger.kernel.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 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.