linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Damien Le Moal <Damien.LeMoal@wdc.com>,
	"dm-devel@redhat.com" <dm-devel@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v3 01/11] block: improve handling of all zones reset operation
Date: Mon, 24 May 2021 00:30:26 +0000	[thread overview]
Message-ID: <BYAPR04MB49655F14C3C880B508D4B90886269@BYAPR04MB4965.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210521030119.1209035-2-damien.lemoal@wdc.com

On 5/20/21 20:01, Damien Le Moal wrote:
> +static int blkdev_zone_reset_all_emulated(struct block_device *bdev,
> +					  gfp_t gfp_mask)
> +{
> +	struct request_queue *q = bdev_get_queue(bdev);
> +	sector_t capacity = get_capacity(bdev->bd_disk);
> +	sector_t zone_sectors = blk_queue_zone_sectors(q);
> +	unsigned long *need_reset;
> +	struct bio *bio = NULL;
> +	sector_t sector;
> +	int ret;
> +
> +	need_reset = blk_alloc_zone_bitmap(q->node, q->nr_zones);
> +	if (!need_reset)
> +		return -ENOMEM;
> +
> +	ret = bdev->bd_disk->fops->report_zones(bdev->bd_disk, 0,
> +				q->nr_zones, blk_zone_need_reset_cb,
> +				need_reset);
> +	if (ret < 0)
> +		goto out_free_need_reset;
> +
> +	ret = 0;
> +	while (sector < capacity) {

Garbage value of sector variable used in above comparison ?
If so consider initializing at the time of declaration.

> +		if (!test_bit(blk_queue_zone_no(q, sector), need_reset)) {
> +			sector += zone_sectors;
> +			continue;
> +		}
> +		bio = blk_next_bio(bio, 0, gfp_mask);
> +		bio_set_dev(bio, bdev);
> +		bio->bi_opf = REQ_OP_ZONE_RESET | REQ_SYNC;
> +		bio->bi_iter.bi_sector = sector;
> +		sector += zone_sectors;
> +
> +		/* This may take a while, so be nice to others */
> +		cond_resched();
> +	}
> +
> +	if (bio) {
> +		ret = submit_bio_wait(bio);
> +		bio_put(bio);
> +	}
> +
> +out_free_need_reset:
> +	kfree(need_reset);
> +	return ret;
> +}


  parent reply	other threads:[~2021-05-24  0:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  3:01 [PATCH v3 00/11] dm: Improve zoned block device support Damien Le Moal
2021-05-21  3:01 ` [PATCH v3 01/11] block: improve handling of all zones reset operation Damien Le Moal
2021-05-21  5:13   ` Johannes Thumshirn
2021-05-24  0:30   ` Chaitanya Kulkarni [this message]
2021-05-21  3:01 ` [PATCH v3 02/11] block: introduce bio zone helpers Damien Le Moal
2021-05-21  5:06   ` Johannes Thumshirn
2021-05-24  2:24   ` Chaitanya Kulkarni
2021-05-21  3:01 ` [PATCH v3 03/11] block: introduce BIO_ZONE_WRITE_LOCKED bio flag Damien Le Moal
2021-05-24  2:24   ` Chaitanya Kulkarni
2021-05-21  3:01 ` [PATCH v3 04/11] dm: Fix dm_accept_partial_bio() Damien Le Moal
2021-05-21  3:01 ` [PATCH v3 05/11] dm: cleanup device_area_is_invalid() Damien Le Moal
2021-05-21  3:01 ` [PATCH v3 06/11] dm: move zone related code to dm-zone.c Damien Le Moal
2021-05-21  3:01 ` [PATCH v3 07/11] dm: Introduce dm_report_zones() Damien Le Moal
2021-05-21  3:01 ` [PATCH v3 08/11] dm: Forbid requeue of writes to zones Damien Le Moal
2021-05-21  5:10   ` Johannes Thumshirn
2021-05-21  3:01 ` [PATCH v3 09/11] dm: rearrange core declarations Damien Le Moal
2021-05-21  5:09   ` Johannes Thumshirn
2021-05-21  3:01 ` [PATCH v3 10/11] dm: introduce zone append emulation Damien Le Moal
2021-05-21  3:01 ` [PATCH v3 11/11] dm crypt: Fix zoned block device support Damien Le Moal
2021-05-21  5:07   ` Johannes Thumshirn

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=BYAPR04MB49655F14C3C880B508D4B90886269@BYAPR04MB4965.namprd04.prod.outlook.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=snitzer@redhat.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 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).