Commit ee251604 authored by Stephen Lord's avatar Stephen Lord

[XFS] Scale default number of log buffers based on memory size

SGI Modid: 2.5.x-xfs:slinx:153273a
parent 74a6c1d3
......@@ -1066,7 +1066,7 @@ xlog_get_iclog_buffer_size(xfs_mount_t *mp,
if (mp->m_logbufs == 0) {
xlog_debug = 0;
xlog_devt = log->l_dev;
log->l_iclog_bufs = XLOG_NUM_ICLOGS;
log->l_iclog_bufs = XLOG_MIN_ICLOGS;
} else
#endif
{
......@@ -1074,9 +1074,16 @@ xlog_get_iclog_buffer_size(xfs_mount_t *mp,
* This is the normal path. If m_logbufs == -1, then the
* admin has chosen to use the system defaults for logbuffers.
*/
if (mp->m_logbufs == -1)
log->l_iclog_bufs = XLOG_NUM_ICLOGS;
else
if (mp->m_logbufs == -1) {
if (xfs_physmem <= btoc(128*1024*1024)) {
log->l_iclog_bufs = XLOG_MIN_ICLOGS;
} else if (xfs_physmem <= btoc(400*1024*1024)) {
log->l_iclog_bufs = XLOG_MED_ICLOGS;;
} else {
/* 256K with 32K bufs */
log->l_iclog_bufs = XLOG_MAX_ICLOGS;
}
} else
log->l_iclog_bufs = mp->m_logbufs;
#if defined(DEBUG) || defined(XLOG_NOLOG)
......
......@@ -50,7 +50,8 @@ struct xfs_mount;
* Macros, structures, prototypes for internal log manager use.
*/
#define XLOG_NUM_ICLOGS 2
#define XLOG_MIN_ICLOGS 2
#define XLOG_MED_ICLOGS 4
#define XLOG_MAX_ICLOGS 8
#define XLOG_CALLBACK_SIZE 10
#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Illegal cycle number */
......
......@@ -235,11 +235,11 @@ xfs_start_flags(
}
if (ap->logbufs != 0 && ap->logbufs != -1 &&
(ap->logbufs < XLOG_NUM_ICLOGS ||
(ap->logbufs < XLOG_MIN_ICLOGS ||
ap->logbufs > XLOG_MAX_ICLOGS)) {
cmn_err(CE_WARN,
"XFS: invalid logbufs value: %d [not %d-%d]",
ap->logbufs, XLOG_NUM_ICLOGS, XLOG_MAX_ICLOGS);
ap->logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
return XFS_ERROR(EINVAL);
}
mp->m_logbufs = ap->logbufs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment