All of lore.kernel.org
 help / color / mirror / Atom feed
From: Naohiro Aota <naohiro.aota@wdc.com>
To: linux-btrfs@vger.kernel.org, dsterba@suse.com
Cc: hare@suse.com, linux-fsdevel@vger.kernel.org,
	Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH 2/3] btrfs: zoned: add missing type conversion
Date: Fri, 26 Feb 2021 18:34:37 +0900	[thread overview]
Message-ID: <e6519c3681550015fbeeb0565f707d72705a39f1.1614331998.git.naohiro.aota@wdc.com> (raw)
In-Reply-To: <cover.1614331998.git.naohiro.aota@wdc.com>

We need to cast zone_sectors from u32 to u64 when setting the zone_size, or
it set the zone size = 0 when the size >= 4G.

Fixes: 5b316468983d ("btrfs: get zone information of zoned block devices")
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 40cb99854844..4de82da39c10 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -312,7 +312,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
 	nr_sectors = bdev_nr_sectors(bdev);
 	/* Check if it's power of 2 (see is_power_of_2) */
 	ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0);
-	zone_info->zone_size = zone_sectors << SECTOR_SHIFT;
+	zone_info->zone_size = (u64)zone_sectors << SECTOR_SHIFT;
 	zone_info->zone_size_shift = ilog2(zone_info->zone_size);
 	zone_info->max_zone_append_size =
 		(u64)queue_max_zone_append_sectors(queue) << SECTOR_SHIFT;
-- 
2.30.1


  parent reply	other threads:[~2021-02-26  9:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  9:34 [PATCH 0/3] Fixes for zoned mode Naohiro Aota
2021-02-26  9:34 ` [PATCH 1/3] btrfs: zoned: move superblock logging zone location Naohiro Aota
2021-02-26 19:11   ` David Sterba
2021-03-01  4:55     ` Naohiro Aota
2021-03-01  5:17       ` Damien Le Moal
2021-03-01 13:25         ` David Sterba
2021-02-26  9:34 ` Naohiro Aota [this message]
2021-02-26 19:18   ` [PATCH 2/3] btrfs: zoned: add missing type conversion David Sterba
2021-03-01  4:57     ` Naohiro Aota
2021-02-26  9:34 ` [PATCH 3/3] btrfs: zoned: do not account freed region of read-only block group as zone_unusable Naohiro Aota

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=e6519c3681550015fbeeb0565f707d72705a39f1.1614331998.git.naohiro.aota@wdc.com \
    --to=naohiro.aota@wdc.com \
    --cc=dsterba@suse.com \
    --cc=hare@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@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.