OSDN Git Service

zonefs: Always do seq file write open accounting
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Tue, 12 Apr 2022 13:38:07 +0000 (22:38 +0900)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Wed, 20 Apr 2022 23:37:46 +0000 (08:37 +0900)
commit7d6dfbe03bd3bef51ead25d129dabebd8bae1ec4
treef48d2f8981112eba7f514dc4e7e5fcb60a7ef866
parent2b95a23c4f50c42fe85f0d345612075d0f2c3118
zonefs: Always do seq file write open accounting

The explicit_open mount option forces an explicitly open of the zone of
sequential files that are open for writing to ensure that the open file
can be written without the device failing write operations due to open
zone resources limit being exceeded. To implement this, zonefs accounts
all write open seq file when this mount option is used.

This accounting however can be easily performed even when the
explicit_open mount option is not used, thus allowing applications to
control zone resources on their own, without relying on open() system
call failures from zonefs.

To implement this, the helper zonefs_file_use_exp_open() is removed and
replaced with the helper zonefs_seq_file_need_wro() which test if a file
is a sequential file being open with write access. zonefs_open_zone()
and zonefs_close_zone() are renamed respectively to
zonefs_seq_file_write_open() and zonefs_seq_file_write_close() and
modified to update the s_wro_seq_files counter regardless of the
explicit_open mount option use.

If the explicit_open mount option is used, zonefs_seq_file_write_open()
execute an explicit zone open operation for a sequential file open for
writing for the first time, as before.

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