Home | History | Annotate | Download | only in updater

Lines Matching full:blocks

116   // Don't discard blocks unless the update is a retry run.
166 return tgt_.blocks() * BLOCKSIZE - bytes_written_;
450 // Print the hash in hex for corrupted source blocks (excluding the stashed blocks which is
454 LOG(INFO) << "unexpected contents of source blocks in cmd:\n" << params.cmdline;
479 // Source blocks in stash only, no work to do.
487 // If there's no stashed blocks, content in the buffer is consecutive and has the same
488 // order as the source blocks.
490 locs = RangeSet(std::vector<Range>{ Range{ 0, src.blocks() } });
492 // Otherwise, the next token is the offset of the source blocks in the target range.
495 // this corresponds to the 32 src blocks #63946, #63948, #63949 ... #63978.
497 CHECK_EQ(src.blocks(), locs.blocks());
500 LOG(INFO) << "printing hash in hex for " << src.blocks() << " source blocks";
501 for (size_t i = 0; i < src.blocks(); i++) {
519 CHECK_EQ(src.blocks() * BLOCKSIZE, buffer.size());
521 for (size_t i = 0; i < src.blocks(); i++) {
531 // If the stash file doesn't exist, read the source blocks this stash contains and print the
532 // SHA-1 for these blocks.
539 LOG(INFO) << "print hash in hex for source blocks in missing stash: " << id;
541 std::vector<uint8_t> buffer(src.blocks() * BLOCKSIZE);
543 LOG(ERROR) << "failed to read source blocks for stash: " << id;
550 const size_t blocks, bool printerror) {
554 SHA1(data, blocks * BLOCKSIZE, digest);
560 LOG(ERROR) << "failed to verify blocks (expected " << expected << ", read "
631 static int LoadStash(CommandParameters& params, const std::string& id, bool verify, size_t* blocks,
634 // blocks first. If the check fails, search for the stashed files on /cache as usual.
638 allocate(src.blocks() * BLOCKSIZE, buffer);
641 LOG(ERROR) << "failed to read source blocks in stash map.";
644 if (VerifyBlocks(id, buffer, src.blocks(), true) != 0) {
645 LOG(ERROR) << "failed to verify loaded source blocks in stash map.";
654 if (!blocks) {
655 blocks = &blockcount;
688 *blocks = sb.st_size / BLOCKSIZE;
690 if (verify && VerifyBlocks(id, buffer, *blocks, true) != 0) {
693 LOG(ERROR) << "failed to find source blocks number for stash " << id
706 static int WriteStash(const std::string& base, const std::string& id, int blocks,
712 if (checkspace && CacheSizeCheck(blocks * BLOCKSIZE) != 0) {
728 LOG(INFO) << " skipping " << blocks << " existing blocks in " << cn;
736 LOG(INFO) << " writing " << blocks << " blocks to " << cn;
750 if (write_all(fd, buffer, blocks * BLOCKSIZE) == -1) {
784 // hash enough space for the expected amount of blocks we need to store. Returns
837 // if there's enough for all required blocks. Delete any partially completed stash files first.
883 size_t start = locs.blocks();
886 size_t blocks = it->second - it->first;
887 start -= blocks;
888 memmove(to + (it->first * BLOCKSIZE), from + (start * BLOCKSIZE), blocks * BLOCKSIZE);
956 // These source blocks will fail verification if used later, but we
987 * If the function is unable to load the necessary blocks or their contents don't match the hashes,
991 * target blocks, and should not be performed again.
993 * If the return value is 0, source blocks have expected content and the command can be performed.
1028 blocks() * BLOCKSIZE);
1033 // Return now if target blocks already have expected content.
1034 if (VerifyBlocks(tgthash, tgtbuffer, tgt.blocks(), false) == 0) {
1038 // Load source blocks.
1044 // If source and target blocks overlap, stash the source blocks so we can
1046 // because the source blocks won't be overwritten.
1048 LOG(INFO) << "stashing " << *src_blocks << " overlapping blocks to " << srchash;
1053 LOG(ERROR) << "failed to stash overlapping source blocks";
1064 // Source blocks have expected content, command can proceed.
1069 // Overlapping source blocks were previously stashed, command can proceed. We are recovering
1085 size_t blocks = 0;
1088 int status = LoadSrcTgtVersion3(params, tgt, &blocks, true, &overlap);
1091 LOG(ERROR) << "failed to read blocks for move";
1103 LOG(INFO) << " moving " << blocks << " blocks";
1109 LOG(INFO) << "skipping " << blocks << " already moved blocks";
1118 params.written += tgt.blocks();
1131 size_t blocks = 0;
1132 if (LoadStash(params, id, true, &blocks, params.buffer, false) == 0) {
1140 allocate(src.blocks() * BLOCKSIZE, params.buffer);
1144 blocks = src.blocks();
1147 if (VerifyBlocks(id, params.buffer, blocks, true) != 0) {
1148 // Source blocks have unexpected contents. If we actually need this data later, this is an
1151 LOG(ERROR) << "failed to load source blocks for stash " << id;
1155 // In verify mode, we don't need to stash any blocks.
1160 LOG(INFO) << "stashing " << blocks << " blocks to " << id;
1161 params.stashed += blocks;
1162 return WriteStash(params.stashbase, id, blocks, params.buffer, false, nullptr);
1184 LOG(ERROR) << "missing target blocks for zero";
1190 LOG(INFO) << " zeroing " << tgt.blocks() << " blocks";
1218 params.written += tgt.blocks();
1226 LOG(ERROR) << "missing target blocks for new";
1233 LOG(INFO) << " writing " << tgt.blocks() << " blocks of new data";
1241 LOG(ERROR) << "missing " << (tgt.blocks() * BLOCKSIZE - params.nti.writer->BytesWritten())
1252 params.written += tgt.blocks();
1277 size_t blocks = 0;
1279 int status = LoadSrcTgtVersion3(params, tgt, &blocks, false, &overlap);
1282 LOG(ERROR) << "failed to read blocks for diff";
1294 LOG(INFO) << "patching " << blocks << " blocks to " << tgt.blocks();
1300 if (ApplyImagePatch(params.buffer.data(), blocks * BLOCKSIZE, &patch_value,
1309 if (ApplyBSDiffPatch(params.buffer.data(), blocks * BLOCKSIZE, &patch_value, 0,
1324 LOG(INFO) << "skipping " << blocks << " blocks already patched to " << tgt.blocks() << " ["
1334 params.written += tgt.blocks();
1356 LOG(ERROR) << "missing target blocks for erase";
1363 LOG(INFO) << " erasing " << tgt.blocks() << " blocks";
1366 uint64_t blocks[2];
1368 blocks[0] = range.first * static_cast<uint64_t>(BLOCKSIZE);
1370 blocks[1] = (range.second - range.first) * static_cast<uint64_t>(BLOCKSIZE);
1372 if (ioctl(params.fd, BLKDISCARD, &blocks) == -1) {
1511 // Second line in transfer list is the total number of blocks we expect to write.
1532 // Fourth line is the maximum number of blocks that will be stashed simultaneously
1535 ErrorAbort(state, kArgsParsingFailure, "unexpected maximum stash blocks [%s]\n",
1597 LOG(INFO) << "wrote " << params.written << " blocks; expected " << total_blocks;
1598 LOG(INFO) << "stashed " << params.stashed << " blocks";
1607 // Delete stash only after successfully completing the update, as it may contain blocks needed
1645 * - Fill the indicated blocks with zeros.
1648 * - Fill the blocks with data read from the new_data file.
1651 * - Mark the given blocks as empty.
1656 * - Read the source blocks, apply a patch (or not in the case of move), write result to target
1657 * blocks. bsdiff or imgdiff specifies the type of patch; move means no patch at all.
1674 * entire source into memory before writing anything to the target blocks.
1866 // When opened with O_RDWR, libfec rewrites corrupted blocks when they are read
1902 // can save a copy of corrected blocks to /cache. Note:
1905 // corrupted blocks we can correct. For RS(255, 253) and a 2 GiB partition,