Merge changes from topic "fscklog_f2fs" am: 65e07d31d4 am: 6538c2d2e7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2085723 Change-Id: I8f4255a951c80514b0984ac5160a8d12eba6017b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user