btrfs: beef-up btrfs support with a limited understanding of quota
With this change we understand more than just leaf quota groups for btrfs file systems. Specifically: - When we create a subvolume we can now optionally add the new subvolume to all qgroups its parent subvolume was member of too. Alternatively it is also possible to insert an intermediary quota group between the parent's qgroups and the subvolume's leaf qgroup, which is useful for a concept of "subtree" qgroups, that contain a subvolume and all its children. - The remove logic for subvolumes has been updated to optionally remove any leaf qgroups or "subtree" qgroups, following the logic above. - The snapshot logic for subvolumes has been updated to replicate the original qgroup setup of the source, if it follows the "subtree" design described above. It will not cover qgroup setups that introduce arbitrary qgroups, especially those orthogonal to the subvolume hierarchy. This also tries to be more graceful when setting up /var/lib/machines as btrfs. For example, if mkfs.btrfs is missing we don't even try to set it up as loopback device. Fixes #1559 Fixes #1129
This commit is contained in:
+18
-5
@@ -796,14 +796,11 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd
|
||||
return changed;
|
||||
}
|
||||
|
||||
int fsck_exists(const char *fstype) {
|
||||
static int binary_is_good(const char *binary) {
|
||||
_cleanup_free_ char *p = NULL, *d = NULL;
|
||||
const char *checker;
|
||||
int r;
|
||||
|
||||
checker = strjoina("fsck.", fstype);
|
||||
|
||||
r = find_binary(checker, true, &p);
|
||||
r = find_binary(binary, true, &p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -820,6 +817,22 @@ int fsck_exists(const char *fstype) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fsck_exists(const char *fstype) {
|
||||
const char *checker;
|
||||
|
||||
checker = strjoina("fsck.", fstype);
|
||||
|
||||
return binary_is_good(checker);
|
||||
}
|
||||
|
||||
int mkfs_exists(const char *fstype) {
|
||||
const char *mkfs;
|
||||
|
||||
mkfs = strjoina("mkfs.", fstype);
|
||||
|
||||
return binary_is_good(mkfs);
|
||||
}
|
||||
|
||||
char *prefix_root(const char *root, const char *path) {
|
||||
char *n, *p;
|
||||
size_t l;
|
||||
|
||||
Reference in New Issue
Block a user