Lines Matching refs:bp

188 static void lbmFree(struct lbuf * bp);
189 static void lbmfree(struct lbuf * bp);
191 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, int cant_block);
192 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag);
193 static int lbmIOWait(struct lbuf * bp, int flag);
195 static void lbmStartIO(struct lbuf * bp);
361 struct lbuf *bp; /* dst log page buffer */ in lmWriteRecord() local
380 bp = (struct lbuf *) log->bp; in lmWriteRecord()
381 lp = (struct logpage *) bp->l_ldata; in lmWriteRecord()
431 bp = log->bp; in lmWriteRecord()
432 lp = (struct logpage *) bp->l_ldata; in lmWriteRecord()
456 bp = (struct lbuf *) log->bp; in lmWriteRecord()
457 lp = (struct logpage *) bp->l_ldata; in lmWriteRecord()
509 bp->l_eor = dstoffset; in lmWriteRecord()
515 bp->l_eor); in lmWriteRecord()
531 tblk->bp = log->bp; in lmWriteRecord()
542 le16_to_cpu(lrd->type), log->bp, log->page, dstoffset); in lmWriteRecord()
552 bp = (struct lbuf *) log->bp; in lmWriteRecord()
553 lp = (struct logpage *) bp->l_ldata; in lmWriteRecord()
578 struct lbuf *bp; in lmNextPage() local
584 bp = log->bp; in lmNextPage()
585 lp = (struct logpage *) bp->l_ldata; in lmNextPage()
620 if (bp->l_wqnext == NULL) in lmNextPage()
621 lbmWrite(log, bp, 0, 0); in lmNextPage()
635 bp->l_ceor = bp->l_eor; in lmNextPage()
636 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_ceor); in lmNextPage()
637 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE, 0); in lmNextPage()
653 log->bp = nextbp; in lmNextPage()
760 struct lbuf *bp; in lmGCwrite() local
789 bp = (struct lbuf *) tblk->bp; in lmGCwrite()
790 lp = (struct logpage *) bp->l_ldata; in lmGCwrite()
796 bp->l_ceor = bp->l_eor; in lmGCwrite()
797 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_ceor); in lmGCwrite()
798 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmGC, in lmGCwrite()
804 bp->l_ceor = tblk->eor; /* ? bp->l_ceor = bp->l_eor; */ in lmGCwrite()
805 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_ceor); in lmGCwrite()
806 lbmWrite(log, bp, lbmWRITE | lbmGC, cant_write); in lmGCwrite()
823 static void lmPostGC(struct lbuf * bp) in lmPostGC() argument
826 struct jfs_log *log = bp->l_log; in lmPostGC()
846 if (bp->l_flag & lbmERROR) in lmPostGC()
881 lbmFree(bp); in lmPostGC()
887 lp = (struct logpage *) bp->l_ldata; in lmPostGC()
888 bp->l_ceor = bp->l_eor; in lmPostGC()
889 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor); in lmPostGC()
891 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE, in lmPostGC()
905 ((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) || in lmPostGC()
1268 struct lbuf *bp; in lmLogInit() local
1305 bp = lbmAllocate(log , 0); in lmLogInit()
1306 log->bp = bp; in lmLogInit()
1307 bp->l_pn = bp->l_eor = 0; in lmLogInit()
1358 if ((rc = lbmRead(log, log->page, &bp))) in lmLogInit()
1361 lp = (struct logpage *) bp->l_ldata; in lmLogInit()
1367 log->bp = bp; in lmLogInit()
1368 bp->l_pn = log->page; in lmLogInit()
1369 bp->l_eor = log->eor; in lmLogInit()
1391 bp = log->bp; in lmLogInit()
1392 bp->l_ceor = bp->l_eor; in lmLogInit()
1393 lp = (struct logpage *) bp->l_ldata; in lmLogInit()
1394 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor); in lmLogInit()
1395 lbmWrite(log, bp, lbmWRITE | lbmSYNC, 0); in lmLogInit()
1396 if ((rc = lbmIOWait(bp, 0))) in lmLogInit()
1432 bp->l_wqnext = NULL; in lmLogInit()
1433 lbmFree(bp); in lmLogInit()
1661 struct lbuf *bp; in lmLogShutdown() local
1679 bp = log->bp; in lmLogShutdown()
1680 lp = (struct logpage *) bp->l_ldata; in lmLogShutdown()
1681 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor); in lmLogShutdown()
1682 lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0); in lmLogShutdown()
1683 lbmIOWait(log->bp, lbmFREE); in lmLogShutdown()
1684 log->bp = NULL; in lmLogShutdown()
1817 log->bp = NULL; in lbmLogInit()
1901 struct lbuf *bp; in lbmAllocate() local
1908 LCACHE_SLEEP_COND(log->free_wait, (bp = log->lbuf_free), flags); in lbmAllocate()
1909 log->lbuf_free = bp->l_freelist; in lbmAllocate()
1912 bp->l_flag = 0; in lbmAllocate()
1914 bp->l_wqnext = NULL; in lbmAllocate()
1915 bp->l_freelist = NULL; in lbmAllocate()
1917 bp->l_pn = pn; in lbmAllocate()
1918 bp->l_blkno = log->base + (pn << (L2LOGPSIZE - log->l2bsize)); in lbmAllocate()
1919 bp->l_ceor = 0; in lbmAllocate()
1921 return bp; in lbmAllocate()
1930 static void lbmFree(struct lbuf * bp) in lbmFree() argument
1936 lbmfree(bp); in lbmFree()
1941 static void lbmfree(struct lbuf * bp) in lbmfree() argument
1943 struct jfs_log *log = bp->l_log; in lbmfree()
1945 assert(bp->l_wqnext == NULL); in lbmfree()
1950 bp->l_freelist = log->lbuf_free; in lbmfree()
1951 log->lbuf_free = bp; in lbmfree()
1969 static inline void lbmRedrive(struct lbuf *bp) in lbmRedrive() argument
1974 bp->l_redrive_next = log_redrive_list; in lbmRedrive()
1975 log_redrive_list = bp; in lbmRedrive()
1988 struct lbuf *bp; in lbmRead() local
1993 *bpp = bp = lbmAllocate(log, pn); in lbmRead()
1994 jfs_info("lbmRead: bp:0x%p pn:0x%x", bp, pn); in lbmRead()
1996 bp->l_flag |= lbmREAD; in lbmRead()
2000 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); in lbmRead()
2002 bio->bi_io_vec[0].bv_page = bp->l_page; in lbmRead()
2004 bio->bi_io_vec[0].bv_offset = bp->l_offset; in lbmRead()
2010 bio->bi_private = bp; in lbmRead()
2019 wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD)); in lbmRead()
2040 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, in lbmWrite() argument
2046 jfs_info("lbmWrite: bp:0x%p flag:0x%x pn:0x%x", bp, flag, bp->l_pn); in lbmWrite()
2049 bp->l_blkno = in lbmWrite()
2050 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize)); in lbmWrite()
2057 bp->l_flag = flag; in lbmWrite()
2068 if (bp->l_wqnext == NULL) { in lbmWrite()
2071 log->wqueue = bp; in lbmWrite()
2072 bp->l_wqnext = bp; in lbmWrite()
2074 log->wqueue = bp; in lbmWrite()
2075 bp->l_wqnext = tail->l_wqnext; in lbmWrite()
2076 tail->l_wqnext = bp; in lbmWrite()
2079 tail = bp; in lbmWrite()
2083 if ((bp != tail->l_wqnext) || !(flag & lbmWRITE)) { in lbmWrite()
2091 lbmRedrive(bp); in lbmWrite()
2093 lbmStartIO(bp); in lbmWrite()
2096 lbmStartIO(bp); in lbmWrite()
2108 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag) in lbmDirectWrite() argument
2111 bp, flag, bp->l_pn); in lbmDirectWrite()
2116 bp->l_flag = flag | lbmDIRECT; in lbmDirectWrite()
2119 bp->l_blkno = in lbmDirectWrite()
2120 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize)); in lbmDirectWrite()
2125 lbmStartIO(bp); in lbmDirectWrite()
2138 static void lbmStartIO(struct lbuf * bp) in lbmStartIO() argument
2141 struct jfs_log *log = bp->l_log; in lbmStartIO()
2146 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); in lbmStartIO()
2148 bio->bi_io_vec[0].bv_page = bp->l_page; in lbmStartIO()
2150 bio->bi_io_vec[0].bv_offset = bp->l_offset; in lbmStartIO()
2156 bio->bi_private = bp; in lbmStartIO()
2172 static int lbmIOWait(struct lbuf * bp, int flag) in lbmIOWait() argument
2177 jfs_info("lbmIOWait1: bp:0x%p flag:0x%x:0x%x", bp, bp->l_flag, flag); in lbmIOWait()
2181 LCACHE_SLEEP_COND(bp->l_ioevent, (bp->l_flag & lbmDONE), flags); in lbmIOWait()
2183 rc = (bp->l_flag & lbmERROR) ? -EIO : 0; in lbmIOWait()
2186 lbmfree(bp); in lbmIOWait()
2190 jfs_info("lbmIOWait2: bp:0x%p flag:0x%x:0x%x", bp, bp->l_flag, flag); in lbmIOWait()
2201 struct lbuf *bp = bio->bi_private; in lbmIODone() local
2209 jfs_info("lbmIODone: bp:0x%p flag:0x%x", bp, bp->l_flag); in lbmIODone()
2213 bp->l_flag |= lbmDONE; in lbmIODone()
2216 bp->l_flag |= lbmERROR; in lbmIODone()
2226 if (bp->l_flag & lbmREAD) { in lbmIODone()
2227 bp->l_flag &= ~lbmREAD; in lbmIODone()
2232 LCACHE_WAKEUP(&bp->l_ioevent); in lbmIODone()
2249 bp->l_flag &= ~lbmWRITE; in lbmIODone()
2253 log = bp->l_log; in lbmIODone()
2254 log->clsn = (bp->l_pn << L2LOGPSIZE) + bp->l_ceor; in lbmIODone()
2256 if (bp->l_flag & lbmDIRECT) { in lbmIODone()
2257 LCACHE_WAKEUP(&bp->l_ioevent); in lbmIODone()
2265 if (bp == tail) { in lbmIODone()
2269 if (bp->l_flag & lbmRELEASE) { in lbmIODone()
2271 bp->l_wqnext = NULL; in lbmIODone()
2279 if (bp->l_flag & lbmRELEASE) { in lbmIODone()
2280 nextbp = tail->l_wqnext = bp->l_wqnext; in lbmIODone()
2281 bp->l_wqnext = NULL; in lbmIODone()
2310 if (bp->l_flag & lbmSYNC) { in lbmIODone()
2314 LCACHE_WAKEUP(&bp->l_ioevent); in lbmIODone()
2320 else if (bp->l_flag & lbmGC) { in lbmIODone()
2322 lmPostGC(bp); in lbmIODone()
2332 assert(bp->l_flag & lbmRELEASE); in lbmIODone()
2333 assert(bp->l_flag & lbmFREE); in lbmIODone()
2334 lbmfree(bp); in lbmIODone()
2342 struct lbuf *bp; in jfsIOWait() local
2346 while ((bp = log_redrive_list)) { in jfsIOWait()
2347 log_redrive_list = bp->l_redrive_next; in jfsIOWait()
2348 bp->l_redrive_next = NULL; in jfsIOWait()
2350 lbmStartIO(bp); in jfsIOWait()
2393 struct lbuf *bp; in lmLogFormat() local
2401 bp = lbmAllocate(log, 1); in lmLogFormat()
2417 logsuper = (struct logsuper *) bp->l_ldata; in lmLogFormat()
2428 bp->l_flag = lbmWRITE | lbmSYNC | lbmDIRECT; in lmLogFormat()
2429 bp->l_blkno = logAddress + sbi->nbperpage; in lmLogFormat()
2430 lbmStartIO(bp); in lmLogFormat()
2431 if ((rc = lbmIOWait(bp, 0))) in lmLogFormat()
2456 lp = (struct logpage *) bp->l_ldata; in lmLogFormat()
2471 bp->l_blkno += sbi->nbperpage; in lmLogFormat()
2472 bp->l_flag = lbmWRITE | lbmSYNC | lbmDIRECT; in lmLogFormat()
2473 lbmStartIO(bp); in lmLogFormat()
2474 if ((rc = lbmIOWait(bp, 0))) in lmLogFormat()
2484 bp->l_blkno += sbi->nbperpage; in lmLogFormat()
2485 bp->l_flag = lbmWRITE | lbmSYNC | lbmDIRECT; in lmLogFormat()
2486 lbmStartIO(bp); in lmLogFormat()
2487 if ((rc = lbmIOWait(bp, 0))) in lmLogFormat()
2497 lbmFree(bp); in lmLogFormat()