Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use quota in volume size option #295

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

dmga44
Copy link
Collaborator

@dmga44 dmga44 commented Feb 5, 2025

The following changes are proposed:

  • introduce the option usequotainvolumesize to display the user specific quota instead of the storage total size. This option is also added to tweaks hidden file.
  • introduce the option statfscachetimeout to tune the statfs output caching, it is disabled by default. This option is also added to tweaks hidden file.
  • add a test to check the behavior of the option.
  • a small refactor in sauna_client.h (a new option is added and it would be nice to pack it together).

Signed-off-by: Dave [email protected]

@dmga44 dmga44 self-assigned this Feb 5, 2025
Copy link
Contributor

@lgsilva3087 lgsilva3087 left a comment

Choose a reason for hiding this comment

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

Looks good, but please see my comments.

Comment on lines +1 to +7
# Test will only succeed if the available space is more than 1GiB
#
# To run this test you need to add the following lines to /etc/sudoers.d/saunafstest:
#
# saunafstest ALL = NOPASSWD: /usr/bin/tee /tmp/SaunaFS-autotests/mnt/sfs*
#
#
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding this to the setup machine script.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was copied from another test, so it should be there (the tee line in sudoers.d).

src/mount/fuse/mount_config.cc Outdated Show resolved Hide resolved
Comment on lines 243 to 244
" -o usequotainvolumesize=0|1 replace normal volume size with the space hard limit "
"of the user specific quota (if assigned) when set to 1 (default: %u)\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it consider quota for groups?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to consider it, even coded the idea but the context coming from fuse layer passes a wrong gid. Have no idea why.

@@ -687,6 +688,34 @@ struct statvfs statfs(Context &ctx, Inode ino) {
}
(void)ino;
fs_statfs(&totalspace,&availspace,&trashspace,&reservedspace,&inodes);
if (gUseQuotaInVolumeSize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Applications can trigger a surprisingly high number of statfs (even bigger in Windows). Consider to cache the final quota value for a short time (1-5 seconds).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, I gave it some thought and the idea could be extended to the whole statfs output because the quota result (specially user's used space) could change at the same pace of the whole storage used space.

I have the cache for the whole statfs and an option to tune it, and also added it to the tweaks, so it could be activated in runtime.

Copy link
Collaborator

@rolysr rolysr left a comment

Choose a reason for hiding this comment

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

LGTM

This commit adds a new option to the client which allows users to see
as the total space of the drive the assigned quota to themselves if
enabled. This option is also added to the tweaks hidden file.

Signed-off-by: Dave <[email protected]>
@dmga44 dmga44 force-pushed the feat-use-quota-in-volume-size branch from e9b5207 to 37c6ce4 Compare February 13, 2025 00:46
The statfs syscall output could be cached for each user requesting it.
The main goal is to prevent a flooding of unnecessary calls in certain
workloads.

The commit includes the option to tune it and adding it to the tweaks
hidden file parameters.

Signed-off-by: Dave <[email protected]>
This commit adds the test_use_quota_in_volume_size to the
ShortSystemTests suite.

Signed-off-by: Dave <[email protected]>

kk2
The following changes are proposed:
- enclose limit_glibc_malloc_arenas option and its default value in
Linux specific parts of the code.
- reduce the number of ifdef/endif processor directives by
consolidating the platform specific lines of code.

The goal of this commit is to increase readability of this part of the
code.

Signed-off-by: Dave <[email protected]>
@dmga44 dmga44 force-pushed the feat-use-quota-in-volume-size branch from 37c6ce4 to 05e33c2 Compare February 13, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants