Incfs: Add the new .blocks_written control file
Bug: 170231230 Test: incremental and PackageManager unit tests Change-Id: Ia26306a4b1ca70ce70d55ce807fea62540f89334
This commit is contained in:
@@ -25,4 +25,5 @@ parcelable IncrementalFileSystemControlParcel {
|
||||
ParcelFileDescriptor cmd;
|
||||
ParcelFileDescriptor pendingReads;
|
||||
ParcelFileDescriptor log;
|
||||
@nullable ParcelFileDescriptor blocksWritten;
|
||||
}
|
||||
|
||||
@@ -503,7 +503,9 @@ StorageId IncrementalService::createStorage(
|
||||
int cmd = controlParcel.cmd.release().release();
|
||||
int pendingReads = controlParcel.pendingReads.release().release();
|
||||
int logs = controlParcel.log.release().release();
|
||||
control = mIncFs->createControl(cmd, pendingReads, logs);
|
||||
int blocksWritten =
|
||||
controlParcel.blocksWritten ? controlParcel.blocksWritten->release().release() : -1;
|
||||
control = mIncFs->createControl(cmd, pendingReads, logs, blocksWritten);
|
||||
}
|
||||
|
||||
std::unique_lock l(mLock);
|
||||
@@ -1381,7 +1383,9 @@ bool IncrementalService::mountExistingImage(std::string_view root) {
|
||||
int cmd = controlParcel.cmd.release().release();
|
||||
int pendingReads = controlParcel.pendingReads.release().release();
|
||||
int logs = controlParcel.log.release().release();
|
||||
IncFsMount::Control control = mIncFs->createControl(cmd, pendingReads, logs);
|
||||
int blocksWritten =
|
||||
controlParcel.blocksWritten ? controlParcel.blocksWritten->release().release() : -1;
|
||||
IncFsMount::Control control = mIncFs->createControl(cmd, pendingReads, logs, blocksWritten);
|
||||
|
||||
auto ifs = std::make_shared<IncFsMount>(std::string(root), -1, std::move(control), *this);
|
||||
|
||||
@@ -1516,6 +1520,9 @@ void IncrementalService::prepareDataLoaderLocked(IncFsMount& ifs, DataLoaderPara
|
||||
fsControlParcel.incremental->cmd.reset(dup(ifs.control.cmd()));
|
||||
fsControlParcel.incremental->pendingReads.reset(dup(ifs.control.pendingReads()));
|
||||
fsControlParcel.incremental->log.reset(dup(ifs.control.logs()));
|
||||
if (ifs.control.blocksWritten() >= 0) {
|
||||
fsControlParcel.incremental->blocksWritten.emplace(dup(ifs.control.blocksWritten()));
|
||||
}
|
||||
fsControlParcel.service = new IncrementalServiceConnector(*this, ifs.mountId);
|
||||
|
||||
ifs.dataLoaderStub =
|
||||
|
||||
@@ -144,8 +144,9 @@ public:
|
||||
}
|
||||
}
|
||||
Control openMount(std::string_view path) const final { return incfs::open(path); }
|
||||
Control createControl(IncFsFd cmd, IncFsFd pendingReads, IncFsFd logs) const final {
|
||||
return incfs::createControl(cmd, pendingReads, logs);
|
||||
Control createControl(IncFsFd cmd, IncFsFd pendingReads, IncFsFd logs,
|
||||
IncFsFd blocksWritten) const final {
|
||||
return incfs::createControl(cmd, pendingReads, logs, blocksWritten);
|
||||
}
|
||||
ErrorCode makeFile(const Control& control, std::string_view path, int mode, FileId id,
|
||||
incfs::NewFileParams params) const final {
|
||||
|
||||
@@ -85,7 +85,8 @@ public:
|
||||
virtual ~IncFsWrapper() = default;
|
||||
virtual void listExistingMounts(const ExistingMountCallback& cb) const = 0;
|
||||
virtual Control openMount(std::string_view path) const = 0;
|
||||
virtual Control createControl(IncFsFd cmd, IncFsFd pendingReads, IncFsFd logs) const = 0;
|
||||
virtual Control createControl(IncFsFd cmd, IncFsFd pendingReads, IncFsFd logs,
|
||||
IncFsFd blocksWritten) const = 0;
|
||||
virtual ErrorCode makeFile(const Control& control, std::string_view path, int mode, FileId id,
|
||||
incfs::NewFileParams params) const = 0;
|
||||
virtual ErrorCode makeDir(const Control& control, std::string_view path, int mode) const = 0;
|
||||
|
||||
@@ -285,7 +285,9 @@ class MockIncFs : public IncFsWrapper {
|
||||
public:
|
||||
MOCK_CONST_METHOD1(listExistingMounts, void(const ExistingMountCallback& cb));
|
||||
MOCK_CONST_METHOD1(openMount, Control(std::string_view path));
|
||||
MOCK_CONST_METHOD3(createControl, Control(IncFsFd cmd, IncFsFd pendingReads, IncFsFd logs));
|
||||
MOCK_CONST_METHOD4(createControl,
|
||||
Control(IncFsFd cmd, IncFsFd pendingReads, IncFsFd logs,
|
||||
IncFsFd blocksWritten));
|
||||
MOCK_CONST_METHOD5(makeFile,
|
||||
ErrorCode(const Control& control, std::string_view path, int mode, FileId id,
|
||||
NewFileParams params));
|
||||
@@ -355,7 +357,7 @@ public:
|
||||
|
||||
static constexpr auto kPendingReadsFd = 42;
|
||||
Control openMountForHealth(std::string_view) {
|
||||
return UniqueControl(IncFs_CreateControl(-1, kPendingReadsFd, -1));
|
||||
return UniqueControl(IncFs_CreateControl(-1, kPendingReadsFd, -1, -1));
|
||||
}
|
||||
|
||||
RawMetadata getMountInfoMetadata(const Control& control, std::string_view path) {
|
||||
|
||||
Reference in New Issue
Block a user