Lines Matching refs:BP
197 struct buf *bp, *nbp;
242 for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
243 nbp = LIST_NEXT(bp, b_vnbufs);
245 KASSERT((bp->b_flags & B_GATHERED) == 0);
246 if (bp->b_oflags & BO_DELWRI) { /* XXX always true? */
247 lfs_sb_addavail(fs, lfs_btofsb(fs, bp->b_bcount));
251 if (bp->b_iodone != NULL) {
253 biodone(bp);
256 bremfree(bp);
257 LFS_UNLOCK_BUF(bp);
259 bp->b_flags &= ~(B_READ | B_GATHERED);
260 bp->b_oflags = (bp->b_oflags & ~BO_DELWRI) | BO_DONE;
261 bp->b_error = 0;
262 reassignbuf(bp, vp);
264 brelse(bp, 0);
526 struct buf *bp;
633 lfs_sb_getbsize(fs), B_MODIFY, &bp);
638 segusep = (SEGUSE *)bp->b_data;
658 error = LFS_BWRITE_LOG(bp); /* Ifile */
660 brelse(bp, 0);
730 LIST_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) {
731 if (bp->b_lblkno < lfs_sb_getcleansz(fs) +
733 !(bp->b_flags & B_GATHERED)) {
735 (long)bp->b_lblkno,
736 (long)bp->b_flags);
884 struct buf *bp;
903 LFS_IENTRY(ifp, fs, ino, bp);
906 (void)LFS_BWRITE_LOG(bp); /* Ifile */
918 LFS_SEGENTRY(sup, fs, sn, bp);
919 KASSERT(bp->b_oflags & BO_DELWRI);
920 LFS_WRITESEGENTRY(sup, fs, sn, bp);
951 LFS_SEGENTRY(sup, fs, oldsn, bp);
968 (ino == LFS_IFILE_INUM && !(bp->b_flags & B_GATHERED));
976 LFS_WRITESEGENTRY(sup, fs, oldsn, bp); /* Ifile */
985 struct buf *bp;
1022 LIST_FOREACH(bp, &fs->lfs_ivnode->v_dirtyblkhd, b_vnbufs) {
1023 if (!(bp->b_flags & B_GATHERED)) {
1097 * XXX we know that the bp that we get the second time around has
1106 bp = sp->ibp;
1107 cdp = DINO_IN_BLOCK(fs, bp->b_data, sp->ninodes % LFS_INOPB(fs));
1220 sp->idp = DINO_IN_BLOCK(fs, bp, sp->ninodes % LFS_INOPB(fs));
1230 LFS_LOCK_BUF(bp);
1231 brelsel(bp, 0);
1244 redo_ifile = lfs_update_iaddr(fs, sp, ip, bp->b_blkno);
1251 lfs_gatherblock(struct segment *sp, struct buf *bp, kmutex_t *mptr)
1258 KASSERT(bp->b_vp != NULL);
1274 blksinblk = howmany(bp->b_bcount, lfs_sb_getbsize(fs));
1276 sp->seg_bytes_left < bp->b_bcount) {
1294 if (bp->b_flags & B_GATHERED) {
1297 (uintmax_t)lfs_fi_getino(fs, sp->fip), bp->b_lblkno));
1302 bp->b_flags |= B_GATHERED;
1304 *sp->cbpp++ = bp;
1310 lfs_fi_setblock(fs, sp->fip, bn, bp->b_lblkno + j);
1312 lfs_deregister_block(sp->vp, bp->b_lblkno + j);
1316 sp->seg_bytes_left -= bp->b_bcount;
1328 struct buf *bp, *nbp;
1336 for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
1337 KASSERT(bp->b_vp == vp);
1338 nbp = LIST_NEXT(bp, b_vnbufs);
1339 if (!match(fs, bp))
1341 error = bbusy(bp, false, hz / 10 + 1, NULL);
1348 brelsel(bp, BC_INVAL | BC_VFLUSH);
1360 struct buf *bp, *nbp;
1373 (((char *)&LIST_NEXT(bp, b_vnbufs)) - (char *)bp)
1374 # define BACK_BUF(BP) \
1375 ((struct buf *)(((char *)(BP)->b_vnbufs.le_prev) - BUF_OFFSET))
1381 for (bp = LIST_FIRST(&vp->v_dirtyblkhd);
1382 bp && LIST_NEXT(bp, b_vnbufs) != NULL;
1383 bp = LIST_NEXT(bp, b_vnbufs))
1386 for (; bp && bp != BEG_OF_LIST; bp = nbp) {
1387 nbp = BACK_BUF(bp);
1390 for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
1391 nbp = LIST_NEXT(bp, b_vnbufs);
1393 if ((bp->b_cflags & BC_BUSY) != 0 ||
1394 (bp->b_flags & B_GATHERED) != 0 || !match(fs, bp)) {
1397 (bp->b_cflags & BC_BUSY) != 0 &&
1398 (bp->b_flags & B_GATHERED) == 0)
1401 bp->b_lblkno, bp->b_flags,
1408 if ((bp->b_cflags & BC_INVAL) != 0 && bp->b_iodone == NULL) {
1410 " is BC_INVAL\n", bp->b_lblkno));
1411 VOP_PRINT(bp->b_vp);
1414 if (!(bp->b_oflags & BO_DELWRI))
1415 panic("lfs_gather: bp not BO_DELWRI");
1416 if (!(bp->b_flags & B_LOCKED)) {
1419 bp->b_lblkno,
1420 LFS_DBTOFSB(fs, bp->b_blkno)));
1421 VOP_PRINT(bp->b_vp);
1422 panic("lfs_gather: bp not B_LOCKED");
1425 if (lfs_gatherblock(sp, bp, &bufcache_lock)) {
1465 struct buf *bp;
1515 B_MODIFY, &bp))
1519 ooff = lfs_iblock_get(fs, bp->b_data, ap->in_off);
1524 lfs_iblock_set(fs, bp->b_data, ap->in_off, ndaddr);
1525 (void) VOP_BWRITE(bp->b_vp, bp);
1554 LFS_SEGENTRY(sup, fs, oldsn, bp);
1571 if (!(bp->b_flags & B_GATHERED)) {
1576 LFS_WRITESEGENTRY(sup, fs, oldsn, bp);
1743 struct buf *bp;
1757 LFS_SEGENTRY(sup, fs, sn, bp);
1759 brelse(bp, 0);
1789 struct buf *bp;
1810 LFS_SEGENTRY(sup, fs, sp->seg_number, bp);
1815 brelse(bp, 0);
1893 struct buf *bp;
1895 LFS_SEGENTRY(sup, fs, sn, bp);
1897 brelse(bp, 0);
1902 VOP_BWRITE(bp->b_vp, bp);
1913 struct buf *bp;
1917 LFS_SEGENTRY(sup, fs, i, bp);
1920 LFS_WRITESEGENTRY(sup, fs, i, bp);
1922 brelse(bp, 0);
1934 struct buf *bp;
1957 LFS_SEGENTRY(sup, fs, lfs_dtosn(fs, lfs_sb_getnextseg(fs)), bp);
1964 LFS_WRITESEGENTRY(sup, fs, lfs_dtosn(fs, lfs_sb_getnextseg(fs)), bp);
1966 LFS_CLEANERINFO(cip, fs, bp);
1969 LFS_SYNC_CLEANERINFO(cip, fs, bp, 1);
1983 LFS_SEGENTRY(sup, fs, sn, bp);
1988 LFS_WRITESEGENTRY(sup, fs, sn, bp);
1990 brelse(bp, 0);
2010 struct buf **bpp, *bp;
2029 bp = getiobuf(vp, true);
2030 bp->b_dev = NODEV;
2031 bp->b_blkno = bp->b_lblkno = addr;
2032 bp->b_iodone = lfs_cluster_aiodone;
2033 bp->b_private = cl;
2035 return bp;
2041 struct buf **bpp, *bp, *cbp, *newbp, *unbusybp;
2092 LFS_SEGENTRY(sup, fs, sp->seg_number, bp);
2131 do_again = !(bp->b_flags & B_GATHERED);
2132 LFS_WRITESEGENTRY(sup, fs, sp->seg_number, bp); /* Ifile */
2145 bp = *bpp;
2146 if (bp->b_iodone != NULL) { /* UBC or malloced buffer */
2147 bp->b_cflags |= BC_BUSY;
2151 while (bp->b_cflags & BC_BUSY) {
2155 VTOI(bp->b_vp)->i_number, bp->b_lblkno));
2156 bp->b_cflags |= BC_WANTED;
2157 cv_wait(&bp->b_busy, &bufcache_lock);
2159 bp->b_cflags |= BC_BUSY;
2167 if (bp->b_lblkno < 0 && bp->b_vp != devvp && bp->b_vp &&
2168 lfs_dino_getblocks(fs, VTOI(bp->b_vp)->i_din) !=
2169 VTOI(bp->b_vp)->i_lfs_effnblks) {
2171 VTOI(bp->b_vp)->i_number,
2172 (intmax_t)VTOI(bp->b_vp)->i_lfs_effnblks,
2173 lfs_dino_getblocks(fs, VTOI(bp->b_vp)->i_din)));
2175 newbp = lfs_newbuf(fs, bp->b_vp, bp->b_lblkno,
2176 bp->b_bcount, LFS_NB_IBLOCK);
2177 newbp->b_blkno = bp->b_blkno;
2178 memcpy(newbp->b_data, bp->b_data,
2196 " bp = %p newbp = %p\n", changed, bp,
2199 bp->b_flags &= ~B_GATHERED;
2200 bp->b_error = 0;
2201 if (bp->b_iodone != NULL) {
2203 "indir bp should not be B_CALL\n"));
2204 biodone(bp);
2205 bp = NULL;
2208 unbusybp = bp;
2216 lfs_btofsb(fs, bp->b_bcount));
2226 cv_broadcast(&bp->b_busy);
2321 bp = *bpp;
2323 if (bp->b_bcount > (CHUNKSIZE - cbp->b_bcount))
2329 if (bp->b_bcount > lfs_sb_getbsize(fs)) {
2334 cbp->b_data = bp->b_data;
2341 KASSERTMSG((lfs_dtosn(fs, LFS_DBTOFSB(fs, bp->b_blkno +
2342 btodb(bp->b_bcount - 1))) ==
2346 bp->b_bcount, bp->b_blkno,
2356 if ((bp->b_cflags & BC_INVAL) != 0 &&
2357 bp->b_iodone != NULL) {
2358 if (copyin(bp->b_saveaddr, p, bp->b_bcount))
2365 memcpy(p, bp->b_data, bp->b_bcount);
2366 p += bp->b_bcount;
2369 cbp->b_bcount += bp->b_bcount;
2370 cl->bufsize += bp->b_bcount;
2372 bp->b_flags &= ~B_READ;
2373 bp->b_error = 0;
2374 cl->bpp[cl->bufcount++] = bp;
2376 vp = bp->b_vp;
2379 bp->b_oflags &= ~(BO_DELWRI | BO_DONE);
2380 reassignbuf(bp, vp);
2417 struct buf *bp;
2449 bp = lfs_newbuf(fs, devvp,
2451 memcpy(bp->b_data, &fs->lfs_dlfs_u, sizeof(struct dlfs));
2452 memset((char *)bp->b_data + sizeof(struct dlfs), 0,
2455 bp->b_cflags |= BC_BUSY;
2456 bp->b_flags = (bp->b_flags & ~B_READ) | B_ASYNC;
2457 bp->b_oflags &= ~(BO_DONE | BO_DELWRI);
2458 bp->b_error = 0;
2459 bp->b_iodone = lfs_super_aiodone;
2462 BIO_SETPRIO(bp, BPRIO_TIMECRITICAL);
2464 BIO_SETPRIO(bp, BPRIO_TIMELIMITED);
2474 VOP_STRATEGY(devvp, bp);
2482 lfs_match_fake(struct lfs *fs, struct buf *bp)
2486 return LFS_IS_MALLOC_BUF(bp);
2491 lfs_match_real(struct lfs *fs, struct buf *bp)
2495 return (lfs_match_data(fs, bp) && !lfs_match_fake(fs, bp));
2500 lfs_match_data(struct lfs *fs, struct buf *bp)
2504 return (bp->b_lblkno >= 0);
2508 lfs_match_indir(struct lfs *fs, struct buf *bp)
2513 lbn = bp->b_lblkno;
2518 lfs_match_dindir(struct lfs *fs, struct buf *bp)
2523 lbn = bp->b_lblkno;
2528 lfs_match_tindir(struct lfs *fs, struct buf *bp)
2533 lbn = bp->b_lblkno;
2538 lfs_free_aiodone(struct buf *bp)
2542 fs = bp->b_private;
2544 lfs_freebuf(fs, bp);
2548 lfs_super_aiodone(struct buf *bp)
2550 workqueue_enqueue(lfs_super_wq, (struct work *)bp, NULL);
2556 struct buf *bp = (struct buf *)wk;
2559 fs = bp->b_private;
2567 lfs_freebuf(fs, bp);
2571 lfs_cluster_aiodone(struct buf *bp)
2573 workqueue_enqueue(lfs_cluster_wq, (struct work *)bp, NULL);
2579 struct buf *bp = (struct buf *)wk;
2587 error = bp->b_error;
2588 cl = bp->b_private;
2698 lfs_free(fs, bp->b_data, LFS_NB_CLUSTER);
2699 putiobuf(bp);
2751 const struct buf *bp = bp_array[t1];
2753 printf("bp[%d]: lbn=%" PRIu64 ", size=%"
2755 (uint64_t)bp->b_bcount,
2756 (uint64_t)bp->b_lblkno);
2758 for (t2 = 0; t2 * size < bp->b_bcount;