[PATCH 1/7] ext4: convert EXT4_FLAGS_* defines to enum

libaokun@huaweicloud.com posted 7 patches 1 year ago
There is a newer version of this series
[PATCH 1/7] ext4: convert EXT4_FLAGS_* defines to enum
Posted by libaokun@huaweicloud.com 1 year ago
From: Baokun Li <libaokun1@huawei.com>

Do away with the defines and use an enum as it's cleaner.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/ext4/ext4.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 4e7de7eaa374..612208527512 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2232,9 +2232,11 @@ extern int ext4_feature_set_ok(struct super_block *sb, int readonly);
 /*
  * Superblock flags
  */
-#define EXT4_FLAGS_RESIZING	0
-#define EXT4_FLAGS_SHUTDOWN	1
-#define EXT4_FLAGS_BDEV_IS_DAX	2
+enum {
+	EXT4_FLAGS_RESIZING,	/* Avoid superblock update and resize race */
+	EXT4_FLAGS_SHUTDOWN,	/* Prevent access to the file system */
+	EXT4_FLAGS_BDEV_IS_DAX	/* Current block device support DAX */
+};
 
 static inline int ext4_forced_shutdown(struct super_block *sb)
 {
-- 
2.39.2
Re: [PATCH 1/7] ext4: convert EXT4_FLAGS_* defines to enum
Posted by Jan Kara 1 year ago
On Fri 17-01-25 16:23:09, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> Do away with the defines and use an enum as it's cleaner.
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Yeah, why not. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/ext4.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 4e7de7eaa374..612208527512 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2232,9 +2232,11 @@ extern int ext4_feature_set_ok(struct super_block *sb, int readonly);
>  /*
>   * Superblock flags
>   */
> -#define EXT4_FLAGS_RESIZING	0
> -#define EXT4_FLAGS_SHUTDOWN	1
> -#define EXT4_FLAGS_BDEV_IS_DAX	2
> +enum {
> +	EXT4_FLAGS_RESIZING,	/* Avoid superblock update and resize race */
> +	EXT4_FLAGS_SHUTDOWN,	/* Prevent access to the file system */
> +	EXT4_FLAGS_BDEV_IS_DAX	/* Current block device support DAX */
			      ^^ we usually put comma here so that future
additions doesn't need to modify this line.

> +};
>  
>  static inline int ext4_forced_shutdown(struct super_block *sb)
>  {
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
Re: [PATCH 1/7] ext4: convert EXT4_FLAGS_* defines to enum
Posted by Baokun Li 1 year ago
On 2025/1/21 20:07, Jan Kara wrote:
> On Fri 17-01-25 16:23:09, libaokun@huaweicloud.com wrote:
>> From: Baokun Li <libaokun1@huawei.com>
>>
>> Do away with the defines and use an enum as it's cleaner.
>>
>> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> Yeah, why not. Feel free to add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
>
> 								Honza
Thank you for the review!
>> ---
>>   fs/ext4/ext4.h | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
>> index 4e7de7eaa374..612208527512 100644
>> --- a/fs/ext4/ext4.h
>> +++ b/fs/ext4/ext4.h
>> @@ -2232,9 +2232,11 @@ extern int ext4_feature_set_ok(struct super_block *sb, int readonly);
>>   /*
>>    * Superblock flags
>>    */
>> -#define EXT4_FLAGS_RESIZING	0
>> -#define EXT4_FLAGS_SHUTDOWN	1
>> -#define EXT4_FLAGS_BDEV_IS_DAX	2
>> +enum {
>> +	EXT4_FLAGS_RESIZING,	/* Avoid superblock update and resize race */
>> +	EXT4_FLAGS_SHUTDOWN,	/* Prevent access to the file system */
>> +	EXT4_FLAGS_BDEV_IS_DAX	/* Current block device support DAX */
> 			      ^^ we usually put comma here so that future
> additions doesn't need to modify this line.
Okay, I will add a comma here in the next version.

Thanks,
Baokun
>> +};
>>   
>>   static inline int ext4_forced_shutdown(struct super_block *sb)
>>   {
>> -- 
>> 2.39.2
>>