From f23506c8a43f4c330884bd33bf9f1833368af6a3 Mon Sep 17 00:00:00 2001 From: "Misono, Tomohiro" Date: Tue, 31 Oct 2017 14:40:24 +0900 Subject: btrfs-progs: dump-tree: print c/o/s/r time of ROOT_ITEM Currently ctime/otime/stime/rtime of ROOT_ITEM are not printed in print_root_item(). Fix this and print them if the values are not zero. The function print_timespec() is moved forward to reuse. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo Signed-off-by: David Sterba --- ctree.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'ctree.h') diff --git a/ctree.h b/ctree.h index b92df1c1..ef422ea6 100644 --- a/ctree.h +++ b/ctree.h @@ -2072,6 +2072,38 @@ BTRFS_SETGET_STACK_FUNCS(root_stransid, struct btrfs_root_item, BTRFS_SETGET_STACK_FUNCS(root_rtransid, struct btrfs_root_item, rtransid, 64); +static inline struct btrfs_timespec* btrfs_root_ctime( + struct btrfs_root_item *root_item) +{ + unsigned long ptr = (unsigned long)root_item; + ptr += offsetof(struct btrfs_root_item, ctime); + return (struct btrfs_timespec *)ptr; +} + +static inline struct btrfs_timespec* btrfs_root_otime( + struct btrfs_root_item *root_item) +{ + unsigned long ptr = (unsigned long)root_item; + ptr += offsetof(struct btrfs_root_item, otime); + return (struct btrfs_timespec *)ptr; +} + +static inline struct btrfs_timespec* btrfs_root_stime( + struct btrfs_root_item *root_item) +{ + unsigned long ptr = (unsigned long)root_item; + ptr += offsetof(struct btrfs_root_item, stime); + return (struct btrfs_timespec *)ptr; +} + +static inline struct btrfs_timespec* btrfs_root_rtime( + struct btrfs_root_item *root_item) +{ + unsigned long ptr = (unsigned long)root_item; + ptr += offsetof(struct btrfs_root_item, rtime); + return (struct btrfs_timespec *)ptr; +} + /* struct btrfs_root_backup */ BTRFS_SETGET_STACK_FUNCS(backup_tree_root, struct btrfs_root_backup, tree_root, 64); -- cgit v1.2.3