All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Pankaj Raghav <p.raghav@samsung.com>
Cc: axboe@kernel.dk, bvanassche@acm.org, gost.dev@samsung.com,
	damien.lemoal@opensource.wdc.com, snitzer@kernel.org,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-block@vger.kernel.org, kernel@pankajraghav.com,
	dm-devel@redhat.com,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	hch@lst.de, Luis Chamberlain <mcgrof@kernel.org>
Subject: Re: [dm-devel] [PATCH 6/7] dm-zone: use generic helpers to calculate offset from zone start
Date: Tue, 10 Jan 2023 07:57:38 +0100	[thread overview]
Message-ID: <20230110065738.GE10289@lst.de> (raw)
In-Reply-To: <20230106083317.93938-7-p.raghav@samsung.com>

On Fri, Jan 06, 2023 at 09:33:16AM +0100, Pankaj Raghav wrote:
> Use the bdev_offset_from_zone_start() helper function to calculate
> the offset from zone start instead of open coding.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
> Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Reviewed-by: Mike Snitzer <snitzer@kernel.org>
> ---
>  drivers/md/dm-zone.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
> index 3dafc0e8b7a9..ac6fc1293d41 100644
> --- a/drivers/md/dm-zone.c
> +++ b/drivers/md/dm-zone.c
> @@ -390,7 +390,8 @@ static bool dm_zone_map_bio_begin(struct mapped_device *md,
>  	case REQ_OP_WRITE_ZEROES:
>  	case REQ_OP_WRITE:
>  		/* Writes must be aligned to the zone write pointer */
> -		if ((clone->bi_iter.bi_sector & (zsectors - 1)) != zwp_offset)
> +		if (bdev_offset_from_zone_start(md->disk->part0,
> +						clone->bi_iter.bi_sector) != zwp_offset)

I can't see how this actually cleans antyhing up, while it does add an
overly long line.

>  		if (clone->bi_status == BLK_STS_OK &&
>  		    bio_op(clone) == REQ_OP_ZONE_APPEND) {
>  			orig_bio->bi_iter.bi_sector +=
> -				clone->bi_iter.bi_sector & mask;
> +				bdev_offset_from_zone_start(disk->part0, clone->bi_iter.bi_sector);

Same here.

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Pankaj Raghav <p.raghav@samsung.com>
Cc: axboe@kernel.dk, kernel@pankajraghav.com,
	linux-kernel@vger.kernel.org, hare@suse.de, bvanassche@acm.org,
	snitzer@kernel.org, dm-devel@redhat.com,
	damien.lemoal@opensource.wdc.com, linux-nvme@lists.infradead.org,
	hch@lst.de, linux-block@vger.kernel.org, gost.dev@samsung.com,
	Luis Chamberlain <mcgrof@kernel.org>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH 6/7] dm-zone: use generic helpers to calculate offset from zone start
Date: Tue, 10 Jan 2023 07:57:38 +0100	[thread overview]
Message-ID: <20230110065738.GE10289@lst.de> (raw)
In-Reply-To: <20230106083317.93938-7-p.raghav@samsung.com>

On Fri, Jan 06, 2023 at 09:33:16AM +0100, Pankaj Raghav wrote:
> Use the bdev_offset_from_zone_start() helper function to calculate
> the offset from zone start instead of open coding.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
> Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Reviewed-by: Mike Snitzer <snitzer@kernel.org>
> ---
>  drivers/md/dm-zone.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
> index 3dafc0e8b7a9..ac6fc1293d41 100644
> --- a/drivers/md/dm-zone.c
> +++ b/drivers/md/dm-zone.c
> @@ -390,7 +390,8 @@ static bool dm_zone_map_bio_begin(struct mapped_device *md,
>  	case REQ_OP_WRITE_ZEROES:
>  	case REQ_OP_WRITE:
>  		/* Writes must be aligned to the zone write pointer */
> -		if ((clone->bi_iter.bi_sector & (zsectors - 1)) != zwp_offset)
> +		if (bdev_offset_from_zone_start(md->disk->part0,
> +						clone->bi_iter.bi_sector) != zwp_offset)

I can't see how this actually cleans antyhing up, while it does add an
overly long line.

>  		if (clone->bi_status == BLK_STS_OK &&
>  		    bio_op(clone) == REQ_OP_ZONE_APPEND) {
>  			orig_bio->bi_iter.bi_sector +=
> -				clone->bi_iter.bi_sector & mask;
> +				bdev_offset_from_zone_start(disk->part0, clone->bi_iter.bi_sector);

Same here.

  reply	other threads:[~2023-01-10  6:57 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230106083318eucas1p1a2ab71a95ab2906b4651538c63a94ae2@eucas1p1.samsung.com>
2023-01-06  8:33 ` [dm-devel] [PATCH 0/7] block zoned cleanups Pankaj Raghav
2023-01-06  8:33   ` Pankaj Raghav
2023-01-06  8:33   ` [dm-devel] [PATCH 1/7] block: remove superfluous check for request queue in bdev_is_zoned Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-06 11:01     ` [dm-devel] " Damien Le Moal
2023-01-06 11:01       ` Damien Le Moal
2023-01-06 22:34     ` [dm-devel] " Bart Van Assche
2023-01-06 22:34       ` Bart Van Assche
2023-01-09  7:41     ` [dm-devel] " Chaitanya Kulkarni
2023-01-09  7:41       ` Chaitanya Kulkarni
2023-01-09  8:55     ` [dm-devel] " Johannes Thumshirn
2023-01-09  8:55       ` Johannes Thumshirn
2023-01-10  6:52     ` [dm-devel] " Christoph Hellwig
2023-01-10  6:52       ` Christoph Hellwig
2023-01-06  8:33   ` [dm-devel] [PATCH 2/7] block: add a new helper bdev_{is_zone_start, offset_from_zone_start} Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-06 11:00     ` [dm-devel] " Damien Le Moal
2023-01-06 11:00       ` Damien Le Moal
2023-01-06 22:36     ` [dm-devel] " Bart Van Assche
2023-01-06 22:36       ` Bart Van Assche
2023-01-09  7:42     ` [dm-devel] " Chaitanya Kulkarni
2023-01-09  7:42       ` Chaitanya Kulkarni
2023-01-10  6:54     ` [dm-devel] " Christoph Hellwig
2023-01-10  6:54       ` Christoph Hellwig
2023-01-06  8:33   ` [dm-devel] [PATCH 3/7] nvmet: introduce bdev_zone_no helper Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-06 11:02     ` [dm-devel] " Damien Le Moal
2023-01-06 11:02       ` Damien Le Moal
2023-01-06 22:39     ` [dm-devel] " Bart Van Assche
2023-01-06 22:39       ` Bart Van Assche
2023-01-09  7:42     ` [dm-devel] " Chaitanya Kulkarni
2023-01-09  7:42       ` Chaitanya Kulkarni
2023-01-10  6:55     ` [dm-devel] " Christoph Hellwig
2023-01-10  6:55       ` Christoph Hellwig
2023-01-06  8:33   ` [dm-devel] [PATCH 4/7] zonefs: use bdev_zone_no helper to calculate the zone index Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-06 11:05     ` [dm-devel] " Damien Le Moal
2023-01-06 11:05       ` Damien Le Moal
2023-01-06  8:33   ` [dm-devel] [PATCH 5/7] dm-zoned: ensure only power of 2 zone sizes are allowed Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-10  6:56     ` [dm-devel] " Christoph Hellwig
2023-01-10  6:56       ` Christoph Hellwig
2023-01-10  8:39       ` [dm-devel] " Pankaj Raghav
2023-01-10  8:39         ` Pankaj Raghav
2023-01-06  8:33   ` [dm-devel] [PATCH 6/7] dm-zone: use generic helpers to calculate offset from zone start Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-10  6:57     ` Christoph Hellwig [this message]
2023-01-10  6:57       ` Christoph Hellwig
2023-01-10  9:06       ` [dm-devel] " Pankaj Raghav
2023-01-10  9:06         ` Pankaj Raghav
2023-01-06  8:33   ` [dm-devel] [PATCH 7/7] dm: call dm_zone_endio after the target endio callback for zoned devices Pankaj Raghav
2023-01-06  8:33     ` Pankaj Raghav
2023-01-10  6:58     ` [dm-devel] " Christoph Hellwig
2023-01-10  6:58       ` Christoph Hellwig
2023-01-10  9:07       ` [dm-devel] " Pankaj Raghav
2023-01-10  9:07         ` Pankaj Raghav
2023-01-10  9:43         ` [dm-devel] " Christoph Hellwig
2023-01-10  9:43           ` 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=20230110065738.GE10289@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=dm-devel@redhat.com \
    --cc=gost.dev@samsung.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=kernel@pankajraghav.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=snitzer@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.