]> git.baikalelectronics.ru Git - kernel.git/commit
zonefs: Add active seq file accounting
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Tue, 12 Apr 2022 09:54:39 +0000 (18:54 +0900)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Wed, 20 Apr 2022 23:37:56 +0000 (08:37 +0900)
commit76dff81de8fc14021cc2dc37f3889ac3a2cef108
tree6ca5a8eacf07f3ace7989bfd8c34548db980bde3
parent03f275f2371f8c076cc83773de3cb43711e8eb0b
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>
fs/zonefs/super.c
fs/zonefs/sysfs.c
fs/zonefs/zonefs.h