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

Hierarchical bandwidth and operations limits. #16205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 19, 2024

  1. Hierarchical bandwidth and operations limits.

    Introduce six new properties: iolimit_{bw,op}_{read,write,total}.
    
    The iolimit_bw_* properties limit the read, write, or combined bandwidth,
    respectively, that a dataset and its descendants can consume.
    Limits are applied to both file systems and ZFS volumes.
    
    The configured limits are hierarchical, just like quotas; i.e., even if
    a higher limit is configured on the child dataset, the parent's lower
    limit will be enforced.
    
    The limits are applied at the VFS level, not at the disk level.
    The dataset is charged for each operation even if no disk access is
    required (e.g., due to caching, compression, deduplication,
    or NOP writes) or if the operation will cause more traffic (due to
    the copies property, mirroring, or RAIDZ).
    
    Read bandwidth consumption is based on:
    
    - read-like syscalls, eg., aio_read(2), pread(2), preadv(2), read(2),
      readv(2), sendfile(2)
    
    - syscalls like getdents(2) and getdirentries(2)
    
    - reading via mmaped files
    
    - zfs send
    
    Write bandwidth consumption is based on:
    
    - write-like syscalls, eg., aio_write(2), pwrite(2), pwritev(2),
      write(2), writev(2)
    
    - writing via mmaped files
    
    - zfs receive
    
    The iolimit_op_* properties limit the read, write, or both metadata
    operations, respectively, that dataset and its descendants can generate.
    
    Read operations consumption is based on:
    
    - read-like syscalls where the number of operations is equal to the
      number of blocks being read (never less than 1)
    
    - reading via mmaped files, where the number of operations is equal
      to the number of pages being read (never less than 1)
    
    - syscalls accessing metadata: readlink(2), stat(2)
    
    Write operations consumption is based on:
    
    - write-like syscalls where the number of operations is equal to the
      number of blocks being written (never less than 1)
    
    - writing via mmaped files, where the number of operations is equal
      to the number of pages being written (never less than 1)
    
    - syscalls modifing a directory's content: bind(2) (UNIX-domain
      sockets), link(2), mkdir(2), mkfifo(2), mknod(2), open(2) (file
      creation), rename(2), rmdir(2), symlink(2), unlink(2)
    
    - syscalls modifing metadata: chflags(2), chmod(2), chown(2),
      utimes(2)
    
    - updating the access time of a file when reading it
    
    Just like iolimit_bw_* limits, the iolimit_op_* limits are also
    hierarchical and applied at the VFS level.
    
    Signed-off-by: Pawel Jakub Dawidek <[email protected]>
    pjd committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    f20f80c View commit details
    Browse the repository at this point in the history
  2. Simplify the code: remove redundant variables.

    Signed-off-by: Pawel Jakub Dawidek <[email protected]>
    pjd committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    3c8a9b9 View commit details
    Browse the repository at this point in the history