From 95e233f9ff4d51bbafc6314b88920f553edd365f Mon Sep 17 00:00:00 2001 From: Keun-young Park Date: Fri, 7 Apr 2017 14:16:42 -0700 Subject: [PATCH] use s_max_mnt_count to detect mke2fs generated partition - Old tool will set it to 10 while mke2fs will set it to -1. - For now, only tag it. - TODO: possibly add different policy per image tool version. bug: 32246772 Test: check dmesg after reboot Change-Id: Ib763f8ba64957412d2b02a9d6e3fc2bfcf55851e --- fs_mgr/fs_mgr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 6636be246..120129c50 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -283,7 +283,10 @@ static int do_quota_with_shutdown_check(char *blk_device, char *fs_type, return force_check; } *fs_stat |= FS_STAT_IS_EXT4; - //TODO check if it is new version or not + LINFO << "superblock s_max_mnt_count:" << sb.s_max_mnt_count << "," << blk_device; + if (sb.s_max_mnt_count == 0xffff) { // -1 (int16) in ext2, but uint16 in ext4 + *fs_stat |= FS_STAT_NEW_IMAGE_VERSION; + } if ((sb.s_feature_incompat & EXT4_FEATURE_INCOMPAT_RECOVER) != 0 || (sb.s_state & EXT4_VALID_FS) == 0) { LINFO << __FUNCTION__ << "(): was not clealy shutdown, state flag:"