linux-next: build failure after merge of the block tree

Stephen Rothwell
2020-12-02T04:02:52Z

[-- Attachment #1: Type: text/plain, Size: 3140 bytes --]

Hi all,

After merging the block tree, today's linux-next build (x86_64
allmodconfig) failed like this:

fs/btrfs/zoned.c: In function 'btrfs_get_dev_zone_info':
fs/btrfs/zoned.c:168:21: error: 'struct block_device' has no member named 'bd_part'; did you mean 'bd_partno'?
168 | nr_sectors = bdev->bd_part->nr_sects;
| ^~~~~~~
| bd_partno
fs/btrfs/zoned.c: In function 'btrfs_sb_log_location_bdev':
fs/btrfs/zoned.c:508:21: error: 'struct block_device' has no member named 'bd_part'; did you mean 'bd_partno'?
508 | nr_sectors = bdev->bd_part->nr_sects;
| ^~~~~~~
| bd_partno
fs/btrfs/zoned.c: In function 'btrfs_reset_sb_log_zones':
fs/btrfs/zoned.c:606:21: error: 'struct block_device' has no member named 'bd_part'; did you mean 'bd_partno'?
606 | nr_sectors = bdev->bd_part->nr_sects;
| ^~~~~~~
| bd_partno

Caused by commits

a782483cc1f8 ("block: remove the nr_sects field in struct hd_struct")
0d02129e76ed ("block: merge struct block_device and struct hd_struct")

interacting with commits

ab3ea6d0e65c ("btrfs: get zone information of zoned block devices")
1a4b440a1c2b ("btrfs: implement log-structured superblock for ZONED mode")

from the btrfs tree.

I applied the following merge fix patch (which may, or may not, be
correct but fixes the build).

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 2 Dec 2020 14:55:04 +1100
Subject: [PATCH] fixup for "block: merge struct block_device and struct
hd_struct"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
fs/btrfs/zoned.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 155545180046..c38846659019 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -165,7 +165,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
if (!zone_info)
return -ENOMEM;

- nr_sectors = bdev->bd_part->nr_sects;
+ nr_sectors = bdev_nr_sectors(bdev);
zone_sectors = bdev_zone_sectors(bdev);
/* Check if it's power of 2 (see is_power_of_2) */
ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0);
@@ -505,7 +505,7 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
return -EINVAL;
zone_size = zone_sectors << SECTOR_SHIFT;
zone_sectors_shift = ilog2(zone_sectors);
- nr_sectors = bdev->bd_part->nr_sects;
+ nr_sectors = bdev_nr_sectors(bdev);
nr_zones = nr_sectors >> zone_sectors_shift;

sb_zone = sb_zone_number(zone_sectors_shift + SECTOR_SHIFT, mirror);
@@ -603,7 +603,7 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror)

zone_sectors = bdev_zone_sectors(bdev);
zone_sectors_shift = ilog2(zone_sectors);
- nr_sectors = bdev->bd_part->nr_sects;
+ nr_sectors = bdev_nr_sectors(bdev);
nr_zones = nr_sectors >> zone_sectors_shift;

sb_zone = sb_zone_number(zone_sectors_shift + SECTOR_SHIFT, mirror);
--
2.29.2

--
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]