2020-04-21 00:27:17

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the btrfs tree

Hi all,

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

In file included from <command-line>:32:
./usr/include/linux/btrfs_tree.h:1127:2: error: unknown type name 'u8'
1127 | u8 tree_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1128:2: error: unknown type name 'u8'
1128 | u8 chunk_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1129:2: error: unknown type name 'u8'
1129 | u8 extent_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1130:2: error: unknown type name 'u8'
1130 | u8 fs_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1131:2: error: unknown type name 'u8'
1131 | u8 dev_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1132:2: error: unknown type name 'u8'
1132 | u8 csum_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1134:2: error: unknown type name 'u8'
1134 | u8 unused_8[10];
| ^~
./usr/include/linux/btrfs_tree.h:1148:2: error: unknown type name 'u8'
1148 | u8 csum[BTRFS_CSUM_SIZE];
| ^~
./usr/include/linux/btrfs_tree.h:1150:2: error: unknown type name 'u8'
1150 | u8 fsid[BTRFS_FSID_SIZE];
| ^~
./usr/include/linux/btrfs_tree.h:1177:2: error: unknown type name 'u8'
1177 | u8 root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1178:2: error: unknown type name 'u8'
1178 | u8 chunk_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1179:2: error: unknown type name 'u8'
1179 | u8 log_root_level;
| ^~
./usr/include/linux/btrfs_tree.h:1188:2: error: unknown type name 'u8'
1188 | u8 metadata_uuid[BTRFS_FSID_SIZE];
| ^~
./usr/include/linux/btrfs_tree.h:1192:2: error: unknown type name 'u8'
1192 | u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
| ^~
./usr/include/linux/btrfs_tree.h:1283:2: error: unknown type name 'u8'
1283 | u8 csum[BTRFS_CSUM_SIZE];
| ^~
./usr/include/linux/btrfs_tree.h:1284:2: error: unknown type name 'u8'
1284 | u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
| ^~
./usr/include/linux/btrfs_tree.h:1289:2: error: unknown type name 'u8'
1289 | u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
| ^~
./usr/include/linux/btrfs_tree.h:1293:2: error: unknown type name 'u8'
1293 | u8 level;
| ^~

Caused by commit

8d80a063d508 ("btrfs: move on-disk structure definitions to btrfs_tree.h")

They should probably all be __u8 ...

I have applied the following patch for today.

From: Stephen Rothwell <[email protected]>
Date: Tue, 21 Apr 2020 10:19:20 +1000
Subject: [PATCH] btrfs: uapi headers should use __<type>

Signed-off-by: Stephen Rothwell <[email protected]>
---
include/uapi/linux/btrfs_tree.h | 36 ++++++++++++++++-----------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index a02318e4d2a9..1adf5971a966 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1124,14 +1124,14 @@ struct btrfs_root_backup {
/* future */
__le64 unused_64[4];

- u8 tree_root_level;
- u8 chunk_root_level;
- u8 extent_root_level;
- u8 fs_root_level;
- u8 dev_root_level;
- u8 csum_root_level;
+ __u8 tree_root_level;
+ __u8 chunk_root_level;
+ __u8 extent_root_level;
+ __u8 fs_root_level;
+ __u8 dev_root_level;
+ __u8 csum_root_level;
/* future and to align */
- u8 unused_8[10];
+ __u8 unused_8[10];
} __attribute__ ((__packed__));

