diff options
author | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-04-12 11:54:39 +0200 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-04-21 01:37:56 +0200 |
commit | 87c9ce3ffec9060cf7556ed4d3c9e582c8baf575 (patch) | |
tree | 6ca5a8eacf07f3ace7989bfd8c34548db980bde3 /fs/zonefs/zonefs.h | |
parent | zonefs: Export open zone resource information through sysfs (diff) | |
download | linux-87c9ce3ffec9060cf7556ed4d3c9e582c8baf575.tar.xz linux-87c9ce3ffec9060cf7556ed4d3c9e582c8baf575.zip |
zonefs: Add active seq file accounting
Modify struct zonefs_sb_info to add the s_active_seq_files atomic to
count the number of seq files representing a zone that is partially
written or explicitly open, that is, to count sequential files with
a zone that is in an active state on the device.
The helper function zonefs_account_active() is introduced to update
this counter whenever a file is written or truncated. This helper is
also used in the zonefs_seq_file_write_open() and
zonefs_seq_file_write_close() functions when the explicit_open mount
option is used.
The s_active_seq_files counter is exported through sysfs using the
read-only attribute nr_active_seq_files. The device maximum number of
active zones is also exported through sysfs with the read-only attribute
max_active_seq_files.
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Diffstat (limited to 'fs/zonefs/zonefs.h')
-rw-r--r-- | fs/zonefs/zonefs.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/zonefs/zonefs.h b/fs/zonefs/zonefs.h index 77d2d153c59d..4b3de66c3233 100644 --- a/fs/zonefs/zonefs.h +++ b/fs/zonefs/zonefs.h @@ -40,6 +40,7 @@ static inline enum zonefs_ztype zonefs_zone_type(struct blk_zone *zone) } #define ZONEFS_ZONE_OPEN (1 << 0) +#define ZONEFS_ZONE_ACTIVE (1 << 1) /* * In-memory inode data. @@ -186,6 +187,9 @@ struct zonefs_sb_info { unsigned int s_max_wro_seq_files; atomic_t s_wro_seq_files; + unsigned int s_max_active_seq_files; + atomic_t s_active_seq_files; + bool s_sysfs_registered; struct kobject s_kobj; struct completion s_kobj_unregister; |