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

Function dump_data

src/tools/ceph_objectstore_tool.cc:1302–1332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1300}
1301
1302int dump_data(Formatter *formatter, bufferlist &bl,
1303 const std::string &dump_data_path)
1304{
1305 auto ebliter = bl.cbegin();
1306 data_section ds;
1307 ds.decode(ebliter);
1308
1309 formatter->open_object_section("data_block");
1310 formatter->dump_unsigned("offset", ds.offset);
1311 formatter->dump_unsigned("len", ds.len);
1312 if (!dump_data_path.empty()) {
1313 int fd = open(dump_data_path.c_str(), O_WRONLY|O_CREAT|O_LARGEFILE, 0666);
1314 if (fd == -1) {
1315 std::cerr << "open " << dump_data_path << " failed: "
1316 << cpp_strerror(errno) << std::endl;
1317 } else {
1318 int ret = ds.databl.write_fd(fd, ds.offset);
1319 if (ret < 0) {
1320 std::cerr << "write " << dump_data_path << " failed: "
1321 << cpp_strerror(ret) << std::endl;
1322 } else {
1323 formatter->dump_string("file", dump_data_path);
1324 }
1325 close(fd);
1326 }
1327 }
1328
1329 formatter->close_section();
1330 formatter->flush(cout);
1331 return 0;
1332}
1333
1334int get_data(ObjectStore *store, coll_t coll, ghobject_t hoid,
1335 ObjectStore::Transaction *t, bufferlist &bl)

Callers 1

dump_objectMethod · 0.70

Calls 11

cpp_strerrorFunction · 0.85
cbeginMethod · 0.45
decodeMethod · 0.45
open_object_sectionMethod · 0.45
dump_unsignedMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
write_fdMethod · 0.45
dump_stringMethod · 0.45
close_sectionMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected