*/
libxfs_log_clear(NULL, buf->data, logstart, length, &buf->owner->uuid,
xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1,
- mp->m_sb.sb_logsunit, XLOG_FMT, cycle);
+ mp->m_sb.sb_logsunit, XLOG_FMT, cycle, true);
if (do_write(buf->owner, buf))
target[tcarg->id].state = INACTIVE;
}
libxfs_log_clear(NULL, iocur_top->data, logstart, logblocks,
&mp->m_sb.sb_uuid, logversion,
- mp->m_sb.sb_logsunit, XLOG_FMT, cycle);
+ mp->m_sb.sb_logsunit, XLOG_FMT, cycle, true);
break;
case 1:
/* keep the dirty log */
(xfs_extlen_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks),
uuidp,
xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1,
- mp->m_sb.sb_logsunit, XLOG_FMT, cycle);
+ mp->m_sb.sb_logsunit, XLOG_FMT, cycle, true);
if (error) {
dbprintf(_("ERROR: cannot clear the log\n"));
return 0;
*/
#define XLOG_INIT_CYCLE 1
extern int libxfs_log_clear(struct xfs_buftarg *, char *, xfs_daddr_t,
- uint, uuid_t *, int, int, int, int);
+ uint, uuid_t *, int, int, int, int, bool);
extern int libxfs_log_header(char *, uuid_t *, int, int, int, xfs_lsn_t,
xfs_lsn_t, libxfs_get_block_t *, void *);
int version,
int sunit, /* bytes */
int fmt,
- int cycle)
+ int cycle,
+ bool max)
{
struct xfs_buf *bp = NULL;
int len;
if (cycle == XLOG_INIT_CYCLE)
return 0;
+ /*
+ * Bump the record size for a full log format if the caller allows it.
+ * This is primarily for performance reasons and most callers don't care
+ * about record size since the log is clean after we're done.
+ */
+ if (max)
+ len = BTOBB(BDSTRAT_SIZE);
+
/*
* Otherwise, fill everything beyond the initial record with records of
* the previous cycle so the kernel head/tail detection works correctly.
dptr += BBTOB(len);
end_blk = start + length;
- len = min(end_blk - blk, BTOBB(BDSTRAT_SIZE));
+ len = min(end_blk - blk, len);
while (blk < end_blk) {
lsn = xlog_assign_lsn(cycle, blk - start);
tail_lsn = xlog_assign_lsn(cycle, blk - start - len);
blk += len;
if (dptr)
dptr += BBTOB(len);
- len = min(end_blk - blk, BTOBB(BDSTRAT_SIZE));
+ len = min(end_blk - blk, len);
}
return 0;
libxfs_log_clear(mp->m_logdev_targp, NULL,
XFS_FSB_TO_DADDR(mp, logstart),
(xfs_extlen_t)XFS_FSB_TO_BB(mp, logblocks),
- &sbp->sb_uuid, logversion, lsunit, XLOG_FMT, XLOG_INIT_CYCLE);
+ &sbp->sb_uuid, logversion, lsunit, XLOG_FMT, XLOG_INIT_CYCLE,
+ false);
mp = libxfs_mount(mp, sbp, xi.ddev, xi.logdev, xi.rtdev, 0);
if (mp == NULL) {
(xfs_extlen_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks),
&mp->m_sb.sb_uuid,
xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1,
- mp->m_sb.sb_logsunit, XLOG_FMT, XLOG_INIT_CYCLE);
+ mp->m_sb.sb_logsunit, XLOG_FMT, XLOG_INIT_CYCLE, true);
/* update the log data structure with new state */
error = xlog_find_tail(log, &head_blk, &tail_blk);
do_warn(_("Format log to cycle %d.\n"), new_cycle);
libxfs_log_clear(log->l_dev, NULL, logstart, logblocks,
&mp->m_sb.sb_uuid, logversion, mp->m_sb.sb_logsunit,
- XLOG_FMT, new_cycle);
+ XLOG_FMT, new_cycle, true);
}
int