MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dump_l2arc_header

Function dump_l2arc_header

freebsd/contrib/openzfs/cmd/zdb/zdb.c:4346–4425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4344}
4345
4346static int
4347dump_l2arc_header(int fd)
4348{
4349 l2arc_dev_hdr_phys_t l2dhdr, rebuild;
4350 int error = B_FALSE;
4351
4352 bzero(&l2dhdr, sizeof (l2dhdr));
4353 bzero(&rebuild, sizeof (rebuild));
4354
4355 if (pread64(fd, &l2dhdr, sizeof (l2dhdr),
4356 VDEV_LABEL_START_SIZE) != sizeof (l2dhdr)) {
4357 error = B_TRUE;
4358 } else {
4359 if (l2dhdr.dh_magic == BSWAP_64(L2ARC_DEV_HDR_MAGIC))
4360 byteswap_uint64_array(&l2dhdr, sizeof (l2dhdr));
4361
4362 if (l2dhdr.dh_magic != L2ARC_DEV_HDR_MAGIC)
4363 error = B_TRUE;
4364 }
4365
4366 if (error) {
4367 (void) printf("L2ARC device header not found\n\n");
4368 /* Do not return an error here for backward compatibility */
4369 return (0);
4370 } else if (!dump_opt['q']) {
4371 print_l2arc_header();
4372
4373 (void) printf(" magic: %llu\n",
4374 (u_longlong_t)l2dhdr.dh_magic);
4375 (void) printf(" version: %llu\n",
4376 (u_longlong_t)l2dhdr.dh_version);
4377 (void) printf(" pool_guid: %llu\n",
4378 (u_longlong_t)l2dhdr.dh_spa_guid);
4379 (void) printf(" flags: %llu\n",
4380 (u_longlong_t)l2dhdr.dh_flags);
4381 (void) printf(" start_lbps[0]: %llu\n",
4382 (u_longlong_t)
4383 l2dhdr.dh_start_lbps[0].lbp_daddr);
4384 (void) printf(" start_lbps[1]: %llu\n",
4385 (u_longlong_t)
4386 l2dhdr.dh_start_lbps[1].lbp_daddr);
4387 (void) printf(" log_blk_ent: %llu\n",
4388 (u_longlong_t)l2dhdr.dh_log_entries);
4389 (void) printf(" start: %llu\n",
4390 (u_longlong_t)l2dhdr.dh_start);
4391 (void) printf(" end: %llu\n",
4392 (u_longlong_t)l2dhdr.dh_end);
4393 (void) printf(" evict: %llu\n",
4394 (u_longlong_t)l2dhdr.dh_evict);
4395 (void) printf(" lb_asize_refcount: %llu\n",
4396 (u_longlong_t)l2dhdr.dh_lb_asize);
4397 (void) printf(" lb_count_refcount: %llu\n",
4398 (u_longlong_t)l2dhdr.dh_lb_count);
4399 (void) printf(" trim_action_time: %llu\n",
4400 (u_longlong_t)l2dhdr.dh_trim_action_time);
4401 (void) printf(" trim_state: %llu\n\n",
4402 (u_longlong_t)l2dhdr.dh_trim_state);
4403 }

Callers 1

dump_labelFunction · 0.85

Calls 5

bzeroFunction · 0.85
byteswap_uint64_arrayFunction · 0.85
print_l2arc_headerFunction · 0.85
dump_l2arc_log_blocksFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected