diff mbox series

[v4,1/4] lapi/stat.h: Add STATX_DIOALIGN related definition

Message ID 1680759622-8738-1-git-send-email-xuyang2018.jy@fujitsu.com
State Superseded
Headers show
Series [v4,1/4] lapi/stat.h: Add STATX_DIOALIGN related definition | expand

Commit Message

Yang Xu \(Fujitsu\) April 6, 2023, 5:40 a.m. UTC
Also add missing stx_mnt_id.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 include/lapi/stat.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Yang Xu \(Fujitsu\) April 26, 2023, 9:57 a.m. UTC | #1
Hi

Ping!

Best Regards
Yang Xu> Also add missing stx_mnt_id.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>   include/lapi/stat.h | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/include/lapi/stat.h b/include/lapi/stat.h
> index ce1f2b678..c2db8a589 100644
> --- a/include/lapi/stat.h
> +++ b/include/lapi/stat.h
> @@ -97,7 +97,11 @@ struct statx {
>   	uint32_t	stx_dev_major;
>   	uint32_t	stx_dev_minor;
>   	/* 0x90 */
> -	uint64_t	__spare2[14];
> +	uint64_t	stx_mnt_id;
> +	uint32_t	stx_dio_mem_align;
> +	uint32_t	stx_dio_offset_align;
> +	/* 0xa0 */
> +	uint64_t	__spare1[12];
>   	/* 0x100 */
>   };
>   #endif
> @@ -180,6 +184,10 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
>   # define STATX_MNT_ID		0x00001000U
>   #endif
>   
> +#ifndef STATX_DIOALIGN
> +# define STATX_DIOALIGN		0x00002000U
> +#endif
> +
>   #ifndef STATX_ALL
>   # define STATX_ALL		0x00000fffU
>   #endif
Eric Biggers April 26, 2023, 9:56 p.m. UTC | #2
On Thu, Apr 06, 2023 at 01:40:19PM +0800, Yang Xu wrote:
> Also add missing stx_mnt_id.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  include/lapi/stat.h | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/include/lapi/stat.h b/include/lapi/stat.h
> index ce1f2b678..c2db8a589 100644
> --- a/include/lapi/stat.h
> +++ b/include/lapi/stat.h
> @@ -97,7 +97,11 @@ struct statx {
>  	uint32_t	stx_dev_major;
>  	uint32_t	stx_dev_minor;
>  	/* 0x90 */
> -	uint64_t	__spare2[14];
> +	uint64_t	stx_mnt_id;
> +	uint32_t	stx_dio_mem_align;
> +	uint32_t	stx_dio_offset_align;
> +	/* 0xa0 */
> +	uint64_t	__spare1[12];
>  	/* 0x100 */
>  };

Not like it matters, but the kernel header has __spare3, not __spare1.

- Eric
Yang Xu \(Fujitsu\) April 27, 2023, 1:36 a.m. UTC | #3
on 2023/04/27 5:56, Eric Biggers wrote:
> On Thu, Apr 06, 2023 at 01:40:19PM +0800, Yang Xu wrote:
>> Also add missing stx_mnt_id.
>>
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>>   include/lapi/stat.h | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/lapi/stat.h b/include/lapi/stat.h
>> index ce1f2b678..c2db8a589 100644
>> --- a/include/lapi/stat.h
>> +++ b/include/lapi/stat.h
>> @@ -97,7 +97,11 @@ struct statx {
>>   	uint32_t	stx_dev_major;
>>   	uint32_t	stx_dev_minor;
>>   	/* 0x90 */
>> -	uint64_t	__spare2[14];
>> +	uint64_t	stx_mnt_id;
>> +	uint32_t	stx_dio_mem_align;
>> +	uint32_t	stx_dio_offset_align;
>> +	/* 0xa0 */
>> +	uint64_t	__spare1[12];
>>   	/* 0x100 */
>>   };
> 
> Not like it matters, but the kernel header has __spare3, not __spare1.

Yes, I know this.

Sorry, I don't explain this reason for using _spare1[12] in commit message.

Looks the history of this struct in the kernel header.

Since kernel commit a528d35e ("statx: Add a system call to make enhanced 
file info available")[1], it introduced 
__spare0[1],__spare1[1],__spare2[14].


Then in kernel commit 3209f68 ("statx: Include a mask for stx_attributes 
in struct statx")[2], it uses stx_attributes_mask to replace __spare1[1],
so it leaves a gap.


After kernel commit fa2fcf4f1 ("statx: add mount ID")[3], it uses 
stx_mnit_id and _spare2 , _spare3[12] to replace _spare2[14].

Finally, in kernel commit 825cf206 ("statx: add direct I/O alignment 
information")[4], use  stx_dio_mem_align and stx_dio_offset_align to 
replace _spare2. It also leaves a gap.

That is why I use __spare1[12] instead of _spare3[12].


[1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/stat.h?id=a528d35e8b
[2]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/stat.h?id=3209f68b
[3]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/stat.h?id=fa2fcf4f
[4]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/stat.h?id=825cf206

Best Regards
Yang Xu

> 
> - Eric
diff mbox series

Patch

diff --git a/include/lapi/stat.h b/include/lapi/stat.h
index ce1f2b678..c2db8a589 100644
--- a/include/lapi/stat.h
+++ b/include/lapi/stat.h
@@ -97,7 +97,11 @@  struct statx {
 	uint32_t	stx_dev_major;
 	uint32_t	stx_dev_minor;
 	/* 0x90 */
-	uint64_t	__spare2[14];
+	uint64_t	stx_mnt_id;
+	uint32_t	stx_dio_mem_align;
+	uint32_t	stx_dio_offset_align;
+	/* 0xa0 */
+	uint64_t	__spare1[12];
 	/* 0x100 */
 };
 #endif
@@ -180,6 +184,10 @@  static inline int statx(int dirfd, const char *pathname, unsigned int flags,
 # define STATX_MNT_ID		0x00001000U
 #endif
 
+#ifndef STATX_DIOALIGN
+# define STATX_DIOALIGN		0x00002000U
+#endif
+
 #ifndef STATX_ALL
 # define STATX_ALL		0x00000fffU
 #endif