MCPcopy Create free account
hub / github.com/ceph/ceph / file_blockdiff

Method file_blockdiff

src/client/Client.cc:10406–10467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10404}
10405
10406int Client::file_blockdiff(struct scan_state_t *state, const UserPerm &perms,
10407 std::vector<std::pair<uint64_t,uint64_t>> *blocks)
10408{
10409 RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
10410 if (!mref_reader.is_state_satisfied()) {
10411 return -ENOTCONN;
10412 }
10413
10414 ldout(cct, 20) << __func__ << dendl;
10415
10416 InodeRef inode1;
10417 InodeRef inode2;
10418
10419 std::unique_lock lock(client_lock);
10420
10421 int r = get_fd_inode(state->fd1, &inode1);
10422 if (r < 0) {
10423 return r;
10424 }
10425 r = get_fd_inode(state->fd2, &inode2);
10426 if (r < 0) {
10427 return r;
10428 }
10429
10430 ceph_assert(inode1->ino == inode2->ino);
10431
10432 MetaRequest *req = new MetaRequest(CEPH_MDS_OP_FILE_BLOCKDIFF);
10433
10434 filepath path1, path2;
10435 inode1->make_nosnap_relative_path(path1);
10436 req->set_filepath(path1);
10437
10438 inode2->make_nosnap_relative_path(path2);
10439 req->set_filepath2(path2);
10440 req->set_inode(inode2.get());
10441
10442 req->head.args.blockdiff.scan_idx = state->index;
10443 req->head.args.blockdiff.max_objects =
10444 cct->_conf.get_val<uint64_t>("client_file_blockdiff_max_concurrent_object_scans");
10445
10446 bufferlist bl;
10447 r = make_request(req, perms, nullptr, nullptr, -1, &bl, CEPHFS_FEATURE_BLOCKDIFF);
10448 ldout(cct, 10) << __func__ << ": result=" << r << dendl;
10449
10450 if (r < 0) {
10451 return r;
10452 }
10453
10454 BlockDiff block_diff;
10455 auto p = bl.cbegin();
10456 decode(block_diff, p);
10457
10458 ldout(cct, 10) << __func__ << ": block_diff=" << block_diff << dendl;
10459 if (!block_diff.blocks.empty()) {
10460 for (auto &block : block_diff.blocks) {
10461 blocks->emplace_back(std::make_pair(block.first, block.second));
10462 }
10463 }

Callers

nothing calls this directly

Calls 11

is_state_satisfiedMethod · 0.80
set_inodeMethod · 0.80
make_requestFunction · 0.50
decodeFunction · 0.50
set_filepathMethod · 0.45
set_filepath2Method · 0.45
getMethod · 0.45
cbeginMethod · 0.45
emptyMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected