From d796fbf15e8a65fe50cbbfc995b6b99be6e68d05 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 2 Feb 2018 09:54:30 -0800 Subject: [PATCH] scoutfs: track online and offline blocks Signed-off-by: Zach Brown --- utils/src/format.h | 8 ++++++++ utils/src/ioctl.h | 2 ++ utils/src/stat.c | 7 +++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/utils/src/format.h b/utils/src/format.h index 90d1d4c7..bb8d674a 100644 --- a/utils/src/format.h +++ b/utils/src/format.h @@ -449,6 +449,12 @@ struct scoutfs_timespec { * have changed. It is exposed via an ioctl and is then provided as an * argument to data functions to protect racing modification. * + * @online_blocks: The number of fixed 4k blocks currently allocated and + * storing data in the volume. + * + * @offline_blocks: The number of fixed 4k blocks that could be made + * online by staging. + * * XXX * - otime? * - compat flags? @@ -462,6 +468,8 @@ struct scoutfs_inode { __le64 meta_seq; __le64 data_seq; __le64 data_version; + __le64 online_blocks; + __le64 offline_blocks; __le64 next_readdir_pos; __le32 nlink; __le32 uid; diff --git a/utils/src/ioctl.h b/utils/src/ioctl.h index 34917a34..33c94b95 100644 --- a/utils/src/ioctl.h +++ b/utils/src/ioctl.h @@ -178,6 +178,8 @@ struct scoutfs_ioctl_stat_more { __u64 meta_seq; __u64 data_seq; __u64 data_version; + __u64 online_blocks; + __u64 offline_blocks; } __packed; #define SCOUTFS_IOC_STAT_MORE _IOW(SCOUTFS_IOCTL_MAGIC, 7, \ diff --git a/utils/src/stat.c b/utils/src/stat.c index f9f4f569..8d320afc 100644 --- a/utils/src/stat.c +++ b/utils/src/stat.c @@ -49,9 +49,12 @@ static int stat_more_cmd(int argc, char **argv) } else { printf(" File: '%s'\n" " meta_seq: %-20llu data_seq %-20llu" - " data_version: %-20llu\n", + " data_version: %-20llu\n" + " online_blocks: %-20llu " + " offline_blocks: %-20llu\n", path, stm.meta_seq, stm.data_seq, - stm.data_version); + stm.data_version, stm.online_blocks, + stm.offline_blocks); } close(fd);