Re: [PATCH v2] Introduce the end_syncfs option

Damien Le Moal
2026-01-27T02:05:41Z

On 1/27/26 10:01, Vincent Fu wrote:
> On Mon, Jan 26, 2026 at 1:22 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>
> <snip>
>> }
>> +
>> + if (td->o.end_syncfs) {
>> + td_set_runstate(td, TD_FSYNCING);
>> +
>> + for_each_file(td, f, i) {
>> + if (fio_file_syncfs(td, f))
>> + log_err("fio: end_syncfs failed\n");
>> + break;
>
> This seems like it will break out of the loop after syncfs-ing the first file.
> Is this intentional or should fio break only if there is an error?

It is intentional and it is the entire point of this patch: doing syncfs for the
first file will sync the entire FS, so all the other files will be sync-ed as
well. We thus avoid the entire loop on all files which is extremely slow when
running with a large number of files. We only need to do syncfs() once for the
first file. Ideally, we should do it for the directory specified for the files,
but that is a little more involved as a change.

--
Damien Le Moal
Western Digital Research