Hello,

It would probably be useful to also make filesystems emit a sync when
requested to go read-only (for shutdown).



Milos Nikic, le ven. 23 janv. 2026 15:04:38 -0800, a ecrit:
> +static error_t
> +dev_sync (struct store *store)
> +{
> +  return device_set_status (store->port, DEV_FLUSH_CACHE, NULL, 0);

Please always think about compatibility. You want #ifdef DEV_FLUSH_CACHE
to avoid making the build break for people that try to build a new hurd
with an old gnumach.

I have pushed a fixed version, thanks!

> +}
> +
>  static error_t
>  dev_set_size (struct store *store, size_t newsize)
>  {
> @@ -318,7 +324,7 @@ store_device_class =
>  {
>    STORAGE_DEVICE, "device", dev_read, dev_write, dev_set_size,
>    store_std_leaf_allocate_encoding, store_std_leaf_encode, dev_decode,
> -  dev_set_flags, dev_clear_flags, 0, 0, 0, dev_open, 0, dev_map
> +  dev_set_flags, dev_clear_flags, 0, 0, 0, dev_open, 0, dev_map, dev_sync
>  };
>  STORE_STD_CLASS (device);
>  

We also want to implement it in the often-used store classes:

- file should use file_sync
- mvol and stripe should call sync on the children
- nbd possibly has a barrier function?
- remap should forward the sync to the underlying store.

notably remap is needed for partitioned disks, and file for
file-image-based storage.


copy, memobj, task, unzipstore and zero do not need to implement it since they 
are in memory.

unknown would ideally need to have some flush notion, but we can leave
that apart.

module, open, part, typed, and url do not need to implement it since
they just forward opening a class.

Samuel

Reply via email to