-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
62 changed files
with
4,747 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* CDDL HEADER START | ||
* | ||
* The contents of this file are subject to the terms of the | ||
* Common Development and Distribution License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* | ||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
* or http://www.opensolaris.org/os/licensing. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
* | ||
* When distributing Covered Code, include this CDDL HEADER in each | ||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
* If applicable, add the following below this CDDL HEADER, with the | ||
* fields enclosed by brackets "[]" replaced with your own identifying | ||
* information: Portions Copyright [yyyy] [name of copyright owner] | ||
* | ||
* CDDL HEADER END | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2024 The FreeBSD Foundation | ||
* | ||
* This software was developed by Pawel Dawidek <[email protected]> | ||
* under sponsorship from the FreeBSD Foundation. | ||
*/ | ||
|
||
#ifndef _SYS_ZFS_IOLIMIT_H | ||
#define _SYS_ZFS_IOLIMIT_H | ||
|
||
#include <sys/dmu_objset.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
struct zfs_iolimit; | ||
|
||
#define ZFS_IOLIMIT_BW_READ 0 | ||
#define ZFS_IOLIMIT_BW_WRITE 1 | ||
#define ZFS_IOLIMIT_BW_TOTAL 2 | ||
#define ZFS_IOLIMIT_OP_READ 3 | ||
#define ZFS_IOLIMIT_OP_WRITE 4 | ||
#define ZFS_IOLIMIT_OP_TOTAL 5 | ||
#define ZFS_IOLIMIT_FIRST ZFS_IOLIMIT_BW_READ | ||
#define ZFS_IOLIMIT_LAST ZFS_IOLIMIT_OP_TOTAL | ||
#define ZFS_IOLIMIT_NTYPES (ZFS_IOLIMIT_LAST + 1) | ||
|
||
int zfs_iolimit_prop_to_type(zfs_prop_t prop); | ||
zfs_prop_t zfs_iolimit_type_to_prop(int type); | ||
|
||
struct zfs_iolimit *zfs_iolimit_alloc(const uint64_t *limits); | ||
void zfs_iolimit_free(struct zfs_iolimit *iol); | ||
struct zfs_iolimit *zfs_iolimit_set(struct zfs_iolimit *iol, zfs_prop_t prop, | ||
uint64_t limit); | ||
|
||
int zfs_iolimit_data_read(objset_t *os, size_t blocksize, size_t bytes); | ||
int zfs_iolimit_data_write(objset_t *os, size_t blocksize, size_t bytes); | ||
int zfs_iolimit_data_copy(objset_t *srcos, objset_t *dstos, size_t blocksize, | ||
size_t bytes); | ||
int zfs_iolimit_metadata_read(objset_t *os); | ||
int zfs_iolimit_metadata_write(objset_t *os); | ||
|
||
void zfs_iolimit_data_read_spin(objset_t *os, size_t blocksize, size_t bytes); | ||
void zfs_iolimit_data_write_spin(objset_t *os, size_t blocksize, | ||
size_t bytes); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* _SYS_ZFS_IOLIMIT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.