diff --git a/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h b/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h index 69079cb23..6baf4beae 100644 --- a/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h +++ b/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h @@ -28,9 +28,6 @@ static constexpr uint32_t kCowVersionMinor = 0; static constexpr uint32_t kCowVersionManifest = 2; -static constexpr size_t BLOCK_SZ = 4096; -static constexpr size_t BLOCK_SHIFT = (__builtin_ffs(BLOCK_SZ) - 1); - // This header appears as the first sequence of bytes in the COW. All fields // in the layout are little-endian encoded. The on-disk layout is: // diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/cow_format.cpp b/fs_mgr/libsnapshot/libsnapshot_cow/cow_format.cpp index 94c41093c..2157d0fa9 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/cow_format.cpp +++ b/fs_mgr/libsnapshot/libsnapshot_cow/cow_format.cpp @@ -57,8 +57,6 @@ std::ostream& operator<<(std::ostream& os, CowOperation const& op) { os << "data_length:" << op.data_length << ",\t"; os << "new_block:" << op.new_block << ",\t"; os << "source:" << op.source; - if (op.type == kCowXorOp) - os << " (block:" << op.source / BLOCK_SZ << " offset:" << op.source % BLOCK_SZ << ")"; os << ")"; return os; } diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/cow_reader.cpp b/fs_mgr/libsnapshot/libsnapshot_cow/cow_reader.cpp index 893d95fc7..bc6528517 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/cow_reader.cpp +++ b/fs_mgr/libsnapshot/libsnapshot_cow/cow_reader.cpp @@ -517,8 +517,8 @@ bool CowReader::VerifyMergeOps() { block = op.source; offset = false; } else if (op.type == kCowXorOp) { - block = op.source / BLOCK_SZ; - offset = (op.source % BLOCK_SZ) != 0; + block = op.source / header_.block_size; + offset = (op.source % header_.block_size) != 0; } else { itr->Next(); continue; diff --git a/fs_mgr/libsnapshot/snapuserd/include/snapuserd/snapuserd_kernel.h b/fs_mgr/libsnapshot/snapuserd/include/snapuserd/snapuserd_kernel.h index c592257ca..46952c4ed 100644 --- a/fs_mgr/libsnapshot/snapuserd/include/snapuserd/snapuserd_kernel.h +++ b/fs_mgr/libsnapshot/snapuserd/include/snapuserd/snapuserd_kernel.h @@ -41,6 +41,9 @@ static constexpr uint32_t SNAPSHOT_VALID = 1; */ static constexpr uint32_t SECTOR_SHIFT = 9; +static constexpr size_t BLOCK_SZ = 4096; +static constexpr size_t BLOCK_SHIFT = (__builtin_ffs(BLOCK_SZ) - 1); + typedef __u64 sector_t; typedef sector_t chunk_t;