Lines Matching refs:bp

51 static int bp_copy_common(bp_copydir_t dir, struct buf *bp, void *driverbuf,
82 bp_mapin_common(struct buf *bp, int flag) in bp_mapin_common() argument
97 if ((bp->b_flags & B_REMAPPED) || in bp_mapin_common()
98 !(bp->b_flags & (B_PAGEIO | B_PHYS)) || in bp_mapin_common()
99 (((bp->b_flags & (B_PAGEIO | B_PHYS)) == B_PHYS) && in bp_mapin_common()
100 ((bp->b_proc == NULL) || (bp->b_proc->p_as == &kas)))) in bp_mapin_common()
101 return (bp->b_un.b_addr); in bp_mapin_common()
103 ASSERT((bp->b_flags & (B_PAGEIO | B_PHYS)) != (B_PAGEIO | B_PHYS)); in bp_mapin_common()
105 addr = (caddr_t)bp->b_un.b_addr; in bp_mapin_common()
107 size = P2ROUNDUP(bp->b_bcount + off, PAGESIZE); in bp_mapin_common()
111 if ((bp->b_flags & (B_SHADOW | B_PAGEIO)) && (npages == 1) && in bp_mapin_common()
113 if (bp->b_flags & B_SHADOW) in bp_mapin_common()
114 pp = *bp->b_shadow; in bp_mapin_common()
116 pp = bp->b_pages; in bp_mapin_common()
118 bp->b_un.b_addr = kaddr + off; in bp_mapin_common()
119 bp->b_flags |= B_REMAPPED; in bp_mapin_common()
120 return (bp->b_un.b_addr); in bp_mapin_common()
126 color = bp_color(bp); in bp_mapin_common()
147 if (bp->b_flags & B_PAGEIO) { in bp_mapin_common()
148 pp = bp->b_pages; in bp_mapin_common()
150 } else if (bp->b_flags & B_SHADOW) { in bp_mapin_common()
152 pplist = bp->b_shadow; in bp_mapin_common()
156 if (bp->b_proc == NULL || (as = bp->b_proc->p_as) == NULL) in bp_mapin_common()
160 bp->b_flags |= B_REMAPPED; in bp_mapin_common()
161 bp->b_un.b_addr = kaddr + off; in bp_mapin_common()
184 return (bp->b_un.b_addr); in bp_mapin_common()
191 bp_mapin(struct buf *bp) in bp_mapin() argument
193 (void) bp_mapin_common(bp, VM_SLEEP); in bp_mapin()
200 bp_mapout(struct buf *bp) in bp_mapout() argument
210 if ((bp->b_flags & B_REMAPPED) == 0) in bp_mapout()
213 addr = bp->b_un.b_addr; in bp_mapout()
215 size = P2ROUNDUP(bp->b_bcount + off, PAGESIZE); in bp_mapout()
218 bp->b_un.b_addr = (caddr_t)off; /* debugging aid */ in bp_mapout()
220 if ((bp->b_flags & (B_SHADOW | B_PAGEIO)) && (npages == 1) && in bp_mapout()
222 if (bp->b_flags & B_SHADOW) in bp_mapout()
223 pp = *bp->b_shadow; in bp_mapout()
225 pp = bp->b_pages; in bp_mapout()
228 bp->b_flags &= ~B_REMAPPED; in bp_mapout()
242 bp->b_flags &= ~B_REMAPPED; in bp_mapout()
250 bp_copyout(void *driverbuf, struct buf *bp, offset_t offset, size_t size) in bp_copyout() argument
252 return (bp_copy_common(BP_COPYOUT, bp, driverbuf, offset, size)); in bp_copyout()
260 bp_copyin(struct buf *bp, void *driverbuf, offset_t offset, size_t size) in bp_copyin() argument
262 return (bp_copy_common(BP_COPYIN, bp, driverbuf, offset, size)); in bp_copyin()
271 bp_copy_common(bp_copydir_t dir, struct buf *bp, void *driverbuf, in bp_copy_common() argument
285 ASSERT((offset + size) <= bp->b_bcount); in bp_copy_common()
289 if (!(bp->b_flags & (B_PHYS | B_PAGEIO))) { in bp_copy_common()
290 BP_COPY(dir, driverbuf, bp->b_un.b_addr + offset, size); in bp_copy_common()
296 bp_mapin(bp); in bp_copy_common()
297 BP_COPY(dir, driverbuf, bp->b_un.b_addr + offset, size); in bp_copy_common()
298 bp_mapout(bp); in bp_copy_common()
307 if (bp->b_flags & B_PAGEIO) { in bp_copy_common()
308 pp = bp->b_pages; in bp_copy_common()
310 } else if (bp->b_flags & B_SHADOW) { in bp_copy_common()
312 pplist = bp->b_shadow; in bp_copy_common()
316 if (bp->b_proc == NULL || (as = bp->b_proc->p_as) == NULL) { in bp_copy_common()
325 addr = (caddr_t)bp->b_un.b_addr; in bp_copy_common()