Hey Samuel,

Oh wow...thank you so much, you have no idea how happy i am that this got
in.
Thank you so so much.

I will send the separate small patches to address the comments, but this
one is just to thank you and to try to answer the question.

sync should absolutely trigger a sync, in fact you can see in pager.c in
diskfs_sync_everything we call
  journal_commit_running_transaction ();

Which calls sync more than once (perhaps too many times)...

I just tested it without any delay like this
echo c > c && sync

and added a log warn statement in flush_to_disk and  inside journal.c and
inside diskfs_sync_everything

void
diskfs_sync_everything (int wait)
{
  error_t sync_one (void *v_p)
    {
      struct pager *p = v_p;
      pager_sync (p, wait);
      return 0;
    }

  write_all_disknodes ();
  JRNL_LOG_WARN("About to commit");
  /* We only commit if there is a journal and we have a running transaction
*/
  journal_commit_running_transaction ();
  ports_bucket_iterate (file_pager_bucket, sync_one);

  /* Do things on the the disk pager.  */
  sync_global (wait);
  if (wait && !ext2_journal)
    {
      error_t err = store_sync (store);
      if (err && err != EOPNOTSUPP && err != D_INVALID_OPERATION)
        ext2_warning ("device flush failed: %s", strerror (err));
    }
}


```
static void
flush_to_disk (void)
{
  error_t err = store_sync (store);
  JRNL_LOG_WARN("Calling store_sync");
  /* Ignore EOPNOTSUPP (drivers), but warn on real I/O errors */
  if (err && err != EOPNOTSUPP)
    JRNL_LOG_WARN ("Device flush failed: %s", strerror (err));
}
```

my log is:
```

ext2fs: part:5:device:wd0: warning: [JOURNAL] About to commit

ext2fs: part:5:device:wd0: warning: [JOURNAL] Calling store_sync

ext2fs: part:5:device:wd0: warning: [JOURNAL] Calling store_sync

ext2fs: part:5:device:wd0: warning: [JOURNAL] Calling store_sync

ext2fs: part:5:device:wd0: warning: [JOURNAL] Calling store_sync

ext2fs: part:5:device:wd0: warning: [JOURNAL] Calling store_sync

ext2fs: part:5:device:wd0: warning: [JOURNAL] Calling store_sync
```

let me know if i misunderstood something, its been a bit of time and i have
started to forget some of the details.

What can happen if there is a delay when echo is executed and sync is
called the background thread could have committed in the meantime.


Thanks again,

Milos



On Wed, May 27, 2026 at 6:00 PM Samuel Thibault <[email protected]>
wrote:

> Do we really have enough sync calls?
>
> I am implementing the flush call for ide/ahci drivers in gnumach, and I
> am not seeing that many sync requests. Notably,
>
> $ echo a > a
> $ sync
>
> does not trigger a sync. Shouldn't it?
>
> Samuel
>

Reply via email to