[RFC] [patch 3/3] i_version update for ext4: user interface This patch adds a ``st_i_version'' field in the stat structure, and modifies the stat(2) syscall accordingly. Currently the change is only visible on i386 and x86_64 archs. Signed-off-by: Jean Noel Cordenner --- fs/stat.c | 3 +++ include/asm-i386/stat.h | 4 ++-- include/asm-x86_64/stat.h | 5 +++-- include/linux/stat.h | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index 38a8cb2..805aeae 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -31,6 +31,7 @@ void generic_fillattr(struct inode *inode, struct kstat *stat) stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; + stat->i_version = inode->i_version; stat->size = i_size_read(inode); stat->blocks = inode->i_blocks; stat->blksize = (1 << inode->i_blkbits); @@ -230,6 +231,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) tmp.st_atime_nsec = stat->atime.tv_nsec; tmp.st_mtime_nsec = stat->mtime.tv_nsec; tmp.st_ctime_nsec = stat->ctime.tv_nsec; + tmp.st_i_version = stat->i_version; #endif tmp.st_blocks = stat->blocks; tmp.st_blksize = stat->blksize; @@ -359,6 +361,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) tmp.st_mtime_nsec = stat->mtime.tv_nsec; tmp.st_ctime = stat->ctime.tv_sec; tmp.st_ctime_nsec = stat->ctime.tv_nsec; + tmp.st_i_version = stat->i_version; tmp.st_size = stat->size; tmp.st_blocks = stat->blocks; tmp.st_blksize = stat->blksize; diff --git a/include/asm-i386/stat.h b/include/asm-i386/stat.h index 67eae78..edf2f50 100644 --- a/include/asm-i386/stat.h +++ b/include/asm-i386/stat.h @@ -32,7 +32,7 @@ struct stat { unsigned long st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; - unsigned long __unused4; + unsigned long st_i_version; unsigned long __unused5; }; @@ -41,7 +41,7 @@ struct stat { */ struct stat64 { unsigned long long st_dev; - unsigned char __pad0[4]; + unsigned int st_i_version; #define STAT64_HAS_BROKEN_ST_INO 1 unsigned long __st_ino; diff --git a/include/asm-x86_64/stat.h b/include/asm-x86_64/stat.h index fd9f00d..35ab36a 100644 --- a/include/asm-x86_64/stat.h +++ b/include/asm-x86_64/stat.h @@ -22,8 +22,9 @@ struct stat { unsigned long st_mtime; unsigned long st_mtime_nsec; unsigned long st_ctime; - unsigned long st_ctime_nsec; - long __unused[3]; + unsigned long st_ctime_nsec; + unsigned long st_i_version; + long __unused[2]; }; /* For 32bit emulation */ diff --git a/include/linux/stat.h b/include/linux/stat.h index 679ef0d..264f4d3 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -68,6 +68,7 @@ struct kstat { struct timespec atime; struct timespec mtime; struct timespec ctime; + unsigned long i_version; unsigned long blksize; unsigned long long blocks; };