{
struct xfs_sb *sbp = &mp->m_sb;
int min_logblocks; /* absolute minimum */
+ int max_logblocks; /* absolute max for this AG */
struct xfs_mount mount;
/* we need a temporary mount to calculate the minimum log size. */
return;
}
+ /*
+ * Make sure the log fits wholly within an AG
+ *
+ * XXX: If agf->freeblks ends up as 0 because the log uses all
+ * the free space, it causes the kernel all sorts of problems
+ * with per-ag reservations. Right now just back it off one
+ * block, but there's a whole can of worms here that needs to be
+ * opened to decide what is the valid maximum size of a log in
+ * an AG.
+ */
+ max_logblocks = libxfs_alloc_ag_max_usable(mp) - 1;
+
/* internal log - if no size specified, calculate automatically */
if (!cfg->logblocks) {
/* Use a 2048:1 fs:log ratio for most filesystems */
if (cfg->dblocks < MEGABYTES(300, cfg->blocklog))
cfg->logblocks = min_logblocks;
- /* Ensure the chosen size meets minimum log size requirements */
+ /* Ensure the chosen size fits within log size requirements */
cfg->logblocks = max(min_logblocks, cfg->logblocks);
-
- /*
- * Make sure the log fits wholly within an AG
- *
- * XXX: If agf->freeblks ends up as 0 because the log uses all
- * the free space, it causes the kernel all sorts of problems
- * with per-ag reservations. Right now just back it off one
- * block, but there's a whole can of worms here that needs to be
- * opened to decide what is the valid maximum size of a log in
- * an AG.
- */
- cfg->logblocks = min(cfg->logblocks,
- libxfs_alloc_ag_max_usable(mp) - 1);
+ cfg->logblocks = min(cfg->logblocks, max_logblocks);
/* and now clamp the size to the maximum supported size */
cfg->logblocks = min(cfg->logblocks, XFS_MAX_LOG_BLOCKS);
cfg->logblocks = XFS_MAX_LOG_BYTES >> cfg->blocklog;
validate_log_size(cfg->logblocks, cfg->blocklog, min_logblocks);
+ } else if (cfg->logblocks > max_logblocks) {
+ /* check specified log size */
+ fprintf(stderr,
+_("internal log size %lld too large, must be less than %d\n"),
+ (long long)cfg->logblocks,
+ max_logblocks);
+ usage();
}
if (cfg->logblocks > sbp->sb_agblocks - libxfs_prealloc_blocks(mp)) {