From c2cfb0227fa1d95a102c405ed2cbcced53e40415 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 15 Nov 2016 15:51:29 -0800 Subject: [PATCH] Print the new inode data_version field We've added a data_version field to the inode for tracking changes to the file's data. Signed-off-by: Zach Brown --- utils/src/format.h | 5 +++++ utils/src/print.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/src/format.h b/utils/src/format.h index d88ed4d4..c88462eb 100644 --- a/utils/src/format.h +++ b/utils/src/format.h @@ -200,6 +200,10 @@ struct scoutfs_timespec { } __packed; /* + * @data_version: incremented every time the contents of a file could + * have changed. It is exposed via an ioctl and is then provided as an + * argument to data functions to protect racing modification. + * * XXX * - otime? * - compat flags? @@ -211,6 +215,7 @@ struct scoutfs_inode { __le64 size; __le64 blocks; __le64 link_counter; + __le64 data_version; __le32 nlink; __le32 uid; __le32 gid; diff --git a/utils/src/print.c b/utils/src/print.c index 145d9f36..66f64fea 100644 --- a/utils/src/print.c +++ b/utils/src/print.c @@ -61,7 +61,7 @@ static void print_inode(struct scoutfs_inode *inode) { printf(" inode: size: %llu blocks: %llu lctr: %llu nlink: %u\n" " uid: %u gid: %u mode: 0%o rdev: 0x%x\n" - " salt: 0x%x\n" + " salt: 0x%x data_version %llu\n" " atime: %llu.%08u ctime: %llu.%08u\n" " mtime: %llu.%08u\n", le64_to_cpu(inode->size), le64_to_cpu(inode->blocks), @@ -69,6 +69,7 @@ static void print_inode(struct scoutfs_inode *inode) le32_to_cpu(inode->nlink), le32_to_cpu(inode->uid), le32_to_cpu(inode->gid), le32_to_cpu(inode->mode), le32_to_cpu(inode->rdev), le32_to_cpu(inode->salt), + le64_to_cpu(inode->data_version), le64_to_cpu(inode->atime.sec), le32_to_cpu(inode->atime.nsec), le64_to_cpu(inode->ctime.sec),