Lines Matching refs:ul

50 makebusy(ml_unit_t *ul, buf_t *bp)
56 ldl_seterror(ul, "Error reading ufs log");
58 ldl_seterror(ul, "Error writing ufs log");
117 ml_unit_t *ul,
123 ic_extent_t *ext = ul->un_ebp->ic_extents;
124 uint32_t e = ul->un_ebp->ic_nextents;
162 ldl_strategy(ml_unit_t *ul, buf_t *pb)
167 ufsvfs_t *ufsvfsp = ul->un_ufsvfs;
171 dev_t dev = ul->un_dev;
188 error = map_frag(ul, lblkno, nb_left, &pblkno, &pbcount);
239 writelog(ml_unit_t *ul, buf_t *bp)
249 bp->b_edev = ul->un_dev;
255 if (ul->un_flags & LDL_ERROR) {
262 ldl_strategy(ul, bp);
266 readlog(ml_unit_t *ul, buf_t *bp)
272 bp->b_edev = ul->un_dev;
276 if (ul->un_flags & LDL_ERROR) {
284 ldl_strategy(ul, bp);
287 ldl_seterror(ul, "Error reading ufs log");
297 push_dirty_bp(ml_unit_t *ul, buf_t *bp)
300 cirbuf_t *cb = &ul->un_wrbuf;
308 writelog(ul, bp);
352 inval_range(ml_unit_t *ul, cirbuf_t *cb, off_t lof, off_t nb)
376 makebusy(ul, bp);
392 get_write_bp(ml_unit_t *ul)
394 cirbuf_t *cb = &ul->un_wrbuf;
401 makebusy(ul, bp);
408 inval_range(ul, cb, ul->un_tail_lof, 1);
415 makebusy(ul, bp);
422 bp->b_blkno = btodb(ul->un_tail_lof);
423 ASSERT(dbtob(bp->b_blkno) == ul->un_tail_lof);
584 find_bp(ml_unit_t *ul, cirbuf_t *cb, off_t lof)
596 makebusy(ul, bp);
608 find_read_lof(ml_unit_t *ul, cirbuf_t *cb, off_t lof)
621 rlof = ul->un_tail_lof;
636 return ((off_t)ul->un_eol_lof);
640 get_read_bp(ml_unit_t *ul, off_t lof)
649 if ((bp = find_bp(ul, &ul->un_wrbuf, lof)) != NULL) {
653 if ((bp = find_bp(ul, &ul->un_rdbuf, lof)) != NULL) {
661 cb = &ul->un_rdbuf;
664 makebusy(ul, bp);
675 rlof = find_read_lof(ul, &ul->un_wrbuf, lof);
677 readlog(ul, bp);
688 extend_write_bp(ml_unit_t *ul, cirbuf_t *cb, buf_t *bp)
721 makebusy(ul, bpforw);
732 makebusy(ul, bp);
739 storebuf(ml_unit_t *ul, buf_t *bp, caddr_t va, size_t nb)
745 cirbuf_t *cb = &ul->un_wrbuf;
757 ul->un_tail_lof += copy_nb;
762 st->st_tid = ul->un_logmap->mtm_tid;
763 st->st_ident = ul->un_tail_ident++;
765 ul->un_tail_lof += sizeof (sect_trailer_t);
769 if (ul->un_tail_lof == ul->un_eol_lof) {
770 ul->un_tail_lof = ul->un_bol_lof;
771 push_dirty_bp(ul, bp);
778 if (!extend_write_bp(ul, cb, bp)) {
779 push_dirty_bp(ul, bp);
816 ml_unit_t *ul,
875 if (dst_lof == ul->un_eol_lof)
876 dst_lof = ul->un_bol_lof;
891 ldl_round_commit(ml_unit_t *ul)
897 cirbuf_t *cb = &ul->un_wrbuf;
904 makebusy(ul, bp);
916 ul->un_tail_lof = dbtob(bp->b_blkno) + bcount;
918 if (ul->un_tail_lof == ul->un_eol_lof) {
919 ul->un_tail_lof = ul->un_bol_lof;
922 ASSERT(ul->un_tail_lof != ul->un_head_lof);
930 st->st_tid = ul->un_logmap->mtm_tid;
931 st->st_ident = ul->un_tail_ident++;
938 push_dirty_bp(ul, bp);
944 ldl_push_commit(ml_unit_t *ul)
947 cirbuf_t *cb = &ul->un_wrbuf;
954 makebusy(ul, bp);
955 push_dirty_bp(ul, bp);
959 ldl_need_commit(ml_unit_t *ul)
961 return (ul->un_resv > (ul->un_maxresv - (ul->un_maxresv>>2)));
965 ldl_has_space(ml_unit_t *ul, mapentry_t *me)
970 ASSERT(MUTEX_HELD(&ul->un_log_mutex));
985 if (ul->un_head_lof <= ul->un_tail_lof)
986 nfb = (ul->un_head_lof - ul->un_bol_lof) +
987 (ul->un_eol_lof - ul->un_tail_lof);
989 nfb = ul->un_head_lof - ul->un_tail_lof;
995 ldl_write(ml_unit_t *ul, caddr_t bufp, offset_t bufmof, struct mapentry *me)
1002 ASSERT(MUTEX_HELD(&ul->un_log_mutex));
1008 bp = get_write_bp(ul);
1011 if (ul->un_flags & LDL_ERROR) {
1015 actual = storebuf(ul, bp, va, nb);
1020 bp = get_write_bp(ul);
1029 me->me_lof = ul->un_tail_lof;
1041 bp = get_write_bp(ul);
1044 me->me_lof = ul->un_tail_lof;
1047 if (ul->un_flags & LDL_ERROR) {
1051 actual = storebuf(ul, bp, va, nb);
1056 bp = get_write_bp(ul);
1061 ldl_waito(ml_unit_t *ul)
1064 cirbuf_t *cb = &ul->un_wrbuf;
1073 makebusy(ul, bp);
1085 logseek(ml_unit_t *ul, off_t lof, size_t nb, off_t *lofp)
1091 bp = get_read_bp(ul, lof);
1096 actual = fetchbuf(ul, bp, NULL, nb, &lof);
1107 ml_unit_t *ul, /* Log unit */
1162 error = logseek(ul, me->me_lof, rnb, &lof);
1175 bp = get_read_bp(ul, lof);
1181 (bp != ul->un_wrbuf.cb_dirty));
1182 actual = fetchbuf(ul, bp, rva, rnb, &lof);
1192 ldl_savestate(ml_unit_t *ul)
1195 buf_t *bp = ul->un_bp;
1203 if (ul->un_logmap && ul->un_logmap->mtm_trimlof)
1207 mutex_enter(&ul->un_state_mutex);
1208 bcopy(&ul->un_ondisk, ud, sizeof (*ud));
1213 if (ul->un_ufsvfs->vfs_snapshot)
1214 UFS_BWRITE2(ul->un_ufsvfs, bp);
1219 mutex_exit(&ul->un_state_mutex);
1221 ldl_seterror(ul, "Error writing ufs log state");
1229 ldl_sethead(ml_unit_t *ul, off_t data_lof, uint32_t tid)
1237 ASSERT(MUTEX_HELD(&ul->un_log_mutex));
1241 new_ident = lufs_hd_genid(ul);
1242 new_lof = ul->un_tail_lof;
1246 new_ident = ul->un_head_ident;
1254 if (new_lof < ul->un_bol_lof) {
1258 new_lof += (ul->un_eol_lof - DEV_BSIZE);
1260 ul->un_head_tid = tid;
1266 if (new_lof == ul->un_head_lof)
1272 if (new_lof > ul->un_head_lof) {
1273 nb = new_lof - ul->un_head_lof;
1274 inval_range(ul, &ul->un_wrbuf, ul->un_head_lof, nb);
1275 inval_range(ul, &ul->un_rdbuf, ul->un_head_lof, nb);
1278 beg_blkno = btodb(ul->un_head_lof);
1281 nb = ul->un_eol_lof - ul->un_head_lof;
1282 inval_range(ul, &ul->un_wrbuf, ul->un_head_lof, nb);
1283 inval_range(ul, &ul->un_rdbuf, ul->un_head_lof, nb);
1285 end_blkno = btodb(ul->un_eol_lof);
1286 beg_blkno = btodb(ul->un_head_lof);
1289 nb = new_lof - ul->un_bol_lof;
1290 inval_range(ul, &ul->un_wrbuf, ul->un_bol_lof, nb);
1291 inval_range(ul, &ul->un_rdbuf, ul->un_bol_lof, nb);
1294 beg_blkno = btodb(ul->un_bol_lof);
1300 if (ul->un_flags & LDL_ERROR)
1304 ASSERT(new_lof >= ul->un_bol_lof);
1305 ul->un_head_lof = new_lof;
1306 ul->un_head_ident = new_ident;
1308 ul->un_tail_ident = ul->un_head_ident;
1313 ldl_savestate(ul);
1315 ASSERT(((ul->un_logmap->mtm_debug & MT_SCAN) == 0) ||
1316 ldl_sethead_debug(ul));
1325 ldl_settail(ml_unit_t *ul, off_t lof, size_t nb)
1332 ASSERT(MUTEX_HELD(&ul->un_log_mutex));
1335 ul->un_tail_lof = dbtob(btodb(ul->un_head_lof));
1336 ul->un_head_lof = ul->un_tail_lof;
1337 ul->un_head_ident = lufs_hd_genid(ul);
1338 ul->un_tail_ident = ul->un_head_ident;
1341 ldl_savestate(ul);
1349 (void) logseek(ul, lof, nb, &new_lof);
1350 ASSERT(new_lof != dbtob(btodb(ul->un_head_lof)));
1355 if (new_lof > ul->un_head_lof) {
1357 beg_blkno = btodb(ul->un_head_lof);
1358 new_ident = ul->un_head_ident + (end_blkno - beg_blkno);
1360 end_blkno = btodb(ul->un_eol_lof);
1361 beg_blkno = btodb(ul->un_head_lof);
1362 new_ident = ul->un_head_ident + (end_blkno - beg_blkno);
1365 beg_blkno = btodb(ul->un_bol_lof);
1370 ul->un_tail_lof = new_lof;
1371 ul->un_tail_ident = new_ident;
1374 ldl_savestate(ul);
1381 ldl_logscan_ident(ml_unit_t *ul, buf_t *bp, off_t lof)
1390 ident = ul->un_head_ident;
1391 if (bp->b_blkno >= btodb(ul->un_head_lof)) {
1392 ident += (bp->b_blkno - btodb(ul->un_head_lof));
1394 ident += (btodb(ul->un_eol_lof) - btodb(ul->un_head_lof));
1395 ident += (bp->b_blkno - btodb(ul->un_bol_lof));
1409 ul->un_tid = st->st_tid;
1438 ldl_logscan_read(ml_unit_t *ul, off_t *lofp, size_t nb, caddr_t va)
1443 ASSERT(ul->un_head_lof != ul->un_tail_lof);
1448 if (ul->un_head_lof < ul->un_tail_lof) {
1449 if (!WITHIN(*lofp, nb, ul->un_head_lof,
1450 (ul->un_tail_lof - ul->un_head_lof))) {
1454 if (OVERLAP(*lofp, nb, ul->un_tail_lof,
1455 (ul->un_head_lof - ul->un_tail_lof))) {
1461 bp = get_read_bp(ul, *lofp);
1470 if (!ldl_logscan_ident(ul, bp, *lofp)) {
1477 actual = fetchbuf(ul, bp, va, nb, lofp);
1486 ldl_logscan_begin(ml_unit_t *ul)
1490 ASSERT(ul->un_wrbuf.cb_dirty == NULL);
1495 ul->un_flags |= LDL_SCAN;
1500 bufsize = ldl_bufsize(ul);
1501 alloc_rdbuf(&ul->un_rdbuf, bufsize, bufsize);
1502 alloc_wrbuf(&ul->un_wrbuf, bufsize);
1507 ul->un_tail_lof = dbtob(btodb(ul->un_head_lof)) - DEV_BSIZE;
1509 if (ul->un_tail_lof < ul->un_bol_lof)
1510 ul->un_tail_lof = ul->un_eol_lof - DEV_BSIZE;
1511 if (ul->un_tail_lof >= ul->un_eol_lof)
1512 ul->un_tail_lof = ul->un_bol_lof;
1518 ul->un_tid = ul->un_head_tid;
1522 ldl_logscan_end(ml_unit_t *ul)
1529 bufsize = ldl_bufsize(ul);
1530 alloc_rdbuf(&ul->un_rdbuf, MAPBLOCKSIZE, MAPBLOCKSIZE);
1531 alloc_wrbuf(&ul->un_wrbuf, bufsize);
1536 ul->un_flags &= ~LDL_SCAN;
1540 ldl_need_roll(ml_unit_t *ul)
1552 head = ul->un_head_lof;
1553 tail = ul->un_tail_lof;
1554 bol = ul->un_bol_lof;
1555 eol = ul->un_eol_lof;
1556 nb = ul->un_logsize;
1573 ldl_seterror(ml_unit_t *ul, char *why)
1578 if (ul->un_flags & LDL_ERROR)
1581 ul->un_flags |= LDL_ERROR; /* incore */
1582 ul->un_badlog = 1; /* ondisk (cleared by fsck) */
1587 uniqtime(&ul->un_timestamp);
1588 ldl_savestate(ul);
1593 ul->un_ufsvfs->vfs_fs->fs_fsmnt);
1595 ul->un_ufsvfs->vfs_fs->fs_fsmnt);
1601 if ((ul->un_flags & LDL_SCAN) == 0)
1606 ldl_bufsize(ml_unit_t *ul)
1616 bufsize = dbtob(btod(ul->un_maxtransfer));
1621 if (bufsize > ul->un_maxtransfer)
1622 bufsize = ul->un_maxtransfer;