• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/jfs/

Lines Matching defs:log

21  *	jfs_logmgr.c: log manager
28 * log buffer manager:
29 * special purpose buffer manager supporting log i/o requirements.
30 * per log serial pageout of logpage
38 * log page during the pageout of previous/current log page(s) are
42 * transactions are committed asynchronously when the log page
46 * . a per log lock serialize log write.
47 * . a per log lock serialize group commit.
48 * . a per log lock serialize log open/close;
50 * TBD log integrity:
90 * log read/write serialization (per log)
92 #define LOG_LOCK_INIT(log) mutex_init(&(log)->loglock)
93 #define LOG_LOCK(log) mutex_lock(&((log)->loglock))
94 #define LOG_UNLOCK(log) mutex_unlock(&((log)->loglock))
98 * log group commit serialization (per log)
101 #define LOGGC_LOCK_INIT(log) spin_lock_init(&(log)->gclock)
102 #define LOGGC_LOCK(log) spin_lock_irq(&(log)->gclock)
103 #define LOGGC_UNLOCK(log) spin_unlock_irq(&(log)->gclock)
107 * log sync serialization (per log)
118 * log buffer cache synchronization
141 /* log buffer manager pageout control (cumulative, inclusive) */
161 * of log page
175 static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk,
178 static int lmNextPage(struct jfs_log * log);
179 static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi,
184 static int lbmLogInit(struct jfs_log * log);
185 static void lbmLogShutdown(struct jfs_log * log);
186 static struct lbuf *lbmAllocate(struct jfs_log * log, int);
189 static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp);
190 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, int cant_block);
191 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag);
195 static void lmGCwrite(struct jfs_log * log, int cant_block);
196 static int lmLogSync(struct jfs_log * log, int hard_sync);
213 static void write_special_inodes(struct jfs_log *log,
218 list_for_each_entry(sbi, &log->sb_list, log_list) {
228 * FUNCTION: write a log record;
232 * RETURN: lsn - offset to the next log record to write (end-of-log);
235 * note: todo: log error handler
237 int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
245 jfs_info("lmLog: log:0x%p tblk:0x%p, lrd:0x%p tlck:0x%p",
246 log, tblk, lrd, tlck);
248 LOG_LOCK(log);
250 /* log by (out-of-transaction) JFS ? */
254 /* log from page ? */
262 lsn = log->lsn;
264 LOGSYNC_LOCK(log, flags);
267 * initialize page lsn if first log write of the page
270 mp->log = log;
272 log->count++;
275 list_add_tail(&mp->synclist, &log->synclist);
283 * log records are used to reconstruct allocation map
288 * commit time to allow forwarding log syncpt past log
299 log->count++;
309 logdiff(diffp, mp->lsn, log);
310 logdiff(difft, tblk->lsn, log);
320 LOGSYNC_UNLOCK(log, flags);
323 * write the log record
326 lsn = lmWriteRecord(log, tblk, lrd, tlck);
329 * forward log syncpt if log reached next syncpt trigger
331 logdiff(diffp, lsn, log);
332 if (diffp >= log->nextsync)
333 lsn = lmLogSync(log, 0);
335 /* update end-of-log lsn */
336 log->lsn = lsn;
338 LOG_UNLOCK(log);
340 /* return end-of-log address */
347 * FUNCTION: move the log record to current log page
351 * RETURN: end-of-log address
356 lmWriteRecord(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
359 int lsn = 0; /* end-of-log address */
360 struct lbuf *bp; /* dst log page buffer */
361 struct logpage *lp; /* dst log page */
362 caddr_t dst; /* destination address in log page */
363 int dstoffset; /* end-of-log offset in log page */
364 int freespace; /* free space in log page */
378 /* retrieve destination log page to write */
379 bp = (struct lbuf *) log->bp;
381 dstoffset = log->eor;
383 /* any log data to write ? */
388 * move log record data
390 /* retrieve source meta-data page to log */
395 /* retrieve source in-memory inode to log */
428 lmNextPage(log);
430 bp = log->bp;
436 * move log vector data
453 lmNextPage(log);
455 bp = (struct lbuf *) log->bp;
464 * move log vector descriptor
481 * move log record descriptor
503 * end of log record descriptor
506 /* update last log record eor */
507 log->eor = dstoffset;
509 lsn = (log->page << L2LOGPSIZE) + dstoffset;
526 LOGGC_LOCK(log);
530 tblk->bp = log->bp;
531 tblk->pn = log->page;
532 tblk->eor = log->eor;
535 list_add_tail(&tblk->cqueue, &log->cqueue);
537 LOGGC_UNLOCK(log);
541 le16_to_cpu(lrd->type), log->bp, log->page, dstoffset);
549 lmNextPage(log);
551 bp = (struct lbuf *) log->bp;
566 * PARAMETER: log
572 static int lmNextPage(struct jfs_log * log)
575 int lspn; /* log sequence page number */
581 /* get current log page number and log sequence page number */
582 pn = log->page;
583 bp = log->bp;
587 LOGGC_LOCK(log);
593 if (list_empty(&log->cqueue))
596 tblk = list_entry(log->cqueue.prev, struct tblock, cqueue);
612 if (log->cflag & logGC_PAGEOUT) {
616 * of the pages since log pages will be added
620 lbmWrite(log, bp, 0, 0);
625 log->cflag |= logGC_PAGEOUT;
626 lmGCwrite(log, 0);
636 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE, 0);
638 LOGGC_UNLOCK(log);
643 /* if log wraps, the first data page of log is 2
646 log->page = (pn == log->size - 1) ? 2 : pn + 1;
647 log->eor = LOGPHDRSIZE; /* ? valid page empty/full at logRedo() */
649 /* allocate/initialize next log page buffer */
650 nextbp = lbmAllocate(log, log->page);
651 nextbp->l_eor = log->eor;
652 log->bp = nextbp;
654 /* initialize next log page */
674 * LOGGC_LOCK serializes log group commit queue, and
678 int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
682 LOGGC_LOCK(log);
689 LOGGC_UNLOCK(log);
692 jfs_info("lmGroup Commit: tblk = 0x%p, gcrtc = %d", tblk, log->gcrtc);
697 if ((!(log->cflag & logGC_PAGEOUT)) && (!list_empty(&log->cqueue)) &&
698 (!(tblk->xflag & COMMIT_LAZY) || test_bit(log_FLUSH, &log->flag)
705 log->cflag |= logGC_PAGEOUT;
707 lmGCwrite(log, 0);
714 LOGGC_UNLOCK(log);
724 LOGGC_UNLOCK(log);
730 log->gcrtc++;
734 LOGGC_LOCK(log), LOGGC_UNLOCK(log));
740 LOGGC_UNLOCK(log);
748 * initiate write of log page, building a group of all transactions
757 static void lmGCwrite(struct jfs_log * log, int cant_write)
766 * build the commit group of a log page
769 * transactions with COMMIT records on the same log page.
772 gcpn = list_entry(log->cqueue.next, struct tblock, cqueue)->pn;
774 list_for_each_entry(tblk, &log->cqueue, cqueue) {
786 * pageout to commit transactions on the log page.
797 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmGC,
805 lbmWrite(log, bp, lbmWRITE | lbmGC, cant_write);
815 * to disk, redriving log I/O if necessary.
825 struct jfs_log *log = bp->l_log;
829 //LOGGC_LOCK(log);
830 spin_lock_irqsave(&log->gclock, flags);
835 * group committed with the current log page
837 list_for_each_entry_safe(tblk, temp, &log->cqueue, cqueue) {
852 if (tblk == log->flush_tblk) {
853 /* we can stop flushing the log now */
854 clear_bit(log_FLUSH, &log->flag);
855 log->flush_tblk = NULL;
871 log->gcrtc--;
890 lbmWrite(log, bp, lbmWRITE | lbmRELEASE | lbmFREE,
897 * (whose COMMITs are after that of the last log page written.
899 * or lazy transactions are on a full (queued) log page,
903 if ((!list_empty(&log->cqueue)) &&
904 ((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) ||
905 test_bit(log_FLUSH, &log->flag) || jfs_tlocks_low))
909 lmGCwrite(log, 1);
917 log->cflag &= ~logGC_PAGEOUT;
919 //LOGGC_UNLOCK(log);
920 spin_unlock_irqrestore(&log->gclock, flags);
927 * FUNCTION: write log SYNCPT record for specified log
934 * PARAMETERS: log - log structure
941 static int lmLogSync(struct jfs_log * log, int hard_sync)
955 write_special_inodes(log, filemap_fdatawrite);
957 write_special_inodes(log, filemap_flush);
966 if (log->sync == log->syncpt) {
967 LOGSYNC_LOCK(log, flags);
968 if (list_empty(&log->synclist))
969 log->sync = log->lsn;
971 lp = list_entry(log->synclist.next,
973 log->sync = lp->lsn;
975 LOGSYNC_UNLOCK(log, flags);
983 if (log->sync != log->syncpt) {
988 lrd.log.syncpt.sync = cpu_to_le32(log->sync);
989 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
991 log->syncpt = log->sync;
993 lsn = log->lsn;
998 logsize = log->logsize;
1000 logdiff(written, lsn, log);
1007 * log wrapping
1011 * associated with log ?
1012 * option 3 - extend log ?
1017 * mark log wrapped, and continue.
1019 * mark log vaild for recovery.
1020 * if crashed during invalid state, log state
1021 * implies invald log, forcing fsck().
1023 /* mark log state log wrap in log superblock */
1024 /* log->state = LOGWRAP; */
1027 log->syncpt = log->sync = lsn;
1028 log->nextsync = delta;
1031 log->nextsync = written + more;
1034 * than 1/4 of the log size, stop new transactions from
1038 if (!test_bit(log_SYNCBARRIER, &log->flag) &&
1039 (written > LOGSYNC_BARRIER(logsize)) && log->active) {
1040 set_bit(log_SYNCBARRIER, &log->flag);
1041 jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn,
1042 log->syncpt);
1046 jfs_flush_journal(log, 0);
1055 * FUNCTION: write log SYNCPT record for specified log
1057 * PARAMETERS: log - log structure
1060 void jfs_syncpt(struct jfs_log *log, int hard_sync)
1061 { LOG_LOCK(log);
1062 lmLogSync(log, hard_sync);
1063 LOG_UNLOCK(log);
1069 * FUNCTION: open the log on first open;
1070 * insert filesystem in the active list of the log.
1073 * iplog - log inode (out)
1083 struct jfs_log *log;
1093 list_for_each_entry(log, &jfs_external_logs, journal_list) {
1094 if (log->bdev->bd_dev == sbi->logdev) {
1095 if (memcmp(log->uuid, sbi->loguuid,
1096 sizeof(log->uuid))) {
1102 * add file system to log active file system list
1104 if ((rc = lmLogFileSystem(log, sbi, 1))) {
1112 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL))) {
1116 INIT_LIST_HEAD(&log->sb_list);
1117 init_waitqueue_head(&log->syncwait);
1120 * external log as separate logical volume
1122 * file systems to log may have n-to-1 relationship;
1131 if ((rc = bd_claim(bdev, log))) {
1135 log->bdev = bdev;
1136 memcpy(log->uuid, sbi->loguuid, sizeof(log->uuid));
1139 * initialize log:
1141 if ((rc = lmLogInit(log)))
1144 list_add(&log->journal_list, &jfs_external_logs);
1147 * add file system to log active file system list
1149 if ((rc = lmLogFileSystem(log, sbi, 1)))
1153 LOG_LOCK(log);
1154 list_add(&sbi->log_list, &log->sb_list);
1155 sbi->log = log;
1156 LOG_UNLOCK(log);
1165 list_del(&log->journal_list);
1166 lbmLogShutdown(log);
1171 close: /* close external log device */
1174 free: /* free log descriptor */
1176 kfree(log);
1184 struct jfs_log *log;
1187 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL)))
1189 INIT_LIST_HEAD(&log->sb_list);
1190 init_waitqueue_head(&log->syncwait);
1192 set_bit(log_INLINELOG, &log->flag);
1193 log->bdev = sb->s_bdev;
1194 log->base = addressPXD(&JFS_SBI(sb)->logpxd);
1195 log->size = lengthPXD(&JFS_SBI(sb)->logpxd) >>
1197 log->l2bsize = sb->s_blocksize_bits;
1201 * initialize log.
1203 if ((rc = lmLogInit(log))) {
1204 kfree(log);
1209 list_add(&JFS_SBI(sb)->log_list, &log->sb_list);
1210 JFS_SBI(sb)->log = log;
1243 JFS_SBI(sb)->log = dummy_log;
1253 * FUNCTION: log initialization at first log open.
1256 * initialize the log from log superblock.
1257 * set the log state in the superblock to LOGMOUNT and
1258 * write SYNCPT log record.
1260 * PARAMETER: log - log structure
1263 * -EINVAL - bad log magic number or superblock dirty
1268 int lmLogInit(struct jfs_log * log)
1278 jfs_info("lmLogInit: log:0x%p", log);
1281 LOGGC_LOCK_INIT(log);
1283 /* allocate/initialize the log write serialization lock */
1284 LOG_LOCK_INIT(log);
1286 LOGSYNC_LOCK_INIT(log);
1288 INIT_LIST_HEAD(&log->synclist);
1290 INIT_LIST_HEAD(&log->cqueue);
1291 log->flush_tblk = NULL;
1293 log->count = 0;
1296 * initialize log i/o
1298 if ((rc = lbmLogInit(log)))
1301 if (!test_bit(log_INLINELOG, &log->flag))
1302 log->l2bsize = L2LOGPSIZE;
1305 if (log->no_integrity) {
1311 bp = lbmAllocate(log , 0);
1312 log->bp = bp;
1316 * validate log superblock
1318 if ((rc = lbmRead(log, 1, &bpsuper)))
1336 /* initialize log from log superblock */
1337 if (test_bit(log_INLINELOG,&log->flag)) {
1338 if (log->size != le32_to_cpu(logsuper->size)) {
1342 jfs_info("lmLogInit: inline log:0x%p base:0x%Lx "
1343 "size:0x%x", log,
1344 (unsigned long long) log->base, log->size);
1346 if (memcmp(logsuper->uuid, log->uuid, 16)) {
1347 jfs_warn("wrong uuid on JFS log device");
1350 log->size = le32_to_cpu(logsuper->size);
1351 log->l2bsize = le32_to_cpu(logsuper->l2bsize);
1352 jfs_info("lmLogInit: external log:0x%p base:0x%Lx "
1353 "size:0x%x", log,
1354 (unsigned long long) log->base, log->size);
1357 log->page = le32_to_cpu(logsuper->end) / LOGPSIZE;
1358 log->eor = le32_to_cpu(logsuper->end) - (LOGPSIZE * log->page);
1361 * initialize for log append write mode
1363 /* establish current/end-of-log page/buffer */
1364 if ((rc = lbmRead(log, log->page, &bp)))
1370 le32_to_cpu(logsuper->end), log->page, log->eor,
1373 log->bp = bp;
1374 bp->l_pn = log->page;
1375 bp->l_eor = log->eor;
1378 if (log->eor >= LOGPSIZE - LOGPTLRSIZE)
1379 lmNextPage(log);
1382 * initialize log syncpoint
1386 * (i.e., log redo up to HERE !);
1388 * (to write log superblock update), but do not release to
1395 lrd.log.syncpt.sync = 0;
1396 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
1397 bp = log->bp;
1401 lbmWrite(log, bp, lbmWRITE | lbmSYNC, 0);
1409 log->serial = le32_to_cpu(logsuper->serial) + 1;
1410 logsuper->serial = cpu_to_le32(log->serial);
1411 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1417 log->logsize = (log->size - 2) << L2LOGPSIZE;
1418 log->lsn = lsn;
1419 log->syncpt = lsn;
1420 log->sync = log->syncpt;
1421 log->nextsync = LOGSYNC_DELTA(log->logsize);
1424 log->lsn, log->syncpt, log->sync);
1429 log->clsn = lsn;
1436 errout30: /* release log page */
1437 log->wqueue = NULL;
1441 errout20: /* release log superblock */
1445 lbmLogShutdown(log);
1455 * FUNCTION: remove file system <ipmnt> from active list of log <iplog>
1467 struct jfs_log *log = sbi->log;
1471 jfs_info("lmLogClose: log:0x%p", log);
1474 LOG_LOCK(log);
1476 LOG_UNLOCK(log);
1477 sbi->log = NULL;
1485 if (test_bit(log_INLINELOG, &log->flag)) {
1487 * in-line log in host file system
1489 rc = lmLogShutdown(log);
1490 kfree(log);
1494 if (!log->no_integrity)
1495 lmLogFileSystem(log, sbi, 0);
1497 if (!list_empty(&log->sb_list))
1507 if (log->no_integrity)
1511 * external log as separate logical volume
1513 list_del(&log->journal_list);
1514 bdev = log->bdev;
1515 rc = lmLogShutdown(log);
1520 kfree(log);
1539 void jfs_flush_journal(struct jfs_log *log, int wait)
1545 if (!log)
1548 jfs_info("jfs_flush_journal: log:0x%p wait=%d", log, wait);
1550 LOGGC_LOCK(log);
1552 if (!list_empty(&log->cqueue)) {
1557 target = list_entry(log->cqueue.prev, struct tblock, cqueue);
1559 if (test_bit(log_FLUSH, &log->flag)) {
1566 if (log->flush_tblk)
1567 log->flush_tblk = target;
1570 log->flush_tblk = target;
1571 set_bit(log_FLUSH, &log->flag);
1576 if (!(log->cflag & logGC_PAGEOUT)) {
1577 log->cflag |= logGC_PAGEOUT;
1578 lmGCwrite(log, 0);
1582 if ((wait > 1) || test_bit(log_SYNCBARRIER, &log->flag)) {
1584 set_bit(log_FLUSH, &log->flag);
1585 log->flush_tblk = NULL;
1593 LOGGC_UNLOCK(log);
1596 LOGGC_LOCK(log);
1599 LOGGC_UNLOCK(log);
1604 write_special_inodes(log, filemap_fdatawrite);
1610 if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
1613 write_special_inodes(log, filemap_fdatawrite);
1614 if (list_empty(&log->cqueue) &&
1615 list_empty(&log->synclist))
1619 assert(list_empty(&log->cqueue));
1622 if (!list_empty(&log->synclist)) {
1626 list_for_each_entry(lp, &log->synclist, synclist) {
1643 WARN_ON(!list_empty(&log->synclist));
1645 clear_bit(log_FLUSH, &log->flag);
1651 * FUNCTION: log shutdown at last LogClose().
1653 * write log syncpt record.
1656 * PARAMETER: log - log inode
1662 int lmLogShutdown(struct jfs_log * log)
1672 jfs_info("lmLogShutdown: log:0x%p", log);
1674 jfs_flush_journal(log, 2);
1678 * (i.e., log redo up to HERE !)
1684 lrd.log.syncpt.sync = 0;
1686 lsn = lmWriteRecord(log, NULL, &lrd, NULL);
1687 bp = log->bp;
1690 lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0);
1691 lbmIOWait(log->bp, lbmFREE);
1692 log->bp = NULL;
1695 * synchronous update log superblock
1696 * mark log state as shutdown cleanly
1699 if ((rc = lbmRead(log, 1, &bpsuper)))
1705 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1709 lsn, log->page, log->eor);
1713 * shutdown per log i/o
1715 lbmLogShutdown(log);
1728 * file system into/from log active file system list.
1730 * PARAMETE: log - pointer to logs inode.
1732 * serial - pointer to returned log serial number
1738 static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi,
1748 * insert/remove file system device to log active file system list.
1750 if ((rc = lbmRead(log, 1, &bpsuper)))
1781 * synchronous write log superblock:
1784 * at file system mount, log super block is updated for
1785 * activation of the file system before any log record
1788 * flushed before log super block is updated for deactivation
1791 lbmDirectWrite(log, bpsuper, lbmWRITE | lbmRELEASE | lbmSYNC);
1798 * log buffer manager (lbm)
1801 * special purpose buffer manager supporting log i/o requirements.
1803 * per log write queue:
1804 * log pageout occurs in serial order by fifo write queue and
1807 * (log->wrqueue points to the tail, and buffers are linked via
1809 * maintains log page in pageout ot waiting for pageout in serial pageout.
1815 * initialize per log I/O setup at lmLogInit()
1817 static int lbmLogInit(struct jfs_log * log)
1818 { /* log inode */
1822 jfs_info("lbmLogInit: log:0x%p", log);
1825 log->bp = NULL;
1827 /* initialize log device write queue */
1828 log->wqueue = NULL;
1831 * Each log has its own buffer pages allocated to it. These are
1833 * writing to the log does not block trying to allocate a page from
1834 * the page cache (for the log). This would be bad, since page
1836 * which would cause log activity. Was that clear? I'm trying to
1839 init_waitqueue_head(&log->free_wait);
1841 log->lbuf_free = NULL;
1864 lbuf->l_log = log;
1867 lbuf->l_freelist = log->lbuf_free;
1868 log->lbuf_free = lbuf;
1876 lbmLogShutdown(log);
1884 * finalize per log I/O setup at lmLogShutdown()
1886 static void lbmLogShutdown(struct jfs_log * log)
1890 jfs_info("lbmLogShutdown: log:0x%p", log);
1892 lbuf = log->lbuf_free;
1905 * allocate an empty log buffer
1907 static struct lbuf *lbmAllocate(struct jfs_log * log, int pn)
1913 * recycle from log buffer freelist if any
1916 LCACHE_SLEEP_COND(log->free_wait, (bp = log->lbuf_free), flags);
1917 log->lbuf_free = bp->l_freelist;
1926 bp->l_blkno = log->base + (pn << (L2LOGPSIZE - log->l2bsize));
1936 * release a log buffer to freelist
1951 struct jfs_log *log = bp->l_log;
1958 bp->l_freelist = log->lbuf_free;
1959 log->lbuf_free = bp;
1961 wake_up(&log->free_wait);
1969 * FUNCTION: add a log buffer to the log redrive list
1972 * bp - log buffer
1993 static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
1999 * allocate a log buffer
2001 *bpp = bp = lbmAllocate(log, pn);
2008 bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
2009 bio->bi_bdev = log->bdev;
2043 static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag,
2053 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize));
2063 * insert bp at tail of write queue associated with log
2068 tail = log->wqueue;
2074 log->wqueue = bp;
2077 log->wqueue = bp;
2098 LOGGC_UNLOCK(log);
2100 LOGGC_LOCK(log);
2109 * (e.g., log superblock) write;
2111 static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag)
2123 log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize));
2139 * serialization: LCACHE_LOCK() is NOT held during log i/o;
2144 struct jfs_log *log = bp->l_log;
2149 bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
2150 bio->bi_bdev = log->bdev;
2163 if (log->no_integrity) {
2207 struct jfs_log *log;
2222 jfs_err("lbmIODone: I/O error in JFS log");
2257 log = bp->l_log;
2258 log->clsn = (bp->l_pn << L2LOGPSIZE) + bp->l_ceor;
2266 tail = log->wqueue;
2271 * from log device write queue
2274 log->wqueue = NULL;
2281 * from log device write queue
2373 int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize)
2379 int lspn; /* log sequence page number */
2387 sbi = list_entry(log->sb_list.next, struct jfs_sb_info, log_list);
2389 /* allocate a log buffer */
2390 bp = lbmAllocate(log, 1);
2395 * log space:
2398 * page 1 - log superblock;
2399 * page 2 - log data page: A SYNC log record is written
2401 * pages 3-N - log data page: set to empty log data pages;
2404 * init log superblock: log page 1
2424 * init pages 2 to npages-1 as log data pages:
2426 * log page sequence number (lpsn) initialization:
2433 * the N (= npages-2) data pages of the log is maintained as
2434 * a circular file for the log records;
2435 * lpsn grows by 1 monotonically as each log page is written
2436 * to the circular file of the log;
2439 * still work in find log end process, we have to simulate the
2440 * log wrap situation at the log format time.
2441 * The 1st log page written will have the highest lpsn. Then
2442 * the succeeding log pages will have ascending order of
2447 * initialize 1st log page to be written: lpsn = N - 1,
2448 * write a SYNCPT log record is written to this page
2458 lrd_ptr->log.syncpt.sync = 0;
2467 * initialize succeeding log pages: lpsn = 0, 1, ..., (N-2)
2483 * finalize log