summaryrefslogtreecommitdiffstats
path: root/src/test/test-btrfs.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-28 02:05:28 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-28 02:08:40 +0100
commitb6b1849830f5e4a6065c3b0c993668e500c954d3 (patch)
tree6c7a086974d703a0e15535bf341ce66dac03b388 /src/test/test-btrfs.c
parenttmpfiles.d: upgrade a couple of directories we create at boot to subvolumes (diff)
downloadsystemd-b6b1849830f5e4a6065c3b0c993668e500c954d3.tar.xz
systemd-b6b1849830f5e4a6065c3b0c993668e500c954d3.zip
machined: add support for reporting image size via btrfs quota
Diffstat (limited to 'src/test/test-btrfs.c')
-rw-r--r--src/test/test-btrfs.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
index 43b445d831..150a32ad6f 100644
--- a/src/test/test-btrfs.c
+++ b/src/test/test-btrfs.c
@@ -36,7 +36,8 @@ int main(int argc, char *argv[]) {
log_error_errno(errno, "Failed to open root directory: %m");
else {
BtrfsSubvolInfo info;
- char ts[FORMAT_TIMESTAMP_MAX];
+ BtrfsQuotaInfo quota;
+ char ts[FORMAT_TIMESTAMP_MAX], bs[FORMAT_BYTES_MAX];
r = btrfs_subvol_get_info_fd(fd, &info);
if (r < 0)
@@ -46,6 +47,16 @@ int main(int argc, char *argv[]) {
log_info("read-only (search): %s", yes_no(info.read_only));
}
+ r = btrfs_subvol_get_quota_fd(fd, &quota);
+ if (r < 0)
+ log_error_errno(r, "Failed to get quota info: %m");
+ else {
+ log_info("referred: %s", strna(format_bytes(bs, sizeof(bs), quota.referred)));
+ log_info("exclusive: %s", strna(format_bytes(bs, sizeof(bs), quota.exclusive)));
+ log_info("referred_max: %s", strna(format_bytes(bs, sizeof(bs), quota.referred_max)));
+ log_info("exclusive_max: %s", strna(format_bytes(bs, sizeof(bs), quota.exclusive_max)));
+ }
+
r = btrfs_subvol_get_read_only_fd(fd);
if (r < 0)
log_error_errno(r, "Failed to get read only flag: %m");