Re: [PATCH v2] Introduce the end_syncfs option

Damien Le Moal
2026-01-27T06:03:56Z

On 1/27/26 12:59, Jens Axboe wrote:
> On 1/26/26 7:18 PM, Damien Le Moal wrote:
>> On 1/27/26 11:15, Vincent Fu wrote:
>>> On Mon, Jan 26, 2026 at 9:05?PM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>>
>>>> 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.
>>>
>>> Ok thank you for clarifying.
>>> Please emphasize in the documentation that this feature assumes that
>>> all files will reside on the same file system.
>>
>> OK. Will do in v3.
>
> That seems like a very odd limitation that people will never know about,
> and hence it won't do what they think it does. We stat these files for
> getting the size, right? Then do a sync for each fs. Only doing the
> first is a cop-out imho, and somewhat of a lazy way of doing it.

OK.

> We either sync any fs that has a file that was written, or let's not add
> this feature. That can be done in any number of ways. It's a terrible
> option otherwise.
>

--
Damien Le Moal
Western Digital Research