Lines Matching refs: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 */
408 lmNextPage(log);
410 bp = log->bp;
416 * move log vector data
433 lmNextPage(log);
435 bp = (struct lbuf *) log->bp;
444 * move log vector descriptor
461 * move log record descriptor
483 * end of log record descriptor
486 /* update last log record eor */
487 log->eor = dstoffset;
489 lsn = (log->page << L2LOGPSIZE) + dstoffset;
506 LOGGC_LOCK(log);
510 tblk->bp = log->bp;
511 tblk->pn = log->page;
512 tblk->eor = log->eor;
515 list_add_tail(&tblk->cqueue, &log->cqueue);
517 LOGGC_UNLOCK(log);
521 le16_to_cpu(lrd->type), log->bp, log->page, dstoffset);
529 lmNextPage(log);
531 bp = (struct lbuf *) log->bp;
546 * PARAMETER: log
552 static int lmNextPage(struct jfs_log * log)
555 int lspn; /* log sequence page number */
561 /* get current log page number and log sequence page number */
562 pn = log->page;
563 bp = log->bp;
567 LOGGC_LOCK(log);
573 if (list_empty(&log->cqueue))
576 tblk = list_entry(log->cqueue.prev, struct tblock, cqueue);
592 if (log->cflag & logGC_PAGEOUT) {
596 * of the pages since log pages will be added
600 lbmWrite(log, bp, 0, 0);
605 log->cflag |= logGC_PAGEOUT;
606 lmGCwrite(log, 0);
616 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE, 0);
618 LOGGC_UNLOCK(log);
623 /* if log wraps, the first data page of log is 2
626 log->page = (pn == log->size - 1) ? 2 : pn + 1;
627 log->eor = LOGPHDRSIZE; /* ? valid page empty/full at logRedo() */
629 /* allocate/initialize next log page buffer */
630 nextbp = lbmAllocate(log, log->page);
631 nextbp->l_eor = log->eor;
632 log->bp = nextbp;
634 /* initialize next log page */
654 * LOGGC_LOCK serializes log group commit queue, and
658 int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
662 LOGGC_LOCK(log);
669 LOGGC_UNLOCK(log);
672 jfs_info("lmGroup Commit: tblk = 0x%p, gcrtc = %d", tblk, log->gcrtc);
677 if ((!(log->cflag & logGC_PAGEOUT)) && (!list_empty(&log->cqueue)) &&
678 (!(tblk->xflag & COMMIT_LAZY) || test_bit(log_FLUSH, &log->flag)
685 log->cflag |= logGC_PAGEOUT;
687 lmGCwrite(log, 0);
694 LOGGC_UNLOCK(log);
704 LOGGC_UNLOCK(log);
710 log->gcrtc++;
714 LOGGC_LOCK(log), LOGGC_UNLOCK(log));
720 LOGGC_UNLOCK(log);
728 * initiate write of log page, building a group of all transactions
737 static void lmGCwrite(struct jfs_log * log, int cant_write)
746 * build the commit group of a log page
749 * transactions with COMMIT records on the same log page.
752 gcpn = list_entry(log->cqueue.next, struct tblock, cqueue)->pn;
754 list_for_each_entry(tblk, &log->cqueue, cqueue) {
766 * pageout to commit transactions on the log page.
777 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmGC,
785 lbmWrite(log, bp, lbmWRITE | lbmGC, cant_write);
795 * to disk, redriving log I/O if necessary.
805 struct jfs_log *log = bp->l_log;
809 //LOGGC_LOCK(log);
810 spin_lock_irqsave(&log->gclock, flags);
815 * group committed with the current log page
817 list_for_each_entry_safe(tblk, temp, &log->cqueue, cqueue) {
832 if (tblk == log->flush_tblk) {
833 /* we can stop flushing the log now */
834 clear_bit(log_FLUSH, &log->flag);
835 log->flush_tblk = NULL;
851 log->gcrtc--;
870 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE,
877 * (whose COMMITs are after that of the last log page written.
879 * or lazy transactions are on a full (queued) log page,
883 if ((!list_empty(&log->cqueue)) &&
884 ((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) ||
885 test_bit(log_FLUSH, &log->flag) || jfs_tlocks_low))
889 lmGCwrite(log, 1);
897 log->cflag &= ~logGC_PAGEOUT;
899 //LOGGC_UNLOCK(log);
900 spin_unlock_irqrestore(&log->gclock, flags);
907 * FUNCTION: write log SYNCPT record for specified log
914 * PARAMETERS: log - log structure
921 static int lmLogSync(struct jfs_log * log, int hard_sync)
935 write_special_inodes(log, filemap_fdatawrite);
937 write_special_inodes(log, filemap_flush);
946 if (log->sync == log->syncpt) {
947 LOGSYNC_LOCK(log, flags);
948 if (list_empty(&log->synclist))
949 log->sync = log->lsn;
951 lp = list_entry(log->synclist.next,
953 log->sync = lp->lsn;
955 LOGSYNC_UNLOCK(log, flags);
963 if (log->sync != log->syncpt) {
968 lrd.log.syncpt.sync = cpu_to_le32(log->sync);
969 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
971 log->syncpt = log->sync;
973 lsn = log->lsn;
978 logsize = log->logsize;
980 logdiff(written, lsn, log);
987 * log wrapping
991 * associated with log ?
992 * option 3 - extend log ?
995 * mark log wrapped, and continue.
997 * mark log valid for recovery.
998 * if crashed during invalid state, log state
999 * implies invalid log, forcing fsck().
1001 /* mark log state log wrap in log superblock */
1002 /* log->state = LOGWRAP; */
1005 log->syncpt = log->sync = lsn;
1006 log->nextsync = delta;
1009 log->nextsync = written + more;
1012 * than 1/4 of the log size, stop new transactions from
1016 if (!test_bit(log_SYNCBARRIER, &log->flag) &&
1017 (written > LOGSYNC_BARRIER(logsize)) && log->active) {
1018 set_bit(log_SYNCBARRIER, &log->flag);
1019 jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn,
1020 log->syncpt);
1024 jfs_flush_journal(log, 0);
1033 * FUNCTION: write log SYNCPT record for specified log
1035 * PARAMETERS: log - log structure
1038 void jfs_syncpt(struct jfs_log *log, int hard_sync)
1039 { LOG_LOCK(log);
1040 if (!test_bit(log_QUIESCE, &log->flag))
1041 lmLogSync(log, hard_sync);
1042 LOG_UNLOCK(log);
1048 * FUNCTION: open the log on first open;
1049 * insert filesystem in the active list of the log.
1052 * iplog - log inode (out)
1062 struct jfs_log *log;
1072 list_for_each_entry(log, &jfs_external_logs, journal_list) {
1073 if (file_bdev(log->bdev_file)->bd_dev == sbi->logdev) {
1074 if (!uuid_equal(&log->uuid, &sbi->loguuid)) {
1080 * add file system to log active file system list
1082 if ((rc = lmLogFileSystem(log, sbi, 1))) {
1090 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL))) {
1094 INIT_LIST_HEAD(&log->sb_list);
1095 init_waitqueue_head(&log->syncwait);
1098 * external log as separate logical volume
1100 * file systems to log may have n-to-1 relationship;
1104 BLK_OPEN_READ | BLK_OPEN_WRITE, log, NULL);
1110 log->bdev_file = bdev_file;
1111 uuid_copy(&log->uuid, &sbi->loguuid);
1114 * initialize log:
1116 if ((rc = lmLogInit(log)))
1119 list_add(&log->journal_list, &jfs_external_logs);
1122 * add file system to log active file system list
1124 if ((rc = lmLogFileSystem(log, sbi, 1)))
1128 LOG_LOCK(log);
1129 list_add(&sbi->log_list, &log->sb_list);
1130 sbi->log = log;
1131 LOG_UNLOCK(log);
1140 list_del(&log->journal_list);
1141 lbmLogShutdown(log);
1143 close: /* close external log device */
1146 free: /* free log descriptor */
1148 kfree(log);
1156 struct jfs_log *log;
1159 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL)))
1161 INIT_LIST_HEAD(&log->sb_list);
1162 init_waitqueue_head(&log->syncwait);
1164 set_bit(log_INLINELOG, &log->flag);
1165 log->bdev_file = sb->s_bdev_file;
1166 log->base = addressPXD(&JFS_SBI(sb)->logpxd);
1167 log->size = lengthPXD(&JFS_SBI(sb)->logpxd) >>
1169 log->l2bsize = sb->s_blocksize_bits;
1173 * initialize log.
1175 if ((rc = lmLogInit(log))) {
1176 kfree(log);
1181 list_add(&JFS_SBI(sb)->log_list, &log->sb_list);
1182 JFS_SBI(sb)->log = log;
1215 JFS_SBI(sb)->log = dummy_log;
1225 * FUNCTION: log initialization at first log open.
1228 * initialize the log from log superblock.
1229 * set the log state in the superblock to LOGMOUNT and
1230 * write SYNCPT log record.
1232 * PARAMETER: log - log structure
1235 * -EINVAL - bad log magic number or superblock dirty
1240 int lmLogInit(struct jfs_log * log)
1250 jfs_info("lmLogInit: log:0x%p", log);
1253 LOGGC_LOCK_INIT(log);
1255 /* allocate/initialize the log write serialization lock */
1256 LOG_LOCK_INIT(log);
1258 LOGSYNC_LOCK_INIT(log);
1260 INIT_LIST_HEAD(&log->synclist);
1262 INIT_LIST_HEAD(&log->cqueue);
1263 log->flush_tblk = NULL;
1265 log->count = 0;
1268 * initialize log i/o
1270 if ((rc = lbmLogInit(log)))
1273 if (!test_bit(log_INLINELOG, &log->flag))
1274 log->l2bsize = L2LOGPSIZE;
1277 if (log->no_integrity) {
1283 bp = lbmAllocate(log , 0);
1284 log->bp = bp;
1288 * validate log superblock
1290 if ((rc = lbmRead(log, 1, &bpsuper)))
1308 /* initialize log from log superblock */
1309 if (test_bit(log_INLINELOG,&log->flag)) {
1310 if (log->size != le32_to_cpu(logsuper->size)) {
1314 jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x",
1315 log, (unsigned long long)log->base, log->size);
1317 if (!uuid_equal(&logsuper->uuid, &log->uuid)) {
1318 jfs_warn("wrong uuid on JFS log device");
1322 log->size = le32_to_cpu(logsuper->size);
1323 log->l2bsize = le32_to_cpu(logsuper->l2bsize);
1324 jfs_info("lmLogInit: external log:0x%p base:0x%Lx size:0x%x",
1325 log, (unsigned long long)log->base, log->size);
1328 log->page = le32_to_cpu(logsuper->end) / LOGPSIZE;
1329 log->eor = le32_to_cpu(logsuper->end) - (LOGPSIZE * log->page);
1332 * initialize for log append write mode
1334 /* establish current/end-of-log page/buffer */
1335 if ((rc = lbmRead(log, log->page, &bp)))
1341 le32_to_cpu(logsuper->end), log->page, log->eor,
1344 log->bp = bp;
1345 bp->l_pn = log->page;
1346 bp->l_eor = log->eor;
1349 if (log->eor >= LOGPSIZE - LOGPTLRSIZE)
1350 lmNextPage(log);
1353 * initialize log syncpoint
1357 * (i.e., log redo up to HERE !);
1359 * (to write log superblock update), but do not release to
1366 lrd.log.syncpt.sync = 0;
1367 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
1368 bp = log->bp;
1372 lbmWrite(log, bp, lbmWRITE | lbmSYNC, 0);
1380 log->serial = le32_to_cpu(logsuper->serial) + 1;
1381 logsuper->serial = cpu_to_le32(log->serial);
1382 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1388 log->logsize = (log->size - 2) << L2LOGPSIZE;
1389 log->lsn = lsn;
1390 log->syncpt = lsn;
1391 log->sync = log->syncpt;
1392 log->nextsync = LOGSYNC_DELTA(log->logsize);
1395 log->lsn, log->syncpt, log->sync);
1400 log->clsn = lsn;
1407 errout30: /* release log page */
1408 log->wqueue = NULL;
1412 errout20: /* release log superblock */
1416 lbmLogShutdown(log);
1426 * FUNCTION: remove file system <ipmnt> from active list of log <iplog>
1438 struct jfs_log *log = sbi->log;
1442 jfs_info("lmLogClose: log:0x%p", log);
1445 LOG_LOCK(log);
1447 LOG_UNLOCK(log);
1448 sbi->log = NULL;
1456 if (test_bit(log_INLINELOG, &log->flag)) {
1458 * in-line log in host file system
1460 rc = lmLogShutdown(log);
1461 kfree(log);
1465 if (!log->no_integrity)
1466 lmLogFileSystem(log, sbi, 0);
1468 if (!list_empty(&log->sb_list))
1478 if (log->no_integrity)
1482 * external log as separate logical volume
1484 list_del(&log->journal_list);
1485 bdev_file = log->bdev_file;
1486 rc = lmLogShutdown(log);
1490 kfree(log);
1509 void jfs_flush_journal(struct jfs_log *log, int wait)
1515 if (!log)
1518 jfs_info("jfs_flush_journal: log:0x%p wait=%d", log, wait);
1520 LOGGC_LOCK(log);
1522 if (!list_empty(&log->cqueue)) {
1527 target = list_entry(log->cqueue.prev, struct tblock, cqueue);
1529 if (test_bit(log_FLUSH, &log->flag)) {
1536 if (log->flush_tblk)
1537 log->flush_tblk = target;
1540 log->flush_tblk = target;
1541 set_bit(log_FLUSH, &log->flag);
1546 if (!(log->cflag & logGC_PAGEOUT)) {
1547 log->cflag |= logGC_PAGEOUT;
1548 lmGCwrite(log, 0);
1552 if ((wait > 1) || test_bit(log_SYNCBARRIER, &log->flag)) {
1554 set_bit(log_FLUSH, &log->flag);
1555 log->flush_tblk = NULL;
1563 LOGGC_UNLOCK(log);
1565 LOGGC_LOCK(log);
1568 LOGGC_UNLOCK(log);
1573 write_special_inodes(log, filemap_fdatawrite);
1579 if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
1582 write_special_inodes(log, filemap_fdatawrite);
1583 if (list_empty(&log->cqueue) &&
1584 list_empty(&log->synclist))
1588 assert(list_empty(&log->cqueue));
1591 if (!list_empty(&log->synclist)) {
1595 list_for_each_entry(lp, &log->synclist, synclist) {
1612 WARN_ON(!list_empty(&log->synclist));
1614 clear_bit(log_FLUSH, &log->flag);
1620 * FUNCTION: log shutdown at last LogClose().
1622 * write log syncpt record.
1625 * PARAMETER: log - log inode
1631 int lmLogShutdown(struct jfs_log * log)
1641 jfs_info("lmLogShutdown: log:0x%p", log);
1643 jfs_flush_journal(log, 2);
1647 * (i.e., log redo up to HERE !)
1653 lrd.log.syncpt.sync = 0;
1655 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
1656 bp = log->bp;
1659 lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0);
1660 lbmIOWait(log->bp, lbmFREE);
1661 log->bp = NULL;
1664 * synchronous update log superblock
1665 * mark log state as shutdown cleanly
1668 if ((rc = lbmRead(log, 1, &bpsuper)))
1674 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1678 lsn, log->page, log->eor);
1682 * shutdown per log i/o
1684 lbmLogShutdown(log);
1697 * file system into/from log active file system list.
1699 * PARAMETE: log - pointer to logs inode.
1701 * serial - pointer to returned log serial number
1707 static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi,
1717 * insert/remove file system device to log active file system list.
1719 if ((rc = lbmRead(log, 1, &bpsuper)))
1751 * synchronous write log superblock:
1754 * at file system mount, log super block is updated for
1755 * activation of the file system before any log record
1758 * flushed before log super block is updated for deactivation
1761 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1768 * log buffer manager (lbm)
1771 * special purpose buffer manager supporting log i/o requirements.
1773 * per log write queue:
1774 * log pageout occurs in serial order by fifo write queue and
1777 * (log->wrqueue points to the tail, and buffers are linked via
1779 * maintains log page in pageout ot waiting for pageout in serial pageout.
1785 * initialize per log I/O setup at lmLogInit()
1787 static int lbmLogInit(struct jfs_log * log)
1788 { /* log inode */
1792 jfs_info("lbmLogInit: log:0x%p", log);
1795 log->bp = NULL;
1797 /* initialize log device write queue */
1798 log->wqueue = NULL;
1801 * Each log has its own buffer pages allocated to it. These are
1803 * writing to the log does not block trying to allocate a page from
1804 * the page cache (for the log). This would be bad, since page
1806 * which would cause log activity. Was that clear? I'm trying to
1809 init_waitqueue_head(&log->free_wait);
1811 log->lbuf_free = NULL;
1833 lbuf->l_log = log;
1836 lbuf->l_freelist = log->lbuf_free;
1837 log->lbuf_free = lbuf;
1845 lbmLogShutdown(log);
1853 * finalize per log I/O setup at lmLogShutdown()
1855 static void lbmLogShutdown(struct jfs_log * log)
1859 jfs_info("lbmLogShutdown: log:0x%p", log);
1861 lbuf = log->lbuf_free;
1874 * allocate an empty log buffer
1876 static struct lbuf *lbmAllocate(struct jfs_log * log, int pn)
1882 * recycle from log buffer freelist if any
1885 LCACHE_SLEEP_COND(log->free_wait, (bp = log->lbuf_free), flags);
1886 log->lbuf_free = bp->l_freelist;
1895 bp->l_blkno = log->base + (pn << (L2LOGPSIZE - log->l2bsize));
1905 * release a log buffer to freelist
1920 struct jfs_log *log = bp->l_log;
1927 bp->l_freelist = log->lbuf_free;
1928 log->lbuf_free = bp;
1930 wake_up(&log->free_wait);
1938 * FUNCTION: add a log buffer to the log redrive list
1941 * bp - log buffer
1962 static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
1968 * allocate a log buffer
1970 *bpp = bp = lbmAllocate(log, pn);
1975 bio = bio_alloc(file_bdev(log->bdev_file), 1, REQ_OP_READ, GFP_NOFS);
1976 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
1983 if (log->no_integrity) {
2011 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag,
2021 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize));
2031 * insert bp at tail of write queue associated with log
2036 tail = log->wqueue;
2042 log->wqueue = bp;
2045 log->wqueue = bp;
2066 LOGGC_UNLOCK(log);
2068 LOGGC_LOCK(log);
2077 * (e.g., log superblock) write;
2079 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag)
2091 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize));
2107 * serialization: LCACHE_LOCK() is NOT held during log i/o;
2112 struct jfs_log *log = bp->l_log;
2117 if (!log->no_integrity)
2118 bdev = file_bdev(log->bdev_file);
2122 bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
2130 if (log->no_integrity) {
2174 struct jfs_log *log;
2189 jfs_err("lbmIODone: I/O error in JFS log");
2224 log = bp->l_log;
2225 log->clsn = (bp->l_pn << L2LOGPSIZE) + bp->l_ceor;
2233 tail = log->wqueue;
2238 * from log device write queue
2241 log->wqueue = NULL;
2248 * from log device write queue
2342 * FUNCTION: format file system log
2345 * log - volume log
2346 * logAddress - start address of log space in FS block
2347 * logSize - length of log space in FS block;
2355 int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize)
2361 int lspn; /* log sequence page number */
2369 sbi = list_entry(log->sb_list.next, struct jfs_sb_info, log_list);
2371 /* allocate a log buffer */
2372 bp = lbmAllocate(log, 1);
2377 * log space:
2380 * page 1 - log superblock;
2381 * page 2 - log data page: A SYNC log record is written
2383 * pages 3-N - log data page: set to empty log data pages;
2386 * init log superblock: log page 1
2406 * init pages 2 to npages-1 as log data pages:
2408 * log page sequence number (lpsn) initialization:
2415 * the N (= npages-2) data pages of the log is maintained as
2416 * a circular file for the log records;
2417 * lpsn grows by 1 monotonically as each log page is written
2418 * to the circular file of the log;
2421 * still work in find log end process, we have to simulate the
2422 * log wrap situation at the log format time.
2423 * The 1st log page written will have the highest lpsn. Then
2424 * the succeeding log pages will have ascending order of
2429 * initialize 1st log page to be written: lpsn = N - 1,
2430 * write a SYNCPT log record is written to this page
2440 lrd_ptr->log.syncpt.sync = 0;
2449 * initialize succeeding log pages: lpsn = 0, 1, ..., (N-2)
2465 * finalize log