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()
2003 bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); in lbmRead()
2007 bio->bi_private = bp; in lbmRead()
2016 wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD)); in lbmRead()
2037 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, in lbmWrite() argument
2043 jfs_info("lbmWrite: bp:0x%p flag:0x%x pn:0x%x", bp, flag, bp->l_pn); in lbmWrite()
2046 bp->l_blkno = in lbmWrite()
2047 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize)); in lbmWrite()
2054 bp->l_flag = flag; in lbmWrite()
2065 if (bp->l_wqnext == NULL) { in lbmWrite()
2068 log->wqueue = bp; in lbmWrite()
2069 bp->l_wqnext = bp; in lbmWrite()
2071 log->wqueue = bp; in lbmWrite()
2072 bp->l_wqnext = tail->l_wqnext; in lbmWrite()
2073 tail->l_wqnext = bp; in lbmWrite()
2076 tail = bp; in lbmWrite()
2080 if ((bp != tail->l_wqnext) || !(flag & lbmWRITE)) { in lbmWrite()
2088 lbmRedrive(bp); in lbmWrite()
2090 lbmStartIO(bp); in lbmWrite()
2093 lbmStartIO(bp); in lbmWrite()
2105 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag) in lbmDirectWrite() argument
2108 bp, flag, bp->l_pn); in lbmDirectWrite()
2113 bp->l_flag = flag | lbmDIRECT; in lbmDirectWrite()
2116 bp->l_blkno = in lbmDirectWrite()
2117 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize)); in lbmDirectWrite()
2122 lbmStartIO(bp); in lbmDirectWrite()
2135 static void lbmStartIO(struct lbuf * bp) in lbmStartIO() argument
2138 struct jfs_log *log = bp->l_log; in lbmStartIO()
2143 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); in lbmStartIO()
2146 bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); in lbmStartIO()
2150 bio->bi_private = bp; in lbmStartIO()
2166 static int lbmIOWait(struct lbuf * bp, int flag) in lbmIOWait() argument
2171 jfs_info("lbmIOWait1: bp:0x%p flag:0x%x:0x%x", bp, bp->l_flag, flag); in lbmIOWait()
2175 LCACHE_SLEEP_COND(bp->l_ioevent, (bp->l_flag & lbmDONE), flags); in lbmIOWait()
2177 rc = (bp->l_flag & lbmERROR) ? -EIO : 0; in lbmIOWait()
2180 lbmfree(bp); in lbmIOWait()
2184 jfs_info("lbmIOWait2: bp:0x%p flag:0x%x:0x%x", bp, bp->l_flag, flag); in lbmIOWait()
2195 struct lbuf *bp = bio->bi_private; in lbmIODone() local
2203 jfs_info("lbmIODone: bp:0x%p flag:0x%x", bp, bp->l_flag); in lbmIODone()
2207 bp->l_flag |= lbmDONE; in lbmIODone()
2210 bp->l_flag |= lbmERROR; in lbmIODone()
2220 if (bp->l_flag & lbmREAD) { in lbmIODone()
2221 bp->l_flag &= ~lbmREAD; in lbmIODone()
2226 LCACHE_WAKEUP(&bp->l_ioevent); in lbmIODone()
2243 bp->l_flag &= ~lbmWRITE; in lbmIODone()
2247 log = bp->l_log; in lbmIODone()
2248 log->clsn = (bp->l_pn << L2LOGPSIZE) + bp->l_ceor; in lbmIODone()
2250 if (bp->l_flag & lbmDIRECT) { in lbmIODone()
2251 LCACHE_WAKEUP(&bp->l_ioevent); in lbmIODone()
2259 if (bp == tail) { in lbmIODone()
2263 if (bp->l_flag & lbmRELEASE) { in lbmIODone()
2265 bp->l_wqnext = NULL; in lbmIODone()
2273 if (bp->l_flag & lbmRELEASE) { in lbmIODone()
2274 nextbp = tail->l_wqnext = bp->l_wqnext; in lbmIODone()
2275 bp->l_wqnext = NULL; in lbmIODone()
2304 if (bp->l_flag & lbmSYNC) { in lbmIODone()
2308 LCACHE_WAKEUP(&bp->l_ioevent); in lbmIODone()
2314 else if (bp->l_flag & lbmGC) { in lbmIODone()
2316 lmPostGC(bp); in lbmIODone()
2326 assert(bp->l_flag & lbmRELEASE); in lbmIODone()
2327 assert(bp->l_flag & lbmFREE); in lbmIODone()
2328 lbmfree(bp); in lbmIODone()
2336 struct lbuf *bp; in jfsIOWait() local
2340 while ((bp = log_redrive_list)) { in jfsIOWait()
2341 log_redrive_list = bp->l_redrive_next; in jfsIOWait()
2342 bp->l_redrive_next = NULL; in jfsIOWait()
2344 lbmStartIO(bp); in jfsIOWait()
2387 struct lbuf *bp; in lmLogFormat() local
2395 bp = lbmAllocate(log, 1); in lmLogFormat()
2411 logsuper = (struct logsuper *) bp->l_ldata; in lmLogFormat()
2422 bp->l_flag = lbmWRITE | lbmSYNC | lbmDIRECT; in lmLogFormat()
2423 bp->l_blkno = logAddress + sbi->nbperpage; in lmLogFormat()
2424 lbmStartIO(bp); in lmLogFormat()
2425 if ((rc = lbmIOWait(bp, 0))) in lmLogFormat()
2450 lp = (struct logpage *) bp->l_ldata; in lmLogFormat()
2465 bp->l_blkno += sbi->nbperpage; in lmLogFormat()
2466 bp->l_flag = lbmWRITE | lbmSYNC | lbmDIRECT; in lmLogFormat()
2467 lbmStartIO(bp); in lmLogFormat()
2468 if ((rc = lbmIOWait(bp, 0))) in lmLogFormat()
2478 bp->l_blkno += sbi->nbperpage; in lmLogFormat()
2479 bp->l_flag = lbmWRITE | lbmSYNC | lbmDIRECT; in lmLogFormat()
2480 lbmStartIO(bp); in lmLogFormat()
2481 if ((rc = lbmIOWait(bp, 0))) in lmLogFormat()
2491 lbmFree(bp); in lmLogFormat()