Lines Matching +full:no +full:- +full:wp

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 static int64_t lastspclrec = -1; /* tape block number of last written header */
78 * Concurrent dump mods (Caltech) - disk block reading and tape writing
104 static struct worker *wp; variable
119 int pgoff = getpagesize() - 1; in alloctape()
126 * CDC 92181's and 92185's make 0.8" gaps in 1600-bpi start/stop mode in alloctape()
127 * (see DEC TU80 User's Guide). The shorter gaps of 6250-bpi require in alloctape()
146 workers[i].req = (struct req *)workers[i].tblock - ntrec - 1; in alloctape()
148 wp = &workers[0]; in alloctape()
149 wp->count = 1; in alloctape()
150 wp->tapea = 0; in alloctape()
151 wp->firstrec = 0; in alloctape()
152 nextblock = wp->tblock; in alloctape()
160 wp->req[trecno].dblk = (ufs2_daddr_t)0; in writerec()
161 wp->req[trecno].count = 1; in writerec()
180 while ((avail = MIN(tpblks, ntrec - trecno)) > 0) { in dumpblock()
181 wp->req[trecno].dblk = dblkno; in dumpblock()
182 wp->req[trecno].count = avail; in dumpblock()
187 dblkno += avail << (tp_bshift - dev_bshift); in dumpblock()
188 tpblks -= avail; in dumpblock()
228 int siz = (char *)nextblock - (char *)wp->req; in flushtape()
230 wp->req[trecno].count = 0; /* Sentinel */ in flushtape()
232 if (atomic_write(wp->fd, (const void *)wp->req, siz) != siz) in flushtape()
234 wp->sent = 1; /* we sent a request, read the response later */ in flushtape()
236 lastfirstrec = wp->firstrec; in flushtape()
238 if (++wp >= &workers[WORKERS]) in flushtape()
239 wp = &workers[0]; in flushtape()
242 if (wp->sent) { in flushtape()
243 if (atomic_read(wp->fd, (void *)&got, sizeof got) in flushtape()
248 wp->sent = 0; in flushtape()
284 wp->count = lastspclrec + blks + 1 - spcl.c_tapea; in flushtape()
285 wp->tapea = spcl.c_tapea; in flushtape()
286 wp->firstrec = lastfirstrec + ntrec; in flushtape()
287 wp->inode = curino; in flushtape()
288 nextblock = wp->tblock; in flushtape()
327 quit("or use no size estimate at all.\n"); in trewind()
341 tapefd = -1; in trewind()
384 if ((tstart_changevol != (time_t)-1) && (tend_changevol != (time_t)-1)) in close_rewind()
385 tstart_writing += (tend_changevol - tstart_changevol); in close_rewind()
397 ntb = (union u_spcl *)twp->tblock[1]; in rollforward()
406 q = &twp->req[1]; in rollforward()
407 otb = (union u_spcl *)wp->tblock; in rollforward()
414 for (p = wp->req; p->count > 0; p += p->count) { in rollforward()
416 if (p->dblk == 0) in rollforward()
419 q += q->count; in rollforward()
423 if (prev->dblk != 0) in rollforward()
424 prev->count -= 1; in rollforward()
426 ntb--; in rollforward()
427 q -= 1; in rollforward()
428 q->count = 0; in rollforward()
429 q = &twp->req[0]; in rollforward()
431 q->dblk = 0; in rollforward()
432 q->count = 1; in rollforward()
434 nextblock = twp->tblock; in rollforward()
436 spcl.c_tapea = wp->tapea; in rollforward()
439 lastspclrec = savedtapea - 1; in rollforward()
441 size = (char *)ntb - (char *)q; in rollforward()
442 if (atomic_write(wp->fd, (const void *)q, size) != size) { in rollforward()
446 wp->sent = 1; in rollforward()
447 if (++wp >= &workers[WORKERS]) in rollforward()
448 wp = &workers[0]; in rollforward()
450 q->count = 1; in rollforward()
452 if (prev->dblk != 0) { in rollforward()
458 q->dblk = prev->dblk + in rollforward()
459 prev->count * (TP_BSIZE / DEV_BSIZE); in rollforward()
460 ntb = (union u_spcl *)twp->tblock; in rollforward()
466 q->dblk = 0; in rollforward()
467 *((union u_spcl *)twp->tblock) = *ntb; in rollforward()
468 ntb = (union u_spcl *)twp->tblock[1]; in rollforward()
471 wp->req[0] = *q; in rollforward()
472 nextblock = wp->tblock; in rollforward()
473 if (q->dblk == 0) in rollforward()
481 if (wp->sent) { in rollforward()
482 if (atomic_read(wp->fd, (void *)&got, sizeof got) in rollforward()
487 wp->sent = 0; in rollforward()
539 if (waitpid(childpid, &status, 0) == -1) in startnewtape()
604 if (setenv("DUMP_VOLUME", volno, 1) == -1) { in startnewtape()
639 spcl.c_count = wp->count; in startnewtape()
644 spcl.c_firstrec = wp->firstrec; in startnewtape()
647 writeheader((ino_t)wp->inode); in startnewtape()
650 tapeno, wp->inode); in startnewtape()
682 * proceed - handler for SIGUSR2, used to synchronize IO between the workers.
707 if (i == wp - &workers[0]) { in create_workers()
750 * Synchronization - each process has a lockfile, and shares file
752 * completes, we release our lock on the following process's lock-
774 quit("master/worker protocol botched - didn't get pid of next worker.\n"); in worker()
780 while ((nread = atomic_read(cmd, (void *)wp->req, reqsiz)) == reqsiz) { in worker()
781 struct req *p = wp->req; in worker()
784 trecno += p->count, p += p->count) { in worker()
785 if (p->dblk) { in worker()
786 blkread(p->dblk, wp->tblock[trecno], in worker()
787 p->count * TP_BSIZE); in worker()
789 if (p->count != 1 || atomic_read(cmd, in worker()
790 (void *)wp->tblock[trecno], in worker()
811 wrote = rmtwrite(wp->tblock[0]+size, in worker()
812 writesize-size); in worker()
815 wrote = write(tapefd, wp->tblock[0]+size, in worker()
816 writesize-size); in worker()
876 while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0) in atomic_read()
878 return (got < 0 ? got : count - need); in atomic_read()
890 while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0) in atomic_write()
892 return (got < 0 ? got : count - need); in atomic_write()