Lines Matching refs:bp

107 	BUFHEAD *bp;  in __get_buf()  local
115 bp = prev_bp->ovfl; in __get_buf()
116 if (!bp || (bp->addr != addr)) in __get_buf()
117 bp = NULL; in __get_buf()
129 bp = PTROF(segp[segment_ndx]); in __get_buf()
134 if (!bp) { in __get_buf()
135 bp = newbuf(hashp, addr, prev_bp); in __get_buf()
136 if (!bp || in __get_buf()
137 __get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0)) in __get_buf()
141 (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask); in __get_buf()
143 BUF_REMOVE(bp); in __get_buf()
144 MRU_INSERT(bp); in __get_buf()
146 return (bp); in __get_buf()
158 BUFHEAD *bp; /* The buffer we're going to use */ in newbuf() local
166 bp = LRU; in newbuf()
169 if (bp == hashp->cpage) { in newbuf()
170 BUF_REMOVE(bp); in newbuf()
171 MRU_INSERT(bp); in newbuf()
172 bp = LRU; in newbuf()
176 if (hashp->nbufs == 0 && prev_bp && bp->ovfl) { in newbuf()
179 for (ovfl = bp->ovfl; ovfl ; ovfl = ovfl->ovfl) { in newbuf()
191 if (hashp->nbufs || (bp->flags & BUF_PIN) || bp == hashp->cpage) { in newbuf()
193 if ((bp = (BUFHEAD *)calloc(1, sizeof(BUFHEAD))) == NULL) in newbuf()
195 if ((bp->page = (char *)calloc(1, hashp->BSIZE)) == NULL) { in newbuf()
196 free(bp); in newbuf()
203 BUF_REMOVE(bp); in newbuf()
208 if ((bp->addr != 0) || (bp->flags & BUF_BUCKET)) { in newbuf()
213 shortp = (u_int16_t *)bp->page; in newbuf()
216 if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page, in newbuf()
217 bp->addr, (int)IS_BUCKET(bp->flags), 0)) in newbuf()
227 if (IS_BUCKET(bp->flags)) { in newbuf()
228 segment_ndx = bp->addr & (hashp->SGSIZE - 1); in newbuf()
229 segp = hashp->dir[bp->addr >> hashp->SSHIFT]; in newbuf()
235 ((bp->flags & BUF_MOD) || in newbuf()
246 for (xbp = bp; xbp->ovfl;) { in newbuf()
272 bp->addr = addr; in newbuf()
275 bp->addr, (bp->ovfl ? bp->ovfl->addr : 0), 0); in newbuf()
277 bp->ovfl = NULL; in newbuf()
286 (bp ? bp->addr : 0)); in newbuf()
288 prev_bp->ovfl = bp; in newbuf()
289 bp->flags = 0; in newbuf()
291 bp->flags = BUF_BUCKET; in newbuf()
292 MRU_INSERT(bp); in newbuf()
293 return (bp); in newbuf()
322 BUFHEAD *bp; in __buf_free() local
327 for (bp = LRU; bp != &hashp->bufhead;) { in __buf_free()
329 if (bp->addr || IS_BUCKET(bp->flags)) { in __buf_free()
330 if (to_disk && (bp->flags & BUF_MOD) && in __buf_free()
331 __put_page(hashp, bp->page, in __buf_free()
332 bp->addr, IS_BUCKET(bp->flags), 0)) in __buf_free()
337 if (bp->page) { in __buf_free()
338 (void)memset(bp->page, 0, hashp->BSIZE); in __buf_free()
339 free(bp->page); in __buf_free()
341 BUF_REMOVE(bp); in __buf_free()
342 free(bp); in __buf_free()
343 bp = LRU; in __buf_free()
345 bp = bp->prev; in __buf_free()
351 __reclaim_buf(HTAB *hashp, BUFHEAD *bp) in __reclaim_buf() argument
353 bp->ovfl = 0; in __reclaim_buf()
354 bp->addr = 0; in __reclaim_buf()
355 bp->flags = 0; in __reclaim_buf()
356 BUF_REMOVE(bp); in __reclaim_buf()
357 LRU_INSERT(bp); in __reclaim_buf()