Lines Matching defs:log
8 * jfs_logmgr.c: log manager
15 * log buffer manager:
16 * special purpose buffer manager supporting log i/o requirements.
17 * per log serial pageout of logpage
25 * log page during the pageout of previous/current log page(s) are
29 * transactions are committed asynchronously when the log page
33 * . a per log lock serialize log write.
34 * . a per log lock serialize group commit.
35 * . a per log lock serialize log open/close;
37 * TBD log integrity:
78 * log read/write serialization (per log)
80 #define LOG_LOCK_INIT(log) mutex_init(&(log)->loglock)
81 #define LOG_LOCK(log) mutex_lock(&((log)->loglock))
82 #define LOG_UNLOCK(log) mutex_unlock(&((log)->loglock))
86 * log group commit serialization (per log)
89 #define LOGGC_LOCK_INIT(log) spin_lock_init(&(log)->gclock)
90 #define LOGGC_LOCK(log) spin_lock_irq(&(log)->gclock)
91 #define LOGGC_UNLOCK(log) spin_unlock_irq(&(log)->gclock)
95 * log sync serialization (per log)
106 * log buffer cache synchronization
129 /* log buffer manager pageout control (cumulative, inclusive) */
149 * of log page
163 static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk,
166 static int lmNextPage(struct jfs_log * log);
167 static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi,
172 static int lbmLogInit(struct jfs_log * log);
173 static void lbmLogShutdown(struct jfs_log * log);
174 static struct lbuf *lbmAllocate(struct jfs_log * log, int);
177 static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp);
178 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, int cant_block);
179 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag);
183 static void lmGCwrite(struct jfs_log * log, int cant_block);
184 static int lmLogSync(struct jfs_log * log, int hard_sync);
201 static void write_special_inodes(struct jfs_log *log,
206 list_for_each_entry(sbi, &log->sb_list, log_list) {
216 * FUNCTION: write a log record;
220 * RETURN: lsn - offset to the next log record to write (end-of-log);
223 * note: todo: log error handler
225 int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
233 jfs_info("lmLog: log:0x%p tblk:0x%p, lrd:0x%p tlck:0x%p",
234 log, tblk, lrd, tlck);
236 LOG_LOCK(log);
238 /* log by (out-of-transaction) JFS ? */
242 /* log from page ? */
250 lsn = log->lsn;
252 LOGSYNC_LOCK(log, flags);
255 * initialize page lsn if first log write of the page
258 mp->log = log;
260 log->count++;
263 list_add_tail(&mp->synclist, &log->synclist);
271 * log records are used to reconstruct allocation map
276 * commit time to allow forwarding log syncpt past log
287 log->count++;
297 logdiff(diffp, mp->lsn, log);
298 logdiff(difft, tblk->lsn, log);
308 LOGSYNC_UNLOCK(log, flags);
311 * write the log record
314 lsn = lmWriteRecord(log, tblk, lrd, tlck);
317 * forward log syncpt if log reached next syncpt trigger
319 logdiff(diffp, lsn, log);
320 if (diffp >= log->nextsync)
321 lsn = lmLogSync(log, 0);
323 /* update end-of-log lsn */
324 log->lsn = lsn;
326 LOG_UNLOCK(log);
328 /* return end-of-log address */
335 * FUNCTION: move the log record to current log page
339 * RETURN: end-of-log address
344 lmWriteRecord(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
347 int lsn = 0; /* end-of-log address */
348 struct lbuf *bp; /* dst log page buffer */
349 struct logpage *lp; /* dst log page */
350 caddr_t dst; /* destination address in log page */
351 int dstoffset; /* end-of-log offset in log page */
352 int freespace; /* free space in log page */
366 /* retrieve destination log page to write */
367 bp = (struct lbuf *) log->bp;
369 dstoffset = log->eor;
371 /* any log data to write ? */
376 * move log record data
378 /* retrieve source meta-data page to log */
383 /* retrieve source in-memory inode to log */
416 lmNextPage(log);
418 bp = log->bp;
424 * move log vector data
441 lmNextPage(log);
443 bp = (struct lbuf *) log->bp;
452 * move log vector descriptor
469 * move log record descriptor
491 * end of log record descriptor
494 /* update last log record eor */
495 log->eor = dstoffset;
497 lsn = (log->page << L2LOGPSIZE) + dstoffset;
514 LOGGC_LOCK(log);
518 tblk->bp = log->bp;
519 tblk->pn = log->page;
520 tblk->eor = log->eor;
523 list_add_tail(&tblk->cqueue, &log->cqueue);
525 LOGGC_UNLOCK(log);
529 le16_to_cpu(lrd->type), log->bp, log->page, dstoffset);
537 lmNextPage(log);
539 bp = (struct lbuf *) log->bp;
554 * PARAMETER: log
560 static int lmNextPage(struct jfs_log * log)
563 int lspn; /* log sequence page number */
569 /* get current log page number and log sequence page number */
570 pn = log->page;
571 bp = log->bp;
575 LOGGC_LOCK(log);
581 if (list_empty(&log->cqueue))
584 tblk = list_entry(log->cqueue.prev, struct tblock, cqueue);
600 if (log->cflag & logGC_PAGEOUT) {
604 * of the pages since log pages will be added
608 lbmWrite(log, bp, 0, 0);
613 log->cflag |= logGC_PAGEOUT;
614 lmGCwrite(log, 0);
624 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE, 0);
626 LOGGC_UNLOCK(log);
631 /* if log wraps, the first data page of log is 2
634 log->page = (pn == log->size - 1) ? 2 : pn + 1;
635 log->eor = LOGPHDRSIZE; /* ? valid page empty/full at logRedo() */
637 /* allocate/initialize next log page buffer */
638 nextbp = lbmAllocate(log, log->page);
639 nextbp->l_eor = log->eor;
640 log->bp = nextbp;
642 /* initialize next log page */
662 * LOGGC_LOCK serializes log group commit queue, and
666 int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
670 LOGGC_LOCK(log);
677 LOGGC_UNLOCK(log);
680 jfs_info("lmGroup Commit: tblk = 0x%p, gcrtc = %d", tblk, log->gcrtc);
685 if ((!(log->cflag & logGC_PAGEOUT)) && (!list_empty(&log->cqueue)) &&
686 (!(tblk->xflag & COMMIT_LAZY) || test_bit(log_FLUSH, &log->flag)
693 log->cflag |= logGC_PAGEOUT;
695 lmGCwrite(log, 0);
702 LOGGC_UNLOCK(log);
712 LOGGC_UNLOCK(log);
718 log->gcrtc++;
722 LOGGC_LOCK(log), LOGGC_UNLOCK(log));
728 LOGGC_UNLOCK(log);
736 * initiate write of log page, building a group of all transactions
745 static void lmGCwrite(struct jfs_log * log, int cant_write)
754 * build the commit group of a log page
757 * transactions with COMMIT records on the same log page.
760 gcpn = list_entry(log->cqueue.next, struct tblock, cqueue)->pn;
762 list_for_each_entry(tblk, &log->cqueue, cqueue) {
774 * pageout to commit transactions on the log page.
785 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmGC,
793 lbmWrite(log, bp, lbmWRITE | lbmGC, cant_write);
803 * to disk, redriving log I/O if necessary.
813 struct jfs_log *log = bp->l_log;
817 //LOGGC_LOCK(log);
818 spin_lock_irqsave(&log->gclock, flags);
823 * group committed with the current log page
825 list_for_each_entry_safe(tblk, temp, &log->cqueue, cqueue) {
840 if (tblk == log->flush_tblk) {
841 /* we can stop flushing the log now */
842 clear_bit(log_FLUSH, &log->flag);
843 log->flush_tblk = NULL;
859 log->gcrtc--;
878 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE,
885 * (whose COMMITs are after that of the last log page written.
887 * or lazy transactions are on a full (queued) log page,
891 if ((!list_empty(&log->cqueue)) &&
892 ((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) ||
893 test_bit(log_FLUSH, &log->flag) || jfs_tlocks_low))
897 lmGCwrite(log, 1);
905 log->cflag &= ~logGC_PAGEOUT;
907 //LOGGC_UNLOCK(log);
908 spin_unlock_irqrestore(&log->gclock, flags);
915 * FUNCTION: write log SYNCPT record for specified log
922 * PARAMETERS: log - log structure
929 static int lmLogSync(struct jfs_log * log, int hard_sync)
943 write_special_inodes(log, filemap_fdatawrite);
945 write_special_inodes(log, filemap_flush);
954 if (log->sync == log->syncpt) {
955 LOGSYNC_LOCK(log, flags);
956 if (list_empty(&log->synclist))
957 log->sync = log->lsn;
959 lp = list_entry(log->synclist.next,
961 log->sync = lp->lsn;
963 LOGSYNC_UNLOCK(log, flags);
971 if (log->sync != log->syncpt) {
976 lrd.log.syncpt.sync = cpu_to_le32(log->sync);
977 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
979 log->syncpt = log->sync;
981 lsn = log->lsn;
986 logsize = log->logsize;
988 logdiff(written, lsn, log);
995 * log wrapping
999 * associated with log ?
1000 * option 3 - extend log ?
1003 * mark log wrapped, and continue.
1005 * mark log valid for recovery.
1006 * if crashed during invalid state, log state
1007 * implies invalid log, forcing fsck().
1009 /* mark log state log wrap in log superblock */
1010 /* log->state = LOGWRAP; */
1013 log->syncpt = log->sync = lsn;
1014 log->nextsync = delta;
1017 log->nextsync = written + more;
1020 * than 1/4 of the log size, stop new transactions from
1024 if (!test_bit(log_SYNCBARRIER, &log->flag) &&
1025 (written > LOGSYNC_BARRIER(logsize)) && log->active) {
1026 set_bit(log_SYNCBARRIER, &log->flag);
1027 jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn,
1028 log->syncpt);
1032 jfs_flush_journal(log, 0);
1041 * FUNCTION: write log SYNCPT record for specified log
1043 * PARAMETERS: log - log structure
1046 void jfs_syncpt(struct jfs_log *log, int hard_sync)
1047 { LOG_LOCK(log);
1048 if (!test_bit(log_QUIESCE, &log->flag))
1049 lmLogSync(log, hard_sync);
1050 LOG_UNLOCK(log);
1056 * FUNCTION: open the log on first open;
1057 * insert filesystem in the active list of the log.
1060 * iplog - log inode (out)
1070 struct jfs_log *log;
1080 list_for_each_entry(log, &jfs_external_logs, journal_list) {
1081 if (log->bdev->bd_dev == sbi->logdev) {
1082 if (!uuid_equal(&log->uuid, &sbi->loguuid)) {
1088 * add file system to log active file system list
1090 if ((rc = lmLogFileSystem(log, sbi, 1))) {
1098 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL))) {
1102 INIT_LIST_HEAD(&log->sb_list);
1103 init_waitqueue_head(&log->syncwait);
1106 * external log as separate logical volume
1108 * file systems to log may have n-to-1 relationship;
1112 log);
1118 log->bdev = bdev;
1119 uuid_copy(&log->uuid, &sbi->loguuid);
1122 * initialize log:
1124 if ((rc = lmLogInit(log)))
1127 list_add(&log->journal_list, &jfs_external_logs);
1130 * add file system to log active file system list
1132 if ((rc = lmLogFileSystem(log, sbi, 1)))
1136 LOG_LOCK(log);
1137 list_add(&sbi->log_list, &log->sb_list);
1138 sbi->log = log;
1139 LOG_UNLOCK(log);
1148 list_del(&log->journal_list);
1149 lbmLogShutdown(log);
1151 close: /* close external log device */
1154 free: /* free log descriptor */
1156 kfree(log);
1164 struct jfs_log *log;
1167 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL)))
1169 INIT_LIST_HEAD(&log->sb_list);
1170 init_waitqueue_head(&log->syncwait);
1172 set_bit(log_INLINELOG, &log->flag);
1173 log->bdev = sb->s_bdev;
1174 log->base = addressPXD(&JFS_SBI(sb)->logpxd);
1175 log->size = lengthPXD(&JFS_SBI(sb)->logpxd) >>
1177 log->l2bsize = sb->s_blocksize_bits;
1181 * initialize log.
1183 if ((rc = lmLogInit(log))) {
1184 kfree(log);
1189 list_add(&JFS_SBI(sb)->log_list, &log->sb_list);
1190 JFS_SBI(sb)->log = log;
1223 JFS_SBI(sb)->log = dummy_log;
1233 * FUNCTION: log initialization at first log open.
1236 * initialize the log from log superblock.
1237 * set the log state in the superblock to LOGMOUNT and
1238 * write SYNCPT log record.
1240 * PARAMETER: log - log structure
1243 * -EINVAL - bad log magic number or superblock dirty
1248 int lmLogInit(struct jfs_log * log)
1258 jfs_info("lmLogInit: log:0x%p", log);
1261 LOGGC_LOCK_INIT(log);
1263 /* allocate/initialize the log write serialization lock */
1264 LOG_LOCK_INIT(log);
1266 LOGSYNC_LOCK_INIT(log);
1268 INIT_LIST_HEAD(&log->synclist);
1270 INIT_LIST_HEAD(&log->cqueue);
1271 log->flush_tblk = NULL;
1273 log->count = 0;
1276 * initialize log i/o
1278 if ((rc = lbmLogInit(log)))
1281 if (!test_bit(log_INLINELOG, &log->flag))
1282 log->l2bsize = L2LOGPSIZE;
1285 if (log->no_integrity) {
1291 bp = lbmAllocate(log , 0);
1292 log->bp = bp;
1296 * validate log superblock
1298 if ((rc = lbmRead(log, 1, &bpsuper)))
1316 /* initialize log from log superblock */
1317 if (test_bit(log_INLINELOG,&log->flag)) {
1318 if (log->size != le32_to_cpu(logsuper->size)) {
1322 jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x",
1323 log, (unsigned long long)log->base, log->size);
1325 if (!uuid_equal(&logsuper->uuid, &log->uuid)) {
1326 jfs_warn("wrong uuid on JFS log device");
1330 log->size = le32_to_cpu(logsuper->size);
1331 log->l2bsize = le32_to_cpu(logsuper->l2bsize);
1332 jfs_info("lmLogInit: external log:0x%p base:0x%Lx size:0x%x",
1333 log, (unsigned long long)log->base, log->size);
1336 log->page = le32_to_cpu(logsuper->end) / LOGPSIZE;
1337 log->eor = le32_to_cpu(logsuper->end) - (LOGPSIZE * log->page);
1340 * initialize for log append write mode
1342 /* establish current/end-of-log page/buffer */
1343 if ((rc = lbmRead(log, log->page, &bp)))
1349 le32_to_cpu(logsuper->end), log->page, log->eor,
1352 log->bp = bp;
1353 bp->l_pn = log->page;
1354 bp->l_eor = log->eor;
1357 if (log->eor >= LOGPSIZE - LOGPTLRSIZE)
1358 lmNextPage(log);
1361 * initialize log syncpoint
1365 * (i.e., log redo up to HERE !);
1367 * (to write log superblock update), but do not release to
1374 lrd.log.syncpt.sync = 0;
1375 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
1376 bp = log->bp;
1380 lbmWrite(log, bp, lbmWRITE | lbmSYNC, 0);
1388 log->serial = le32_to_cpu(logsuper->serial) + 1;
1389 logsuper->serial = cpu_to_le32(log->serial);
1390 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1396 log->logsize = (log->size - 2) << L2LOGPSIZE;
1397 log->lsn = lsn;
1398 log->syncpt = lsn;
1399 log->sync = log->syncpt;
1400 log->nextsync = LOGSYNC_DELTA(log->logsize);
1403 log->lsn, log->syncpt, log->sync);
1408 log->clsn = lsn;
1415 errout30: /* release log page */
1416 log->wqueue = NULL;
1420 errout20: /* release log superblock */
1424 lbmLogShutdown(log);
1434 * FUNCTION: remove file system <ipmnt> from active list of log <iplog>
1446 struct jfs_log *log = sbi->log;
1450 jfs_info("lmLogClose: log:0x%p", log);
1453 LOG_LOCK(log);
1455 LOG_UNLOCK(log);
1456 sbi->log = NULL;
1464 if (test_bit(log_INLINELOG, &log->flag)) {
1466 * in-line log in host file system
1468 rc = lmLogShutdown(log);
1469 kfree(log);
1473 if (!log->no_integrity)
1474 lmLogFileSystem(log, sbi, 0);
1476 if (!list_empty(&log->sb_list))
1486 if (log->no_integrity)
1490 * external log as separate logical volume
1492 list_del(&log->journal_list);
1493 bdev = log->bdev;
1494 rc = lmLogShutdown(log);
1498 kfree(log);
1517 void jfs_flush_journal(struct jfs_log *log, int wait)
1523 if (!log)
1526 jfs_info("jfs_flush_journal: log:0x%p wait=%d", log, wait);
1528 LOGGC_LOCK(log);
1530 if (!list_empty(&log->cqueue)) {
1535 target = list_entry(log->cqueue.prev, struct tblock, cqueue);
1537 if (test_bit(log_FLUSH, &log->flag)) {
1544 if (log->flush_tblk)
1545 log->flush_tblk = target;
1548 log->flush_tblk = target;
1549 set_bit(log_FLUSH, &log->flag);
1554 if (!(log->cflag & logGC_PAGEOUT)) {
1555 log->cflag |= logGC_PAGEOUT;
1556 lmGCwrite(log, 0);
1560 if ((wait > 1) || test_bit(log_SYNCBARRIER, &log->flag)) {
1562 set_bit(log_FLUSH, &log->flag);
1563 log->flush_tblk = NULL;
1571 LOGGC_UNLOCK(log);
1573 LOGGC_LOCK(log);
1576 LOGGC_UNLOCK(log);
1581 write_special_inodes(log, filemap_fdatawrite);
1587 if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
1590 write_special_inodes(log, filemap_fdatawrite);
1591 if (list_empty(&log->cqueue) &&
1592 list_empty(&log->synclist))
1596 assert(list_empty(&log->cqueue));
1599 if (!list_empty(&log->synclist)) {
1603 list_for_each_entry(lp, &log->synclist, synclist) {
1620 WARN_ON(!list_empty(&log->synclist));
1622 clear_bit(log_FLUSH, &log->flag);
1628 * FUNCTION: log shutdown at last LogClose().
1630 * write log syncpt record.
1633 * PARAMETER: log - log inode
1639 int lmLogShutdown(struct jfs_log * log)
1649 jfs_info("lmLogShutdown: log:0x%p", log);
1651 jfs_flush_journal(log, 2);
1655 * (i.e., log redo up to HERE !)
1661 lrd.log.syncpt.sync = 0;
1663 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
1664 bp = log->bp;
1667 lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0);
1668 lbmIOWait(log->bp, lbmFREE);
1669 log->bp = NULL;
1672 * synchronous update log superblock
1673 * mark log state as shutdown cleanly
1676 if ((rc = lbmRead(log, 1, &bpsuper)))
1682 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1686 lsn, log->page, log->eor);
1690 * shutdown per log i/o
1692 lbmLogShutdown(log);
1705 * file system into/from log active file system list.
1707 * PARAMETE: log - pointer to logs inode.
1709 * serial - pointer to returned log serial number
1715 static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi,
1725 * insert/remove file system device to log active file system list.
1727 if ((rc = lbmRead(log, 1, &bpsuper)))
1759 * synchronous write log superblock:
1762 * at file system mount, log super block is updated for
1763 * activation of the file system before any log record
1766 * flushed before log super block is updated for deactivation
1769 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1776 * log buffer manager (lbm)
1779 * special purpose buffer manager supporting log i/o requirements.
1781 * per log write queue:
1782 * log pageout occurs in serial order by fifo write queue and
1785 * (log->wrqueue points to the tail, and buffers are linked via
1787 * maintains log page in pageout ot waiting for pageout in serial pageout.
1793 * initialize per log I/O setup at lmLogInit()
1795 static int lbmLogInit(struct jfs_log * log)
1796 { /* log inode */
1800 jfs_info("lbmLogInit: log:0x%p", log);
1803 log->bp = NULL;
1805 /* initialize log device write queue */
1806 log->wqueue = NULL;
1809 * Each log has its own buffer pages allocated to it. These are
1811 * writing to the log does not block trying to allocate a page from
1812 * the page cache (for the log). This would be bad, since page
1814 * which would cause log activity. Was that clear? I'm trying to
1817 init_waitqueue_head(&log->free_wait);
1819 log->lbuf_free = NULL;
1841 lbuf->l_log = log;
1844 lbuf->l_freelist = log->lbuf_free;
1845 log->lbuf_free = lbuf;
1853 lbmLogShutdown(log);
1861 * finalize per log I/O setup at lmLogShutdown()
1863 static void lbmLogShutdown(struct jfs_log * log)
1867 jfs_info("lbmLogShutdown: log:0x%p", log);
1869 lbuf = log->lbuf_free;
1882 * allocate an empty log buffer
1884 static struct lbuf *lbmAllocate(struct jfs_log * log, int pn)
1890 * recycle from log buffer freelist if any
1893 LCACHE_SLEEP_COND(log->free_wait, (bp = log->lbuf_free), flags);
1894 log->lbuf_free = bp->l_freelist;
1903 bp->l_blkno = log->base + (pn << (L2LOGPSIZE - log->l2bsize));
1913 * release a log buffer to freelist
1928 struct jfs_log *log = bp->l_log;
1935 bp->l_freelist = log->lbuf_free;
1936 log->lbuf_free = bp;
1938 wake_up(&log->free_wait);
1946 * FUNCTION: add a log buffer to the log redrive list
1949 * bp - log buffer
1970 static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
1976 * allocate a log buffer
1978 *bpp = bp = lbmAllocate(log, pn);
1985 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
1986 bio_set_dev(bio, log->bdev);
1995 if (log->no_integrity) {
2023 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag,
2033 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize));
2043 * insert bp at tail of write queue associated with log
2048 tail = log->wqueue;
2054 log->wqueue = bp;
2057 log->wqueue = bp;
2078 LOGGC_UNLOCK(log);
2080 LOGGC_LOCK(log);
2089 * (e.g., log superblock) write;
2091 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag)
2103 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize));
2119 * serialization: LCACHE_LOCK() is NOT held during log i/o;
2124 struct jfs_log *log = bp->l_log;
2129 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
2130 bio_set_dev(bio, log->bdev);
2140 if (log->no_integrity) {
2184 struct jfs_log *log;
2199 jfs_err("lbmIODone: I/O error in JFS log");
2234 log = bp->l_log;
2235 log->clsn = (bp->l_pn << L2LOGPSIZE) + bp->l_ceor;
2243 tail = log->wqueue;
2248 * from log device write queue
2251 log->wqueue = NULL;
2258 * from log device write queue
2352 * FUNCTION: format file system log
2355 * log - volume log
2356 * logAddress - start address of log space in FS block
2357 * logSize - length of log space in FS block;
2365 int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize)
2371 int lspn; /* log sequence page number */
2379 sbi = list_entry(log->sb_list.next, struct jfs_sb_info, log_list);
2381 /* allocate a log buffer */
2382 bp = lbmAllocate(log, 1);
2387 * log space:
2390 * page 1 - log superblock;
2391 * page 2 - log data page: A SYNC log record is written
2393 * pages 3-N - log data page: set to empty log data pages;
2396 * init log superblock: log page 1
2416 * init pages 2 to npages-1 as log data pages:
2418 * log page sequence number (lpsn) initialization:
2425 * the N (= npages-2) data pages of the log is maintained as
2426 * a circular file for the log records;
2427 * lpsn grows by 1 monotonically as each log page is written
2428 * to the circular file of the log;
2431 * still work in find log end process, we have to simulate the
2432 * log wrap situation at the log format time.
2433 * The 1st log page written will have the highest lpsn. Then
2434 * the succeeding log pages will have ascending order of
2439 * initialize 1st log page to be written: lpsn = N - 1,
2440 * write a SYNCPT log record is written to this page
2450 lrd_ptr->log.syncpt.sync = 0;
2459 * initialize succeeding log pages: lpsn = 0, 1, ..., (N-2)
2475 * finalize log