diff options
Diffstat (limited to 'fs_mgr/fs_mgr.cpp')
-rw-r--r-- | fs_mgr/fs_mgr.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index af71fe6d5..21df8af8c 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -70,6 +70,7 @@ #include <log/log_properties.h> #include <logwrap/logwrap.h> +#include "blockdev.h" #include "fs_mgr_priv.h" #define KEY_LOC_PROP "ro.crypto.keyfile.userdata" @@ -2065,22 +2066,24 @@ static bool PrepareZramBackingDevice(off64_t size) { // Allocate loop device and attach it to file_path. LoopControl loop_control; - std::string device; - if (!loop_control.Attach(target_fd.get(), 5s, &device)) { + std::string loop_device; + if (!loop_control.Attach(target_fd.get(), 5s, &loop_device)) { return false; } + ConfigureQueueDepth(loop_device, "/"); + // set block size & direct IO - unique_fd device_fd(TEMP_FAILURE_RETRY(open(device.c_str(), O_RDWR | O_CLOEXEC))); - if (device_fd.get() == -1) { - PERROR << "Cannot open " << device; + unique_fd loop_fd(TEMP_FAILURE_RETRY(open(loop_device.c_str(), O_RDWR | O_CLOEXEC))); + if (loop_fd.get() == -1) { + PERROR << "Cannot open " << loop_device; return false; } - if (!LoopControl::EnableDirectIo(device_fd.get())) { + if (!LoopControl::EnableDirectIo(loop_fd.get())) { return false; } - return InstallZramDevice(device); + return InstallZramDevice(loop_device); } bool fs_mgr_swapon_all(const Fstab& fstab) { |