enum dump_options { /* Work queues */
SHOW_QUEUES, /* Memory pools */
SHOW_VIO_POOL, /* Others */
SHOW_VDO_STATUS, /* This one means an option overrides the "default" choices, instead of altering them. */
SKIP_DEFAULT
};
for (j = 0; j < ARRAY_SIZE(option_names); j++) { if (is_arg_string(argv[i], option_names[j].name)) {
dump_options_requested |= option_names[j].flags; break;
}
} if (j == ARRAY_SIZE(option_names)) {
vdo_log_warning("dump option name '%s' unknown", argv[i]);
options_okay = false;
}
} if (!options_okay) return -EINVAL; if ((dump_options_requested & FLAG_SKIP_DEFAULT) == 0)
dump_options_requested |= DEFAULT_DUMP_FLAGS;
*dump_options_requested_ptr = dump_options_requested; return 0;
}
/* Dump as specified by zero or more string arguments. */ int vdo_dump(struct vdo *vdo, unsignedint argc, char *const *argv, constchar *why)
{ unsignedint dump_options_requested = 0; int result = parse_dump_options(argc, argv, &dump_options_requested);
/* Dump everything we know how to dump */ void vdo_dump_all(struct vdo *vdo, constchar *why)
{
do_dump(vdo, ~0, why);
}
/* * Dump out the data_vio waiters on a waitq. * wait_on should be the label to print for queue (e.g. logical or physical)
*/ staticvoid dump_vio_waiters(struct vdo_wait_queue *waitq, char *wait_on)
{ struct vdo_waiter *waiter, *first = vdo_waitq_get_first_waiter(waitq); struct data_vio *data_vio;
/* * Encode various attributes of a data_vio as a string of one-character flags. This encoding is for * logging brevity: * * R => vio completion result not VDO_SUCCESS * W => vio is on a waitq * D => vio is a duplicate * p => vio is a partial block operation * z => vio is a zero block * d => vio is a discard * * The common case of no flags set will result in an empty, null-terminated buffer. If any flags * are encoded, the first character in the string will be a space character.
*/ staticvoid encode_vio_dump_flags(struct data_vio *data_vio, char buffer[8])
{ char *p_flag = buffer;
*p_flag++ = ' '; if (data_vio->vio.completion.result != VDO_SUCCESS)
*p_flag++ = 'R'; if (data_vio->waiter.next_waiter != NULL)
*p_flag++ = 'W'; if (data_vio->is_duplicate)
*p_flag++ = 'D'; if (data_vio->is_partial)
*p_flag++ = 'p'; if (data_vio->is_zero)
*p_flag++ = 'z'; if (data_vio->remaining_discard > 0)
*p_flag++ = 'd'; if (p_flag == &buffer[1]) { /* No flags, so remove the blank space. */
p_flag = buffer;
}
*p_flag = '\0';
}
/* * This just needs to be big enough to hold a queue (thread) name and a function name (plus * a separator character and NUL). The latter is limited only by taste. * * In making this static, we're assuming only one "dump" will run at a time. If more than * one does run, the log output will be garbled anyway.
*/ staticchar vio_completion_dump_buffer[100 + MAX_VDO_WORK_QUEUE_NAME_LEN]; staticchar vio_block_number_dump_buffer[sizeof("P L D") + 3 * DIGITS_PER_U64]; staticchar vio_flush_generation_buffer[sizeof(" FG") + DIGITS_PER_U64]; staticchar flags_dump_buffer[8];
/* * We're likely to be logging a couple thousand of these lines, and in some circumstances * syslogd may have trouble keeping up, so keep it BRIEF rather than user-friendly.
*/
vdo_dump_completion_to_buffer(&data_vio->vio.completion,
vio_completion_dump_buffer, sizeof(vio_completion_dump_buffer)); if (data_vio->is_duplicate) {
snprintf(vio_block_number_dump_buffer, sizeof(vio_block_number_dump_buffer), "P%llu L%llu D%llu",
data_vio->allocation.pbn, data_vio->logical.lbn,
data_vio->duplicate.pbn);
} elseif (data_vio_has_allocation(data_vio)) {
snprintf(vio_block_number_dump_buffer, sizeof(vio_block_number_dump_buffer), "P%llu L%llu",
data_vio->allocation.pbn, data_vio->logical.lbn);
} else {
snprintf(vio_block_number_dump_buffer, sizeof(vio_block_number_dump_buffer), "L%llu",
data_vio->logical.lbn);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.