/*
@@ -1145,9 +1145,9 @@ struct btrfs_root_backup {
/* The super block basically lists the main trees of the FS. */
struct btrfs_super_block {
/* The first 4 fields must match struct btrfs_header */
- u8 csum[BTRFS_CSUM_SIZE];
+ __u8 csum[BTRFS_CSUM_SIZE];
/* FS specific UUID, visible to user */
- u8 fsid[BTRFS_FSID_SIZE];
+ __u8 fsid[BTRFS_FSID_SIZE];
__le64 bytenr; /* this block number */
__le64 flags;

@@ -1174,9 +1174,9 @@ struct btrfs_super_block {
__le64 compat_ro_flags;
__le64 incompat_flags;
__le16 csum_type;
- u8 root_level;
- u8 chunk_root_level;
- u8 log_root_level;
+ __u8 root_level;
+ __u8 chunk_root_level;
+ __u8 log_root_level;
struct btrfs_dev_item dev_item;

char label[BTRFS_LABEL_SIZE];
@@ -1185,11 +1185,11 @@ struct btrfs_super_block {
__le64 uuid_tree_generation;

/* The UUID written into btree blocks */
- u8 metadata_uuid[BTRFS_FSID_SIZE];
+ __u8 metadata_uuid[BTRFS_FSID_SIZE];

/* Future expansion */
__le64 reserved[28];
- u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
+ __u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
} __attribute__ ((__packed__));

@@ -1280,17 +1280,17 @@ struct btrfs_super_block {
/* Every tree block (leaf or node) starts with this header. */
struct btrfs_header {
/* These first four must match the super block */
- u8 csum[BTRFS_CSUM_SIZE];
- u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
+ __u8 csum[BTRFS_CSUM_SIZE];
+ __u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
__le64 bytenr; /* Which block this node is supposed to live in */
__le64 flags;

/* Allowed to be different from the super from here on down. */
- u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
+ __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
__le64 generation;
__le64 owner;
__le32 nritems;
- u8 level;
+ __u8 level;
} __attribute__ ((__packed__));

/*
--
2.25.1

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2020-04-21 00:43:41

by Qu Wenruo

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the btrfs tree



On 2020/4/21 上午8:25, Stephen Rothwell wrote:
> Hi all,
>
> After merging the btrfs tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> In file included from <command-line>:32:

Any extra info?

It builds fine in my environment, with older HEAD though.

Is there any new commits which changed <linux/types.h> header?
As it should includes u8 typedef.

Thanks,
Qu

> ./usr/include/linux/btrfs_tree.h:1127:2: error: unknown type name 'u8'
> 1127 | u8 tree_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1128:2: error: unknown type name 'u8'
> 1128 | u8 chunk_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1129:2: error: unknown type name 'u8'
> 1129 | u8 extent_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1130:2: error: unknown type name 'u8'
> 1130 | u8 fs_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1131:2: error: unknown type name 'u8'
> 1131 | u8 dev_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1132:2: error: unknown type name 'u8'
> 1132 | u8 csum_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1134:2: error: unknown type name 'u8'
> 1134 | u8 unused_8[10];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1148:2: error: unknown type name 'u8'
> 1148 | u8 csum[BTRFS_CSUM_SIZE];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1150:2: error: unknown type name 'u8'
> 1150 | u8 fsid[BTRFS_FSID_SIZE];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1177:2: error: unknown type name 'u8'
> 1177 | u8 root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1178:2: error: unknown type name 'u8'
> 1178 | u8 chunk_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1179:2: error: unknown type name 'u8'
> 1179 | u8 log_root_level;
> | ^~
> ./usr/include/linux/btrfs_tree.h:1188:2: error: unknown type name 'u8'
> 1188 | u8 metadata_uuid[BTRFS_FSID_SIZE];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1192:2: error: unknown type name 'u8'
> 1192 | u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1283:2: error: unknown type name 'u8'
> 1283 | u8 csum[BTRFS_CSUM_SIZE];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1284:2: error: unknown type name 'u8'
> 1284 | u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
> | ^~
> ./usr/include/linux/btrfs_tree.h:1289:2: error: unknown type name 'u8'
> 1289 | u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
> | ^~
> ./usr/include/linux/btrfs_tree.h:1293:2: error: unknown type name 'u8'
> 1293 | u8 level;
> | ^~
>
> Caused by commit
>
> 8d80a063d508 ("btrfs: move on-disk structure definitions to btrfs_tree.h")
>
> They should probably all be __u8 ...
>
> I have applied the following patch for today.
>
> From: Stephen Rothwell <[email protected]>
> Date: Tue, 21 Apr 2020 10:19:20 +1000
> Subject: [PATCH] btrfs: uapi headers should use __<type>
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> include/uapi/linux/btrfs_tree.h | 36 ++++++++++++++++-----------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
> index a02318e4d2a9..1adf5971a966 100644
> --- a/include/uapi/linux/btrfs_tree.h
> +++ b/include/uapi/linux/btrfs_tree.h
> @@ -1124,14 +1124,14 @@ struct btrfs_root_backup {
> /* future */
> __le64 unused_64[4];
>
> - u8 tree_root_level;
> - u8 chunk_root_level;
> - u8 extent_root_level;
> - u8 fs_root_level;
> - u8 dev_root_level;
> - u8 csum_root_level;
> + __u8 tree_root_level;
> + __u8 chunk_root_level;
> + __u8 extent_root_level;
> + __u8 fs_root_level;
> + __u8 dev_root_level;
> + __u8 csum_root_level;
> /* future and to align */
> - u8 unused_8[10];
> + __u8 unused_8[10];
> } __attribute__ ((__packed__));
>
> /*
> @@ -1145,9 +1145,9 @@ struct btrfs_root_backup {
> /* The super block basically lists the main trees of the FS. */
> struct btrfs_super_block {
> /* The first 4 fields must match struct btrfs_header */
> - u8 csum[BTRFS_CSUM_SIZE];
> + __u8 csum[BTRFS_CSUM_SIZE];
> /* FS specific UUID, visible to user */
> - u8 fsid[BTRFS_FSID_SIZE];
> + __u8 fsid[BTRFS_FSID_SIZE];
> __le64 bytenr; /* this block number */
> __le64 flags;
>
> @@ -1174,9 +1174,9 @@ struct btrfs_super_block {
> __le64 compat_ro_flags;
> __le64 incompat_flags;
> __le16 csum_type;
> - u8 root_level;
> - u8 chunk_root_level;
> - u8 log_root_level;
> + __u8 root_level;
> + __u8 chunk_root_level;
> + __u8 log_root_level;
> struct btrfs_dev_item dev_item;
>
> char label[BTRFS_LABEL_SIZE];
> @@ -1185,11 +1185,11 @@ struct btrfs_super_block {
> __le64 uuid_tree_generation;
>
> /* The UUID written into btree blocks */
> - u8 metadata_uuid[BTRFS_FSID_SIZE];
> + __u8 metadata_uuid[BTRFS_FSID_SIZE];
>
> /* Future expansion */
> __le64 reserved[28];
> - u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
> + __u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
> struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
> } __attribute__ ((__packed__));
>
> @@ -1280,17 +1280,17 @@ struct btrfs_super_block {
> /* Every tree block (leaf or node) starts with this header. */
> struct btrfs_header {
> /* These first four must match the super block */
> - u8 csum[BTRFS_CSUM_SIZE];
> - u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
> + __u8 csum[BTRFS_CSUM_SIZE];
> + __u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
> __le64 bytenr; /* Which block this node is supposed to live in */
> __le64 flags;
>
> /* Allowed to be different from the super from here on down. */
> - u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
> + __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
> __le64 generation;
> __le64 owner;
> __le32 nritems;
> - u8 level;
> + __u8 level;
> } __attribute__ ((__packed__));
>
> /*
>


Attachments:
signature.asc (499.00 B)
OpenPGP digital signature

2020-04-21 01:15:06

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the btrfs tree

Hi Qu,

On Tue, 21 Apr 2020 08:40:45 +0800 Qu Wenruo <[email protected]> wrote:
>
> On 2020/4/21 上午8:25, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the btrfs tree, today's linux-next build (x86_64
> > allmodconfig) failed like this:
> >
> > In file included from <command-line>:32:
>
> Any extra info?

That is a build test of the uapi headers to make syre that they are
self contained.

> It builds fine in my environment, with older HEAD though.
>
> Is there any new commits which changed <linux/types.h> header?
> As it should includes u8 typedef.

My understanding is that you should only use the __ versions of the
kernel types in uapi headers to avoid namespace contamination.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2020-04-21 01:36:30

by Qu Wenruo

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the btrfs tree



On 2020/4/21 上午9:13, Stephen Rothwell wrote:
> Hi Qu,
>
> On Tue, 21 Apr 2020 08:40:45 +0800 Qu Wenruo <[email protected]> wrote:
>>
>> On 2020/4/21 上午8:25, Stephen Rothwell wrote:
>>> Hi all,
>>>
>>> After merging the btrfs tree, today's linux-next build (x86_64
>>> allmodconfig) failed like this:
>>>
>>> In file included from <command-line>:32:
>>
>> Any extra info?
>
> That is a build test of the uapi headers to make syre that they are
> self contained.

Any command to reproduce it?
As I want to avoid such problem in future development.

>
>> It builds fine in my environment, with older HEAD though.
>>
>> Is there any new commits which changed <linux/types.h> header?
>> As it should includes u8 typedef.
>
> My understanding is that you should only use the __ versions of the
> kernel types in uapi headers to avoid namespace contamination.
>
Thanks for the hint,
Qu


Attachments:
signature.asc (499.00 B)
OpenPGP digital signature

2020-04-21 01:59:38

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the btrfs tree

Hi Qu,

On Tue, 21 Apr 2020 09:33:56 +0800 Qu Wenruo <[email protected]> wrote:
>
> On 2020/4/21 上午9:13, Stephen Rothwell wrote:
> >
> > That is a build test of the uapi headers to make syre that they are
> > self contained.
>
> Any command to reproduce it?
> As I want to avoid such problem in future development.

You need to enable CONFIG_UAPI_HEADER_TEST (which allmodconfig does).

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2020-04-22 21:32:25

by David Sterba

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the btrfs tree

On Tue, Apr 21, 2020 at 10:25:20AM +1000, Stephen Rothwell wrote:
> After merging the btrfs tree, today's linux-next build (x86_64
> allmodconfig) failed like this:

> Caused by commit
>
> 8d80a063d508 ("btrfs: move on-disk structure definitions to btrfs_tree.h")
>
> They should probably all be __u8 ...
>
> I have applied the following patch for today.

I've removed the patch from the for-next branch.

2020-04-24 05:20:53

by Qu Wenruo

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the btrfs tree



On 2020/4/23 上午5:29, David Sterba wrote:
> On Tue, Apr 21, 2020 at 10:25:20AM +1000, Stephen Rothwell wrote:
>> After merging the btrfs tree, today's linux-next build (x86_64
>> allmodconfig) failed like this:
>
>> Caused by commit
>>
>> 8d80a063d508 ("btrfs: move on-disk structure definitions to btrfs_tree.h")
>>
>> They should probably all be __u8 ...
>>
>> I have applied the following patch for today.
>
> I've removed the patch from the for-next branch.
>
BTW, do I need to update the patch, or just move btrfs_tree.h to fs/btrfs?

Thanks,
Qu