Lines Matching refs:tblk

151 static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
153 static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
155 static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
157 static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
160 struct tblock * tblk);
161 static void txForce(struct tblock * tblk);
162 static int txLog(struct jfs_log * log, struct tblock * tblk,
164 static void txUpdateMap(struct tblock * tblk);
165 static void txRelease(struct tblock * tblk);
166 static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
351 struct tblock *tblk; in txBegin() local
396 tblk = tid_to_tblock(t); in txBegin()
398 if ((tblk->next == 0) && !(flag & COMMIT_FORCE)) { in txBegin()
406 TxAnchor.freetid = tblk->next; in txBegin()
418 tblk->next = tblk->last = tblk->xflag = tblk->flag = tblk->lsn = 0; in txBegin()
420 tblk->sb = sb; in txBegin()
422 tblk->logtid = log->logtid; in txBegin()
489 struct tblock *tblk = tid_to_tblock(tid); in txEnd() local
499 TXN_WAKEUP(&tblk->waitor); in txEnd()
501 log = JFS_SBI(tblk->sb)->log; in txEnd()
511 if (tblk->flag & tblkGC_LAZY) { in txEnd()
512 jfs_info("txEnd called w/lazy tid: %d, tblk = 0x%p", tid, tblk); in txEnd()
516 tblk->flag |= tblkGC_UNLOCKED; in txEnd()
521 jfs_info("txEnd: tid: %d, tblk = 0x%p", tid, tblk); in txEnd()
523 assert(tblk->next == 0); in txEnd()
528 tblk->next = TxAnchor.freetid; in txEnd()
588 struct tblock *tblk; in txLock() local
630 tblk = tid_to_tblock(tid); in txLock()
665 if (tblk->next) in txLock()
666 lid_to_tlock(tblk->last)->next = lid; in txLock()
668 tblk->next = lid; in txLock()
670 tblk->last = lid; in txLock()
732 tblk = tid_to_tblock(tid); in txLock()
733 if (tblk->next) in txLock()
734 lid_to_tlock(tblk->last)->next = lid; in txLock()
736 tblk->next = lid; in txLock()
738 tblk->last = lid; in txLock()
863 static void txRelease(struct tblock * tblk) in txRelease() argument
871 for (lid = tblk->next; lid; lid = tlck->next) { in txRelease()
884 TXN_WAKEUP(&tblk->waitor); in txRelease()
895 static void txUnlock(struct tblock * tblk) in txUnlock() argument
905 jfs_info("txUnlock: tblk = 0x%p", tblk); in txUnlock()
906 log = JFS_SBI(tblk->sb)->log; in txUnlock()
911 for (lid = tblk->next; lid; lid = next) { in txUnlock()
932 logdiff(difft, tblk->clsn, log); in txUnlock()
935 mp->clsn = tblk->clsn; in txUnlock()
937 mp->clsn = tblk->clsn; in txUnlock()
961 tblk->next = tblk->last = 0; in txUnlock()
968 if (tblk->lsn) { in txUnlock()
971 list_del(&tblk->synclist); in txUnlock()
986 struct tblock *tblk; in txMaplock() local
1017 tblk = tid_to_tblock(tid); in txMaplock()
1018 if (tblk->next) in txMaplock()
1019 lid_to_tlock(tblk->last)->next = lid; in txMaplock()
1021 tblk->next = lid; in txMaplock()
1023 tblk->last = lid; in txMaplock()
1130 struct tblock *tblk; in txCommit() local
1150 tblk = tid_to_tblock(tid); in txCommit()
1160 lrd->logtid = cpu_to_le32(tblk->logtid); in txCommit()
1163 tblk->xflag |= flag; in txCommit()
1166 tblk->xflag |= COMMIT_LAZY; in txCommit()
1236 lid_to_tlock(jfs_ip->atltail)->next = tblk->next; in txCommit()
1237 tblk->next = jfs_ip->atlhead; in txCommit()
1238 if (!tblk->last) in txCommit()
1239 tblk->last = jfs_ip->atltail; in txCommit()
1259 if ((rc = txLog(log, tblk, &cd))) in txCommit()
1266 if (tblk->xflag & COMMIT_DELETE) { in txCommit()
1267 ihold(tblk->u.ip); in txCommit()
1285 if (tblk->u.ip->i_state & I_SYNC) in txCommit()
1286 tblk->xflag &= ~COMMIT_LAZY; in txCommit()
1289 ASSERT((!(tblk->xflag & COMMIT_DELETE)) || in txCommit()
1290 ((tblk->u.ip->i_nlink == 0) && in txCommit()
1291 !test_cflag(COMMIT_Nolink, tblk->u.ip))); in txCommit()
1298 lmLog(log, tblk, lrd, NULL); in txCommit()
1300 lmGroupCommit(log, tblk); in txCommit()
1311 txForce(tblk); in txCommit()
1322 if (tblk->xflag & COMMIT_FORCE) in txCommit()
1323 txUpdateMap(tblk); in txCommit()
1328 txRelease(tblk); in txCommit()
1330 if ((tblk->flag & tblkGC_LAZY) == 0) in txCommit()
1331 txUnlock(tblk); in txCommit()
1368 static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd) in txLog() argument
1379 for (lid = tblk->next; lid; lid = tlck->next) { in txLog()
1393 xtLog(log, tblk, lrd, tlck); in txLog()
1397 dtLog(log, tblk, lrd, tlck); in txLog()
1401 diLog(log, tblk, lrd, tlck, cd); in txLog()
1405 mapLog(log, tblk, lrd, tlck); in txLog()
1409 dataLog(log, tblk, lrd, tlck); in txLog()
1425 static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, in diLog() argument
1449 mp->logical_size >> tblk->sb->s_blocksize_bits); in diLog()
1450 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in diLog()
1487 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in diLog()
1522 cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in diLog()
1538 static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, in dataLog() argument
1569 PXDlength(pxd, mp->logical_size >> tblk->sb->s_blocksize_bits); in dataLog()
1571 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in dataLog()
1584 static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, in dtLog() argument
1620 mp->logical_size >> tblk->sb->s_blocksize_bits); in dtLog()
1621 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in dtLog()
1649 mp->logical_size >> tblk->sb->s_blocksize_bits); in dtLog()
1650 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in dtLog()
1672 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in dtLog()
1687 static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, in xtLog() argument
1739 mp->logical_size >> tblk->sb->s_blocksize_bits); in xtLog()
1740 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in xtLog()
1760 if ((xadlock->count <= 4) && (tblk->xflag & COMMIT_LAZY)) { in xtLog()
1786 tblk->xflag &= ~COMMIT_LAZY; in xtLog()
1823 if (tblk->xflag & COMMIT_TRUNCATE) { in xtLog()
1828 mp->logical_size >> tblk->sb-> in xtLog()
1831 cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in xtLog()
1837 cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in xtLog()
1855 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in xtLog()
1863 if ((xadlock->count <= 4) && (tblk->xflag & COMMIT_LAZY)) { in xtLog()
1889 tblk->xflag &= ~COMMIT_LAZY; in xtLog()
1897 if (((tblk->xflag & COMMIT_PWMAP) || S_ISDIR(ip->i_mode)) in xtLog()
1928 tblk->xflag &= ~COMMIT_LAZY; in xtLog()
1949 mp->logical_size >> tblk->sb->s_blocksize_bits); in xtLog()
1950 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in xtLog()
1969 cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in xtLog()
1992 cpu_to_le32(lmLog(log, tblk, lrd, tlck)); in xtLog()
2070 static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, in mapLog() argument
2092 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in mapLog()
2108 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in mapLog()
2140 cpu_to_le32(lmLog(log, tblk, lrd, NULL)); in mapLog()
2209 static void txForce(struct tblock * tblk) in txForce() argument
2220 tlck = lid_to_tlock(tblk->next); in txForce()
2226 tlck->next = tblk->next; in txForce()
2227 tblk->next = lid; in txForce()
2235 for (lid = tblk->next; lid; lid = next) { in txForce()
2277 static void txUpdateMap(struct tblock * tblk) in txUpdateMap() argument
2289 ipimap = JFS_SBI(tblk->sb)->ipimap; in txUpdateMap()
2291 maptype = (tblk->xflag & COMMIT_PMAP) ? COMMIT_PMAP : COMMIT_PWMAP; in txUpdateMap()
2306 for (lid = tblk->next; lid; lid = tlck->next) { in txUpdateMap()
2340 txAllocPMap(ipimap, maplock, tblk); in txUpdateMap()
2360 tblk, COMMIT_PWMAP); in txUpdateMap()
2363 tblk, maptype); in txUpdateMap()
2367 if (!(tblk->flag & tblkGC_LAZY)) { in txUpdateMap()
2387 if (tblk->xflag & COMMIT_CREATE) { in txUpdateMap()
2388 diUpdatePMap(ipimap, tblk->ino, false, tblk); in txUpdateMap()
2393 pxdlock.pxd = tblk->u.ixpxd; in txUpdateMap()
2395 txAllocPMap(ipimap, (struct maplock *) & pxdlock, tblk); in txUpdateMap()
2396 } else if (tblk->xflag & COMMIT_DELETE) { in txUpdateMap()
2397 ip = tblk->u.ip; in txUpdateMap()
2398 diUpdatePMap(ipimap, ip->i_ino, true, tblk); in txUpdateMap()
2424 struct tblock * tblk) in txAllocPMap() argument
2447 (s64) xlen, tblk); in txAllocPMap()
2457 dbUpdatePMap(ipbmap, false, xaddr, (s64) xlen, tblk); in txAllocPMap()
2467 tblk); in txAllocPMap()
2482 struct maplock * maplock, struct tblock * tblk, int maptype) in txFreeMap() argument
2495 tblk, maplock, maptype); in txFreeMap()
2509 (s64) xlen, tblk); in txFreeMap()
2519 tblk); in txFreeMap()
2530 (s64) xlen, tblk); in txFreeMap()
2629 struct tblock *tblk = tid_to_tblock(tid); in txAbort() local
2635 for (lid = tblk->next; lid; lid = next) { in txAbort()
2663 tblk->next = tblk->last = 0; in txAbort()
2669 jfs_error(tblk->sb, "\n"); in txAbort()
2682 static void txLazyCommit(struct tblock * tblk) in txLazyCommit() argument
2686 while (((tblk->flag & tblkGC_READY) == 0) && in txLazyCommit()
2687 ((tblk->flag & tblkGC_UNLOCKED) == 0)) { in txLazyCommit()
2690 jfs_info("jfs_lazycommit: tblk 0x%p not unlocked", tblk); in txLazyCommit()
2694 jfs_info("txLazyCommit: processing tblk 0x%p", tblk); in txLazyCommit()
2696 txUpdateMap(tblk); in txLazyCommit()
2698 log = (struct jfs_log *) JFS_SBI(tblk->sb)->log; in txLazyCommit()
2702 tblk->flag |= tblkGC_COMMITTED; in txLazyCommit()
2704 if (tblk->flag & tblkGC_READY) in txLazyCommit()
2707 wake_up_all(&tblk->gcwait); // LOGGC_WAKEUP in txLazyCommit()
2712 if (tblk->flag & tblkGC_LAZY) { in txLazyCommit()
2714 txUnlock(tblk); in txLazyCommit()
2715 tblk->flag &= ~tblkGC_LAZY; in txLazyCommit()
2716 txEnd(tblk - TxBlock); /* Convert back to tid */ in txLazyCommit()
2720 jfs_info("txLazyCommit: done: tblk = 0x%p", tblk); in txLazyCommit()
2733 struct tblock *tblk; in jfs_lazycommit() local
2742 list_for_each_entry(tblk, &TxAnchor.unlock_queue, in jfs_lazycommit()
2745 sbi = JFS_SBI(tblk->sb); in jfs_lazycommit()
2761 list_del(&tblk->cqueue); in jfs_lazycommit()
2764 txLazyCommit(tblk); in jfs_lazycommit()
2804 void txLazyUnlock(struct tblock * tblk) in txLazyUnlock() argument
2810 list_add_tail(&tblk->cqueue, &TxAnchor.unlock_queue); in txLazyUnlock()
2815 if (!(JFS_SBI(tblk->sb)->commit_state & IN_LAZYCOMMIT) && in txLazyUnlock()