Loading fs_mgr/libfiemap_writer/fiemap_writer.cpp +4 −6 Original line number Original line Diff line number Diff line Loading @@ -304,7 +304,6 @@ static bool PinFile(int file_fd, const std::string& file_path, uint32_t fs_type) return true; return true; } } #if 0 static bool IsFilePinned(int file_fd, const std::string& file_path, uint32_t fs_type) { static bool IsFilePinned(int file_fd, const std::string& file_path, uint32_t fs_type) { if (fs_type == EXT4_SUPER_MAGIC) { if (fs_type == EXT4_SUPER_MAGIC) { // No pinning necessary for ext4. The blocks, once allocated, are expected // No pinning necessary for ext4. The blocks, once allocated, are expected Loading Loading @@ -345,7 +344,6 @@ static bool IsFilePinned(int file_fd, const std::string& file_path, uint32_t fs_ } } return moved_blocks_nr == 0; return moved_blocks_nr == 0; } } #endif static void LogExtent(uint32_t num, const struct fiemap_extent& ext) { static void LogExtent(uint32_t num, const struct fiemap_extent& ext) { LOG(INFO) << "Extent #" << num; LOG(INFO) << "Extent #" << num; Loading Loading @@ -477,13 +475,15 @@ FiemapUniquePtr FiemapWriter::Open(const std::string& file_path, uint64_t file_s if (create) { if (create) { if (!AllocateFile(file_fd, abs_path, blocksz, file_size)) { if (!AllocateFile(file_fd, abs_path, blocksz, file_size)) { LOG(ERROR) << "Failed to allocate file: " << abs_path << " of size: " << file_size << " bytes"; cleanup(abs_path, create); cleanup(abs_path, create); return nullptr; return nullptr; } } } } // f2fs may move the file blocks around. // f2fs may move the file blocks around. if (!PinFile(file_fd, file_path, fs_type)) { if (!PinFile(file_fd, abs_path, fs_type)) { cleanup(abs_path, create); cleanup(abs_path, create); LOG(ERROR) << "Failed to pin the file in storage"; LOG(ERROR) << "Failed to pin the file in storage"; return nullptr; return nullptr; Loading Loading @@ -538,13 +538,11 @@ bool FiemapWriter::Write(off64_t off, uint8_t* buffer, uint64_t size) { return false; return false; } } #if 0 // TODO(b/122138114): check why this fails. if (!IsFilePinned(file_fd_, file_path_, fs_type_)) { if (!IsFilePinned(file_fd_, file_path_, fs_type_)) { LOG(ERROR) << "Failed write: file " << file_path_ << " is not pinned"; LOG(ERROR) << "Failed write: file " << file_path_ << " is not pinned"; return false; return false; } } #endif // find extents that must be written to and then write one at a time. // find extents that must be written to and then write one at a time. uint32_t num_extent = 1; uint32_t num_extent = 1; uint32_t buffer_offset = 0; uint32_t buffer_offset = 0; Loading Loading
fs_mgr/libfiemap_writer/fiemap_writer.cpp +4 −6 Original line number Original line Diff line number Diff line Loading @@ -304,7 +304,6 @@ static bool PinFile(int file_fd, const std::string& file_path, uint32_t fs_type) return true; return true; } } #if 0 static bool IsFilePinned(int file_fd, const std::string& file_path, uint32_t fs_type) { static bool IsFilePinned(int file_fd, const std::string& file_path, uint32_t fs_type) { if (fs_type == EXT4_SUPER_MAGIC) { if (fs_type == EXT4_SUPER_MAGIC) { // No pinning necessary for ext4. The blocks, once allocated, are expected // No pinning necessary for ext4. The blocks, once allocated, are expected Loading Loading @@ -345,7 +344,6 @@ static bool IsFilePinned(int file_fd, const std::string& file_path, uint32_t fs_ } } return moved_blocks_nr == 0; return moved_blocks_nr == 0; } } #endif static void LogExtent(uint32_t num, const struct fiemap_extent& ext) { static void LogExtent(uint32_t num, const struct fiemap_extent& ext) { LOG(INFO) << "Extent #" << num; LOG(INFO) << "Extent #" << num; Loading Loading @@ -477,13 +475,15 @@ FiemapUniquePtr FiemapWriter::Open(const std::string& file_path, uint64_t file_s if (create) { if (create) { if (!AllocateFile(file_fd, abs_path, blocksz, file_size)) { if (!AllocateFile(file_fd, abs_path, blocksz, file_size)) { LOG(ERROR) << "Failed to allocate file: " << abs_path << " of size: " << file_size << " bytes"; cleanup(abs_path, create); cleanup(abs_path, create); return nullptr; return nullptr; } } } } // f2fs may move the file blocks around. // f2fs may move the file blocks around. if (!PinFile(file_fd, file_path, fs_type)) { if (!PinFile(file_fd, abs_path, fs_type)) { cleanup(abs_path, create); cleanup(abs_path, create); LOG(ERROR) << "Failed to pin the file in storage"; LOG(ERROR) << "Failed to pin the file in storage"; return nullptr; return nullptr; Loading Loading @@ -538,13 +538,11 @@ bool FiemapWriter::Write(off64_t off, uint8_t* buffer, uint64_t size) { return false; return false; } } #if 0 // TODO(b/122138114): check why this fails. if (!IsFilePinned(file_fd_, file_path_, fs_type_)) { if (!IsFilePinned(file_fd_, file_path_, fs_type_)) { LOG(ERROR) << "Failed write: file " << file_path_ << " is not pinned"; LOG(ERROR) << "Failed write: file " << file_path_ << " is not pinned"; return false; return false; } } #endif // find extents that must be written to and then write one at a time. // find extents that must be written to and then write one at a time. uint32_t num_extent = 1; uint32_t num_extent = 1; uint32_t buffer_offset = 0; uint32_t buffer_offset = 0; Loading