Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nixos-modules/microvm/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,11 @@ in
description = "Turn off write access";
default = false;
};
cache = mkOption {
type = enum [ "auto" "always" "metadata" "never" ];
description = "Virtiofs caching policy for the file system";
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache option is defined on every share, but it only has an effect when proto = "virtiofs". Consider clarifying that in the option description (e.g., explicitly stating it is ignored for 9p) to avoid confusing configurations where users set it on non-virtiofs shares and expect it to do something.

Suggested change
description = "Virtiofs caching policy for the file system";
description = "Virtiofs caching policy for the file system; ignored when proto = \"9p\".";

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "Virtiofs caching policy for the file system";
description = "Virtiofs caching policy for the file system, ignored when 9p is used.";

If that is correct, I did not double check that.

default = "auto";
};
};
}));
};
Expand Down
3 changes: 2 additions & 1 deletion nixos-modules/microvm/virtiofsd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ in
events = "PROCESS_STATE";
};
} // builtins.listToAttrs (
map ({ tag, socket, source, readOnly, ... }: {
map ({ tag, socket, source, readOnly, cache, ... }: {
name = "program:virtiofsd-${tag}";
value = {
stderr_syslog = true;
Expand All @@ -48,6 +48,7 @@ in
$OPT_RLIMIT \
--thread-pool-size ${toString config.microvm.virtiofsd.threadPoolSize} \
--posix-acl --xattr \
--cache=${cache} \
${lib.optionalString (config.microvm.virtiofsd.inodeFileHandles != null)
"--inode-file-handles=${config.microvm.virtiofsd.inodeFileHandles}"
} \
Expand Down
Loading