mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-14 14:55:41 +00:00
Teach the dump and minidump code to respect the maxioszie attribute of
the disk; the hard-coded assumption of 64K doesn't work in all cases.
This commit is contained in:
parent
b0cfa3c432
commit
7bbd40c57e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176304
@ -177,6 +177,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
|
||||
uint64_t pgs;
|
||||
size_t counter, sz, chunk;
|
||||
int i, c, error, twiddle;
|
||||
u_int maxdumppgs;
|
||||
|
||||
error = 0; /* catch case in which chunk size is 0 */
|
||||
counter = 0; /* Update twiddle every 16MB */
|
||||
@ -184,13 +185,16 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
|
||||
va = 0;
|
||||
pgs = mdp->md_size / PAGE_SIZE;
|
||||
pa = mdp->md_start;
|
||||
maxdumppgs = di->maxiosize / PAGE_SIZE;
|
||||
if (maxdumppgs == 0) /* seatbelt */
|
||||
maxdumppgs = 1;
|
||||
|
||||
printf(" chunk %d: %ldMB (%ld pages)", seqnr, PG2MB(pgs), pgs);
|
||||
|
||||
while (pgs) {
|
||||
chunk = pgs;
|
||||
if (chunk > MAXDUMPPGS)
|
||||
chunk = MAXDUMPPGS;
|
||||
if (chunk > maxdumppgs)
|
||||
chunk = maxdumppgs;
|
||||
sz = chunk << PAGE_SHIFT;
|
||||
counter += sz;
|
||||
if (counter >> 24) {
|
||||
|
@ -122,7 +122,11 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
|
||||
{
|
||||
size_t len;
|
||||
int error, i, c;
|
||||
u_int maxdumpsz;
|
||||
|
||||
maxdumpsz = di->maxiosize;
|
||||
if (maxdumpsz == 0) /* seatbelt */
|
||||
maxdumpsz = PAGE_SIZE;
|
||||
error = 0;
|
||||
if ((sz % PAGE_SIZE) != 0) {
|
||||
printf("size not page aligned\n");
|
||||
@ -143,7 +147,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
|
||||
return (error);
|
||||
}
|
||||
while (sz) {
|
||||
len = (MAXDUMPPGS * PAGE_SIZE) - fragsz;
|
||||
len = maxdumpsz - fragsz;
|
||||
if (len > sz)
|
||||
len = sz;
|
||||
counter += len;
|
||||
@ -165,7 +169,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
|
||||
fragsz += len;
|
||||
pa += len;
|
||||
sz -= len;
|
||||
if (fragsz == (MAXDUMPPGS * PAGE_SIZE)) {
|
||||
if (fragsz == maxdumpsz) {
|
||||
error = blk_flush(di);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -179,6 +179,7 @@ g_disk_kerneldump(struct bio *bp, struct disk *dp)
|
||||
di.dumper = dp->d_dump;
|
||||
di.priv = dp;
|
||||
di.blocksize = dp->d_sectorsize;
|
||||
di.maxiosize = dp->d_maxsize;
|
||||
di.mediaoffset = gkd->offset;
|
||||
if ((gkd->offset + gkd->length) > dp->d_mediasize)
|
||||
gkd->length = dp->d_mediasize - gkd->offset;
|
||||
|
@ -177,6 +177,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
|
||||
uint64_t pgs;
|
||||
size_t counter, sz, chunk;
|
||||
int i, c, error, twiddle;
|
||||
u_int maxdumppgs;
|
||||
|
||||
error = 0; /* catch case in which chunk size is 0 */
|
||||
counter = 0; /* Update twiddle every 16MB */
|
||||
@ -184,13 +185,16 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
|
||||
va = 0;
|
||||
pgs = mdp->md_size / PAGE_SIZE;
|
||||
pa = mdp->md_start;
|
||||
maxdumppgs = di->maxiosize / PAGE_SIZE;
|
||||
if (maxdumppgs == 0) /* seatbelt */
|
||||
maxdumppgs = 1;
|
||||
|
||||
printf(" chunk %d: %lldMB (%lld pages)", seqnr, PG2MB(pgs), pgs);
|
||||
|
||||
while (pgs) {
|
||||
chunk = pgs;
|
||||
if (chunk > MAXDUMPPGS)
|
||||
chunk = MAXDUMPPGS;
|
||||
if (chunk > maxdumppgs)
|
||||
chunk = maxdumppgs;
|
||||
sz = chunk << PAGE_SHIFT;
|
||||
counter += sz;
|
||||
if (counter >> 24) {
|
||||
|
@ -120,7 +120,11 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
|
||||
{
|
||||
size_t len;
|
||||
int error, i, c;
|
||||
u_int maxdumpsz;
|
||||
|
||||
maxdumpsz = di->maxiosize;
|
||||
if (maxdumpsz == 0) /* seatbelt */
|
||||
maxdumpsz = PAGE_SIZE;
|
||||
error = 0;
|
||||
if ((sz % PAGE_SIZE) != 0) {
|
||||
printf("size not page aligned\n");
|
||||
@ -141,7 +145,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
|
||||
return (error);
|
||||
}
|
||||
while (sz) {
|
||||
len = (MAXDUMPPGS * PAGE_SIZE) - fragsz;
|
||||
len = maxdumpsz - fragsz;
|
||||
if (len > sz)
|
||||
len = sz;
|
||||
counter += len;
|
||||
@ -163,7 +167,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
|
||||
fragsz += len;
|
||||
pa += len;
|
||||
sz -= len;
|
||||
if (fragsz == (MAXDUMPPGS * PAGE_SIZE)) {
|
||||
if (fragsz == maxdumpsz) {
|
||||
error = blk_flush(di);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -299,6 +299,7 @@ struct dumperinfo {
|
||||
dumper_t *dumper; /* Dumping function. */
|
||||
void *priv; /* Private parts. */
|
||||
u_int blocksize; /* Size of block in bytes. */
|
||||
u_int maxiosize; /* Max size allowed for an individual I/O */
|
||||
off_t mediaoffset; /* Initial offset in bytes. */
|
||||
off_t mediasize; /* Space available in bytes. */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user