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

Function snprintf_blkptr_compact

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

Source from the content-addressed store, hash-verified

2218}
2219
2220static void
2221snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp,
2222 boolean_t bp_freed)
2223{
2224 const dva_t *dva = bp->blk_dva;
2225 int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1;
2226 int i;
2227
2228 if (dump_opt['b'] >= 6) {
2229 snprintf_blkptr(blkbuf, buflen, bp);
2230 if (bp_freed) {
2231 (void) snprintf(blkbuf + strlen(blkbuf),
2232 buflen - strlen(blkbuf), " %s", "FREE");
2233 }
2234 return;
2235 }
2236
2237 if (BP_IS_EMBEDDED(bp)) {
2238 (void) sprintf(blkbuf,
2239 "EMBEDDED et=%u %llxL/%llxP B=%llu",
2240 (int)BPE_GET_ETYPE(bp),
2241 (u_longlong_t)BPE_GET_LSIZE(bp),
2242 (u_longlong_t)BPE_GET_PSIZE(bp),
2243 (u_longlong_t)bp->blk_birth);
2244 return;
2245 }
2246
2247 blkbuf[0] = '\0';
2248
2249 for (i = 0; i < ndvas; i++)
2250 (void) snprintf(blkbuf + strlen(blkbuf),
2251 buflen - strlen(blkbuf), "%llu:%llx:%llx ",
2252 (u_longlong_t)DVA_GET_VDEV(&dva[i]),
2253 (u_longlong_t)DVA_GET_OFFSET(&dva[i]),
2254 (u_longlong_t)DVA_GET_ASIZE(&dva[i]));
2255
2256 if (BP_IS_HOLE(bp)) {
2257 (void) snprintf(blkbuf + strlen(blkbuf),
2258 buflen - strlen(blkbuf),
2259 "%llxL B=%llu",
2260 (u_longlong_t)BP_GET_LSIZE(bp),
2261 (u_longlong_t)bp->blk_birth);
2262 } else {
2263 (void) snprintf(blkbuf + strlen(blkbuf),
2264 buflen - strlen(blkbuf),
2265 "%llxL/%llxP F=%llu B=%llu/%llu",
2266 (u_longlong_t)BP_GET_LSIZE(bp),
2267 (u_longlong_t)BP_GET_PSIZE(bp),
2268 (u_longlong_t)BP_GET_FILL(bp),
2269 (u_longlong_t)bp->blk_birth,
2270 (u_longlong_t)BP_PHYSICAL_BIRTH(bp));
2271 if (bp_freed)
2272 (void) snprintf(blkbuf + strlen(blkbuf),
2273 buflen - strlen(blkbuf), " %s", "FREE");
2274 (void) snprintf(blkbuf + strlen(blkbuf),
2275 buflen - strlen(blkbuf), " cksum=%llx:%llx:%llx:%llx",
2276 (u_longlong_t)bp->blk_cksum.zc_word[0],
2277 (u_longlong_t)bp->blk_cksum.zc_word[1],

Callers 5

sublivelist_verify_funcFunction · 0.85
dump_bpobjFunction · 0.85
print_indirectFunction · 0.85
dump_bpobj_cbFunction · 0.85

Calls 3

snprintf_blkptrFunction · 0.85
snprintfFunction · 0.85
sprintfFunction · 0.85

Tested by

no test coverage detected