All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Damien Le Moal <damien.lemoal@wdc.com>
Cc: linux-scsi@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <Bart.VanAssche@wdc.com>
Subject: Re: [PATCH V4 10/16] block: mq-deadline: Add zoned block device data
Date: Sun, 24 Sep 2017 17:14:52 +0200	[thread overview]
Message-ID: <20170924151452.GG14806@lst.de> (raw)
In-Reply-To: <20170924070247.25560-11-damien.lemoal@wdc.com>

> +
> +	struct request_queue *q;

Do you really need the queue backpointer?  At least as far as this
patch is concerned we could just pass the queue on to
deadline_enable_zones_wlock and be fine.  And in general we should
always passing the q, as we can trivial go from queue to deadline_data
using queue->elevator->elevator_data.

> +static int deadline_zoned_init_queue(struct request_queue *q,
> +				     struct deadline_data *dd)
> +{
> +	if (!blk_queue_is_zoned(q) ||
> +	    !blk_queue_nr_zones(q)) {

Shouldn't !blk_queue_nr_zones(q) be enough?  If not both conditionals
could easily fit into the same line, and I'd be tempted to move them
to the caller and call deadline_enable_zones_wlock straight from there.

> @@ -341,6 +387,15 @@ static int dd_init_queue(struct request_queue *q, struct elevator_type *e)
>  	spin_lock_init(&dd->lock);
>  	INIT_LIST_HEAD(&dd->dispatch);
>  
> +	dd->q = q;
> +	spin_lock_init(&dd->zone_lock);
> +	ret = deadline_zoned_init_queue(q, dd);
> +	if (ret) {
> +		kfree(dd);
> +		kobject_put(&eq->kobj);
> +		return ret;
> +	}
> +
>  	q->elevator = eq;
>  	return 0;

This should probably grow goto based unwinding, e.g.

	int ret = -ENOMEM;

	...

	dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
	if (!dd)
		goto out_put_object;

	...

	if (blk_queue_nr_zones(q))) {
		ret = deadline_enable_zones_wlock(...);
		if (ret)
			goto out_free_dd;
	}
	
  	q->elevator = eq;
  	return 0;

out_free_dd:
	kfree(dd);
out_put_object
	kobject_put(&eq->kobj);
	return ret;
	

  reply	other threads:[~2017-09-24 15:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-24  7:02 [PATCH V4 00/16] scsi-mq support for ZBC disks Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 01/16] scsi: sd_zbc: Move ZBC declarations to scsi_proto.h Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 02/16] scsi: sd_zbc: Fix comments and indentation Damien Le Moal
2017-09-24 14:56   ` Christoph Hellwig
2017-09-25  9:14   ` Johannes Thumshirn
2017-09-25  9:14     ` Johannes Thumshirn
2017-09-24  7:02 ` [PATCH V4 03/16] scsi: sd_zbc: Rearrange code Damien Le Moal
2017-09-25  9:17   ` Johannes Thumshirn
2017-09-25  9:17     ` Johannes Thumshirn
2017-09-24  7:02 ` [PATCH V4 04/16] scsi: sd_zbc: Use well defined macros Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 05/16] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics() Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 06/16] block: Add zoned block device information to request queue Damien Le Moal
2017-09-24 14:59   ` Christoph Hellwig
2017-09-24 16:34     ` Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 07/16] scsi: sd_zbc: Initialize device request queue zoned data Damien Le Moal
2017-09-24 15:07   ` Christoph Hellwig
2017-09-24 16:44     ` Damien Le Moal
2017-09-25  9:36     ` Johannes Thumshirn
2017-09-25  9:36       ` Johannes Thumshirn
2017-09-24  7:02 ` [PATCH V4 08/16] scsi: sd_zbc: Limit zone write locking to sequential zones Damien Le Moal
2017-09-24 15:18   ` Christoph Hellwig
2017-09-24 16:51     ` Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 09/16] scsi: sd_zbc: Disable zone write locking with scsi-mq Damien Le Moal
2017-09-24 15:16   ` Christoph Hellwig
2017-09-24  7:02 ` [PATCH V4 10/16] block: mq-deadline: Add zoned block device data Damien Le Moal
2017-09-24 15:14   ` Christoph Hellwig [this message]
2017-09-24 16:48     ` Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 11/16] block: mq-deadline: Introduce zones_wlock attribute Damien Le Moal
2017-09-24 15:19   ` Christoph Hellwig
2017-09-24 16:52     ` Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 12/16] blokc: mq-deadline: Introduce dispatch helpers Damien Le Moal
2017-09-24 15:21   ` Christoph Hellwig
2017-09-24  7:02 ` [PATCH V4 13/16] block: mq-deadline: Introduce zone locking support Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 14/16] block: mq-deadline: Limit write dispatch for zoned block devices Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 15/16] block: do not set mq defaulte scheduler Damien Le Moal
2017-09-24  7:02 ` [PATCH V4 16/16] block: mq-deadline: Update documentation Damien Le Moal
2017-09-24 15:02 ` [PATCH V4 00/16] scsi-mq support for ZBC disks Christoph Hellwig
2017-09-24 16:36   ` Damien Le Moal

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=20170924151452.GG14806@lst.de \
    --to=hch@lst.de \
    --cc=Bart.VanAssche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@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.