Changeset View
Standalone View
sys/ddb/db_textdump.c
Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if (textdump_error) | if (textdump_error) | ||||
return (textdump_error); | return (textdump_error); | ||||
if (offset + TEXTDUMP_BLOCKSIZE > di->mediasize) | if (offset + TEXTDUMP_BLOCKSIZE > di->mediasize) | ||||
return (EIO); | return (EIO); | ||||
if (offset < SIZEOF_METADATA) | if (offset < SIZEOF_METADATA) | ||||
return (ENOSPC); | return (ENOSPC); | ||||
textdump_error = dump_write(di, buffer, 0, offset + di->mediaoffset, | textdump_error = dump_raw_write(di, buffer, 0, offset + di->mediaoffset, | ||||
cem: It might be desirable to compress or encrypt textdumps at some point. Do they really need to… | |||||
markjAuthorUnsubmitted Not Done Inline ActionsThe comment at the beginning of db_textdump.c says that the reason is that we don't know the size of the textdump in advance. So the code writes it out in reverse. (The contents of each block are written normally, but you have to construct the final textdump by concatenating blocks starting at the highest LBA.) With my other changes we could address that by using the dumpextent field and writing the textdump near or at the beginning of the dump device. markj: The comment at the beginning of db_textdump.c says that the reason is that we don't know the… | |||||
cemUnsubmitted Not Done Inline ActionsYeah, I don't understand why starting at the beginning of the partition and writing down isn't the way to go. Perhaps the gap for metadata at start of partition wasn't present in the early version of the code and they did this to avoid trampling that, if dumps were small enough? Or if you must write near to the end of the partition, have the dump_write interface automatically write back-to-front. cem: Yeah, I don't understand why starting at the beginning of the partition and writing down isn't… | |||||
markjAuthorUnsubmitted Not Done Inline ActionsSee D11723 for the comment about swapping during boot. We could probably write back to front all the time, but I suspect that would make savecore (and the dump process itself) much slower on spinning disks since we'd no longer be doing sequential I/O? That doesn't matter for textdumps since they're usually quite small. markj: See D11723 for the comment about swapping during boot.
We could probably write back to front… | |||||
cemUnsubmitted Not Done Inline Actions
Yeah, sounds bad with write cache disabled. WCE drives might coalesce enough to mitigate the damage. cem: > We could probably write back to front all the time, but I suspect that would make savecore… | |||||
TEXTDUMP_BLOCKSIZE); | TEXTDUMP_BLOCKSIZE); | ||||
if (textdump_error) | if (textdump_error) | ||||
printf("textdump_writeblock: offset %jd, error %d\n", (intmax_t)offset, | printf("textdump_writeblock: offset %jd, error %d\n", (intmax_t)offset, | ||||
textdump_error); | textdump_error); | ||||
return (textdump_error); | return (textdump_error); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | #endif | ||||
(void)textdump_writenextblock(di, (char *)&kdh); | (void)textdump_writenextblock(di, (char *)&kdh); | ||||
textdump_restoreoff(trailer_offset); | textdump_restoreoff(trailer_offset); | ||||
(void)textdump_writenextblock(di, (char *)&kdh); | (void)textdump_writenextblock(di, (char *)&kdh); | ||||
/* | /* | ||||
* Terminate the dump, report any errors, and clear the pending flag. | * Terminate the dump, report any errors, and clear the pending flag. | ||||
*/ | */ | ||||
if (textdump_error == 0) | if (textdump_error == 0) | ||||
(void)dump_write(di, NULL, 0, 0, 0); | (void)dump_raw_write(di, NULL, 0, 0, 0); | ||||
if (textdump_error == ENOSPC) | if (textdump_error == ENOSPC) | ||||
printf("Textdump: Insufficient space on dump partition\n"); | printf("Textdump: Insufficient space on dump partition\n"); | ||||
else if (textdump_error != 0) | else if (textdump_error != 0) | ||||
printf("Textdump: Error %d writing dump\n", textdump_error); | printf("Textdump: Error %d writing dump\n", textdump_error); | ||||
else | else | ||||
printf("Textdump complete.\n"); | printf("Textdump complete.\n"); | ||||
textdump_pending = 0; | textdump_pending = 0; | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |
It might be desirable to compress or encrypt textdumps at some point. Do they really need to write at a specific offset? (Just asking — don't need or want to see that change in this review.)