diff options
| author | 2022-05-02 23:23:46 -0700 | |
|---|---|---|
| committer | 2022-05-02 23:24:21 -0700 | |
| commit | 624c1d307ea4474559968afdfea450be8333b17c (patch) | |
| tree | 0166107557b50146172ac6881d5c54510bc97c73 | |
| parent | c30d209f5feefea10c70f4315bb28f505bc0ea89 (diff) | |
Upload f2fs fscklog
Bug: 230637147
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I20568355f201bad371daae4e9a7fcc1bcd208e1d
| -rw-r--r-- | services/core/java/com/android/server/BootReceiver.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java index 95952433b23a..296b7bf24269 100644 --- a/services/core/java/com/android/server/BootReceiver.java +++ b/services/core/java/com/android/server/BootReceiver.java @@ -98,11 +98,13 @@ public class BootReceiver extends BroadcastReceiver { // example: fs_stat,/dev/block/platform/soc/by-name/userdata,0x5 private static final String FS_STAT_PATTERN = "fs_stat,[^,]*/([^/,]+),(0x[0-9a-fA-F]+)"; - private static final int FS_STAT_FS_FIXED = 0x400; // should match with fs_mgr.cpp:FsStatFlags + private static final int FS_STAT_FSCK_FS_FIXED = + 0x400; // should match with fs_mgr.cpp:FsStatFlags private static final String FSCK_PASS_PATTERN = "Pass ([1-9]E?):"; private static final String FSCK_TREE_OPTIMIZATION_PATTERN = "Inode [0-9]+ extent tree.*could be shorter"; - private static final String FSCK_FS_MODIFIED = "FILE SYSTEM WAS MODIFIED"; + private static final String E2FSCK_FS_MODIFIED = "FILE SYSTEM WAS MODIFIED"; + private static final String F2FS_FSCK_FS_MODIFIED = "[FSCK] Unreachable"; // ro.boottime.init.mount_all. + postfix for mount_all duration private static final String[] MOUNT_DURATION_PROPS_POSTFIX = new String[] { "early", "default", "late" }; @@ -460,9 +462,9 @@ public class BootReceiver extends BroadcastReceiver { int lineNumber = 0; int lastFsStatLineNumber = 0; for (String line : lines) { // should check all lines - if (line.contains(FSCK_FS_MODIFIED)) { + if (line.contains(E2FSCK_FS_MODIFIED) || line.contains(F2FS_FSCK_FS_MODIFIED)) { uploadNeeded = true; - } else if (line.contains("fs_stat")){ + } else if (line.contains("fs_stat")) { Matcher matcher = pattern.matcher(line); if (matcher.find()) { handleFsckFsStat(matcher, lines, lastFsStatLineNumber, lineNumber); @@ -474,7 +476,7 @@ public class BootReceiver extends BroadcastReceiver { lineNumber++; } - if (uploadEnabled && uploadNeeded ) { + if (uploadEnabled && uploadNeeded) { addFileToDropBox(db, timestamps, headers, "/dev/fscklogs/log", maxSize, tag); } @@ -674,7 +676,7 @@ public class BootReceiver extends BroadcastReceiver { public static int fixFsckFsStat(String partition, int statOrg, String[] lines, int startLineNumber, int endLineNumber) { int stat = statOrg; - if ((stat & FS_STAT_FS_FIXED) != 0) { + if ((stat & FS_STAT_FSCK_FS_FIXED) != 0) { // fs was fixed. should check if quota warning was caused by tree optimization. // This is not a real fix but optimization, so should not be counted as a fs fix. Pattern passPattern = Pattern.compile(FSCK_PASS_PATTERN); @@ -687,7 +689,8 @@ public class BootReceiver extends BroadcastReceiver { String otherFixLine = null; for (int i = startLineNumber; i < endLineNumber; i++) { String line = lines[i]; - if (line.contains(FSCK_FS_MODIFIED)) { // no need to parse above this + if (line.contains(E2FSCK_FS_MODIFIED) + || line.contains(F2FS_FSCK_FS_MODIFIED)) { // no need to parse above this break; } else if (line.startsWith("Pass ")) { Matcher matcher = passPattern.matcher(line); @@ -715,9 +718,9 @@ public class BootReceiver extends BroadcastReceiver { } } else if (line.startsWith("Update quota info") && currentPass.equals("5")) { // follows "[QUOTA WARNING]", ignore - } else if (line.startsWith("Timestamp(s) on inode") && - line.contains("beyond 2310-04-04 are likely pre-1970") && - currentPass.equals("1")) { + } else if (line.startsWith("Timestamp(s) on inode") + && line.contains("beyond 2310-04-04 are likely pre-1970") + && currentPass.equals("1")) { Slog.i(TAG, "fs_stat, partition:" + partition + " found timestamp adjustment:" + line); // followed by next line, "Fix? yes" @@ -745,7 +748,7 @@ public class BootReceiver extends BroadcastReceiver { } else if ((foundTreeOptimization && foundQuotaFix) || foundTimestampAdjustment) { // not a real fix, so clear it. Slog.i(TAG, "fs_stat, partition:" + partition + " fix ignored"); - stat &= ~FS_STAT_FS_FIXED; + stat &= ~FS_STAT_FSCK_FS_FIXED; } } return stat; |