diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-11-06 20:44:57 -0800 |
---|---|---|
committer | JP Abgrall <jpa@google.com> | 2015-03-23 10:10:26 -0700 |
commit | 0f736527eb38eae3778b8be81921a9c458ad647f (patch) | |
tree | 06e0258abdb08ea031f8bfed0bdb7796bb1b4e87 | |
parent | c07795e73cbc509286e35193759e80d65ee12a44 (diff) | |
download | android_external_f2fs-tools-0f736527eb38eae3778b8be81921a9c458ad647f.tar.gz android_external_f2fs-tools-0f736527eb38eae3778b8be81921a9c458ad647f.tar.bz2 android_external_f2fs-tools-0f736527eb38eae3778b8be81921a9c458ad647f.zip |
mkfs.f2fs: give a kernel version for initial format
This is to identify when the format was done.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/mount.c | 3 | ||||
-rw-r--r-- | include/f2fs_fs.h | 2 | ||||
-rw-r--r-- | mkfs/f2fs_format.c | 12 |
3 files changed, 17 insertions, 0 deletions
diff --git a/fsck/mount.c b/fsck/mount.c index 37bd8c7..8ff7ff7 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -249,7 +249,10 @@ int validate_super_block(struct f2fs_sb_info *sbi, int block) /* build sb version */ memcpy(config.sb_version, sbi->raw_super->version, VERSION_LEN); get_kernel_version(config.sb_version); + memcpy(config.init_version, sbi->raw_super->init_version, VERSION_LEN); + get_kernel_version(config.init_version); + MSG(0, "Info: MKFS version\n \"%s\"\n", config.init_version); MSG(0, "Info: FSCK version\n from \"%s\"\n to \"%s\"\n", config.sb_version, config.version); if (memcmp(config.sb_version, config.version, VERSION_LEN)) { diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 0ec9ee7..efddfca 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -234,6 +234,7 @@ struct f2fs_configuration { u_int64_t total_sectors; u_int32_t sectors_per_blk; u_int32_t blks_per_seg; + __u8 init_version[VERSION_LEN + 1]; __u8 sb_version[VERSION_LEN + 1]; __u8 version[VERSION_LEN + 1]; char *vol_label; @@ -350,6 +351,7 @@ struct f2fs_super_block { __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */ __le32 cp_payload; __u8 version[VERSION_LEN]; /* the kernel version */ + __u8 init_version[VERSION_LEN]; /* the initial kernel version */ } __attribute__((packed)); /* diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index e300731..bf6ce00 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -350,6 +350,18 @@ static int f2fs_prepare_super_block(void) configure_extension_list(); + /* get kernel version */ + if (config.kd >= 0) { + dev_read_version(config.version, 0, VERSION_LEN); + get_kernel_version(config.version); + MSG(0, "Info: format version with\n \"%s\"\n", config.version); + } else { + memset(config.version, 0, VERSION_LEN); + } + + memcpy(super_block.version, config.version, VERSION_LEN); + memcpy(super_block.init_version, config.version, VERSION_LEN); + return 0; } |