IdleMaint: skip swap space, bind mounts, and virtual filesystems
When the idle maintenance task runs on Cuttlefish, there are several warnings printed to logcat after the expected messages: D vold : Starting trim of /data I vold : Trimmed 0 bytes on /data in 36ms D vold : Starting trim of /cache I vold : Trimmed 58662912 bytes on /cache in 0ms D vold : Starting trim of /metadata I vold : Trimmed 7725056 bytes on /metadata in 12ms D vold : Starting trim of none W vold : Failed to open none: No such file or directory D vold : Starting trim of /sdcard W vold : Failed to open /sdcard: Not a directory D vold : Starting trim of /mnt/vendor/shared W vold : Trim failed on /mnt/vendor/shared: Inappropriate ioctl for device This is because vold gathers the filesystems to trim from the fstab, but it fails to exclude some entries that aren't appropriate to trim: /dev/block/zram0 none swap defaults zramsize=75% /tmp /sdcard none defaults,bind recoveryonly shared /mnt/vendor/shared virtiofs nosuid,nodev,noatime nofail These should be excluded because they are swap space, a bind mount, and a virtual filesystem respectively. Fix addFromFstab() to exclude the above cases. Afterwards, the messages on Cuttlefish are: D vold : Starting trim of /data I vold : Trimmed 0 bytes on /data in 39ms D vold : Starting trim of /cache I vold : Trimmed 58662912 bytes on /cache in 0ms D vold : Starting trim of /metadata I vold : Trimmed 9822208 bytes on /metadata in 12ms Change-Id: Idc575106fe6f81c737f684429d58dba4bd5478ad
This commit is contained in:
parent
019d5163cc
commit
9a3dc8c709
1 changed files with 8 additions and 4 deletions
|
@ -105,12 +105,16 @@ static void addFromVolumeManager(std::list<std::string>* paths, PathTypes path_t
|
|||
static void addFromFstab(std::list<std::string>* paths, PathTypes path_type) {
|
||||
std::string previous_mount_point;
|
||||
for (const auto& entry : fstab_default) {
|
||||
// Skip raw partitions.
|
||||
if (entry.fs_type == "emmc" || entry.fs_type == "mtd") {
|
||||
// Skip raw partitions and swap space.
|
||||
if (entry.fs_type == "emmc" || entry.fs_type == "mtd" || entry.fs_type == "swap") {
|
||||
continue;
|
||||
}
|
||||
// Skip read-only filesystems
|
||||
if (entry.flags & MS_RDONLY) {
|
||||
// Skip read-only filesystems and bind mounts.
|
||||
if (entry.flags & (MS_RDONLY | MS_BIND)) {
|
||||
continue;
|
||||
}
|
||||
// Skip anything without an underlying block device, e.g. virtiofs.
|
||||
if (entry.blk_device[0] != '/') {
|
||||
continue;
|
||||
}
|
||||
if (entry.fs_mgr_flags.vold_managed) {
|
||||
|
|
Loading…
Reference in a new issue