Merge "Find a zoned partition automatically"
This commit is contained in:
commit
b9e1821201
2 changed files with 11 additions and 8 deletions
|
@ -304,19 +304,16 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) {
|
|||
if (!ParseByteCount(arg, &entry->zram_backingdev_size)) {
|
||||
LWARNING << "Warning: zram_backingdev_size= flag malformed: " << arg;
|
||||
}
|
||||
} else if (StartsWith(flag, "zoned_device=")) {
|
||||
std::string zoned;
|
||||
if (ReadFileToString("/sys/class/block/" + arg + "/queue/zoned", &zoned) &&
|
||||
android::base::StartsWith(zoned, "host-managed")) {
|
||||
entry->zoned_device = "/dev/block/" + arg;
|
||||
} else if (flag == "zoned_device") {
|
||||
if (access("/dev/block/by-name/zoned_device", F_OK) == 0) {
|
||||
entry->zoned_device = "/dev/block/by-name/zoned_device";
|
||||
|
||||
// atgc in f2fs does not support a zoned device
|
||||
auto options = Split(entry->fs_options, ",");
|
||||
options.erase(std::remove(options.begin(), options.end(), "atgc"), options.end());
|
||||
entry->fs_options = android::base::Join(options, ",");
|
||||
LINFO << "Removed ATGC in fs_options as " << entry->fs_options;
|
||||
} else {
|
||||
LWARNING << "Warning: cannot find the zoned device: " << arg;
|
||||
LINFO << "Removed ATGC in fs_options as " << entry->fs_options
|
||||
<< " for zoned device=" << entry->zoned_device;
|
||||
}
|
||||
} else {
|
||||
LWARNING << "Warning: unknown flag: " << flag;
|
||||
|
|
|
@ -431,6 +431,12 @@ std::vector<std::string> DeviceHandler::GetBlockDeviceSymlinks(const Uevent& uev
|
|||
}
|
||||
}
|
||||
|
||||
std::string model;
|
||||
if (ReadFileToString("/sys/class/block/" + uevent.device_name + "/queue/zoned", &model) &&
|
||||
!StartsWith(model, "none")) {
|
||||
links.emplace_back("/dev/block/by-name/zoned_device");
|
||||
}
|
||||
|
||||
auto last_slash = uevent.path.rfind('/');
|
||||
links.emplace_back(link_path + "/" + uevent.path.substr(last_slash + 1));
|
||||
|
||||
|
|
Loading…
Reference in a new issue