Include blob sizes in blob_store service dump.
+ Correctly synchronize a couple of methods (used for debugging) which were missing the locking. + Log entries deleted during idle maintenance window which happens at most once every 24 hrs. Fixes: 158351456 Test: atest --test-mapping apex/blobstore Change-Id: I5d1a1ffc28b009274d981d1ccdac30092d4c3732
This commit is contained in:
@@ -29,6 +29,8 @@ import static android.app.blob.XmlTags.TAG_COMMITTER;
|
||||
import static android.app.blob.XmlTags.TAG_LEASEE;
|
||||
import static android.os.Process.INVALID_UID;
|
||||
import static android.system.OsConstants.O_RDONLY;
|
||||
import static android.text.format.Formatter.FLAG_IEC_UNITS;
|
||||
import static android.text.format.Formatter.formatFileSize;
|
||||
|
||||
import static com.android.server.blob.BlobStoreConfig.TAG;
|
||||
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_COMMIT_TIME;
|
||||
@@ -335,7 +337,9 @@ class BlobMetadata {
|
||||
}
|
||||
|
||||
void forEachLeasee(Consumer<Leasee> consumer) {
|
||||
mLeasees.forEach(consumer);
|
||||
synchronized (mMetadataLock) {
|
||||
mLeasees.forEach(consumer);
|
||||
}
|
||||
}
|
||||
|
||||
File getBlobFile() {
|
||||
@@ -460,54 +464,57 @@ class BlobMetadata {
|
||||
}
|
||||
|
||||
void dump(IndentingPrintWriter fout, DumpArgs dumpArgs) {
|
||||
fout.println("blobHandle:");
|
||||
fout.increaseIndent();
|
||||
mBlobHandle.dump(fout, dumpArgs.shouldDumpFull());
|
||||
fout.decreaseIndent();
|
||||
synchronized (mMetadataLock) {
|
||||
fout.println("blobHandle:");
|
||||
fout.increaseIndent();
|
||||
mBlobHandle.dump(fout, dumpArgs.shouldDumpFull());
|
||||
fout.decreaseIndent();
|
||||
fout.println("size: " + formatFileSize(mContext, getSize(), FLAG_IEC_UNITS));
|
||||
|
||||
fout.println("Committers:");
|
||||
fout.increaseIndent();
|
||||
if (mCommitters.isEmpty()) {
|
||||
fout.println("<empty>");
|
||||
} else {
|
||||
for (int i = 0, count = mCommitters.size(); i < count; ++i) {
|
||||
final Committer committer = mCommitters.valueAt(i);
|
||||
fout.println("committer " + committer.toString());
|
||||
fout.increaseIndent();
|
||||
committer.dump(fout);
|
||||
fout.decreaseIndent();
|
||||
fout.println("Committers:");
|
||||
fout.increaseIndent();
|
||||
if (mCommitters.isEmpty()) {
|
||||
fout.println("<empty>");
|
||||
} else {
|
||||
for (int i = 0, count = mCommitters.size(); i < count; ++i) {
|
||||
final Committer committer = mCommitters.valueAt(i);
|
||||
fout.println("committer " + committer.toString());
|
||||
fout.increaseIndent();
|
||||
committer.dump(fout);
|
||||
fout.decreaseIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
fout.decreaseIndent();
|
||||
fout.decreaseIndent();
|
||||
|
||||
fout.println("Leasees:");
|
||||
fout.increaseIndent();
|
||||
if (mLeasees.isEmpty()) {
|
||||
fout.println("<empty>");
|
||||
} else {
|
||||
for (int i = 0, count = mLeasees.size(); i < count; ++i) {
|
||||
final Leasee leasee = mLeasees.valueAt(i);
|
||||
fout.println("leasee " + leasee.toString());
|
||||
fout.increaseIndent();
|
||||
leasee.dump(mContext, fout);
|
||||
fout.decreaseIndent();
|
||||
fout.println("Leasees:");
|
||||
fout.increaseIndent();
|
||||
if (mLeasees.isEmpty()) {
|
||||
fout.println("<empty>");
|
||||
} else {
|
||||
for (int i = 0, count = mLeasees.size(); i < count; ++i) {
|
||||
final Leasee leasee = mLeasees.valueAt(i);
|
||||
fout.println("leasee " + leasee.toString());
|
||||
fout.increaseIndent();
|
||||
leasee.dump(mContext, fout);
|
||||
fout.decreaseIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
fout.decreaseIndent();
|
||||
fout.decreaseIndent();
|
||||
|
||||
fout.println("Open fds:");
|
||||
fout.increaseIndent();
|
||||
if (mRevocableFds.isEmpty()) {
|
||||
fout.println("<empty>");
|
||||
} else {
|
||||
for (int i = 0, count = mRevocableFds.size(); i < count; ++i) {
|
||||
final String packageName = mRevocableFds.keyAt(i);
|
||||
final ArraySet<RevocableFileDescriptor> packageFds =
|
||||
mRevocableFds.valueAt(i);
|
||||
fout.println(packageName + "#" + packageFds.size());
|
||||
fout.println("Open fds:");
|
||||
fout.increaseIndent();
|
||||
if (mRevocableFds.isEmpty()) {
|
||||
fout.println("<empty>");
|
||||
} else {
|
||||
for (int i = 0, count = mRevocableFds.size(); i < count; ++i) {
|
||||
final String packageName = mRevocableFds.keyAt(i);
|
||||
final ArraySet<RevocableFileDescriptor> packageFds =
|
||||
mRevocableFds.valueAt(i);
|
||||
fout.println(packageName + "#" + packageFds.size());
|
||||
}
|
||||
}
|
||||
fout.decreaseIndent();
|
||||
}
|
||||
fout.decreaseIndent();
|
||||
}
|
||||
|
||||
void writeToXml(XmlSerializer out) throws IOException {
|
||||
|
||||
@@ -1070,10 +1070,8 @@ public class BlobStoreManagerService extends SystemService {
|
||||
return shouldRemove;
|
||||
});
|
||||
}
|
||||
if (LOGV) {
|
||||
Slog.v(TAG, "Completed idle maintenance; deleted "
|
||||
+ Arrays.toString(deletedBlobIds.toArray()));
|
||||
}
|
||||
Slog.d(TAG, "Completed idle maintenance; deleted "
|
||||
+ Arrays.toString(deletedBlobIds.toArray()));
|
||||
writeBlobSessionsAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ import static android.system.OsConstants.O_CREAT;
|
||||
import static android.system.OsConstants.O_RDONLY;
|
||||
import static android.system.OsConstants.O_RDWR;
|
||||
import static android.system.OsConstants.SEEK_SET;
|
||||
import static android.text.format.Formatter.FLAG_IEC_UNITS;
|
||||
import static android.text.format.Formatter.formatFileSize;
|
||||
|
||||
import static com.android.server.blob.BlobStoreConfig.TAG;
|
||||
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_SESSION_CREATION_TIME;
|
||||
@@ -533,6 +535,7 @@ class BlobStoreSession extends IBlobStoreSession.Stub {
|
||||
fout.println("ownerUid: " + mOwnerUid);
|
||||
fout.println("ownerPkg: " + mOwnerPackageName);
|
||||
fout.println("creation time: " + BlobStoreUtils.formatTime(mCreationTimeMs));
|
||||
fout.println("size: " + formatFileSize(mContext, getSize(), FLAG_IEC_UNITS));
|
||||
|
||||
fout.println("blobHandle:");
|
||||
fout.increaseIndent();
|
||||
|
||||
Reference in New Issue
Block a user