From: Dave Chinner Date: Thu, 6 Jan 2011 06:24:00 +0000 (+1100) Subject: repair: warn if running in low memory mode X-Git-Tag: v3.1.5~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0335a835729ce5da6890de1634814240c497dff7;p=thirdparty%2Fxfsprogs-dev.git repair: warn if running in low memory mode When checking large filesystems, xfs_repair makes an estimate of how much RAM it will need to execute effectively. If the amount of RAM is less than this, it reduces the bhash size and turns of prefetching, which will substantially slow down the repair process. Add a warning that indicates this is happening, along with a recommendation of how much RAM repair calculates it needs to run with prefetching enabled. Signed-off-by: Dave Chinner Reviewed-by: Alex Elder Reviewed-by: Christoph Hellwig --- diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index e36eeae9a..1d9ad460e 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -650,12 +650,18 @@ main(int argc, char **argv) * Turn off prefetch and minimise libxfs cache if * physical memory is deemed insufficient */ - if (max_mem_specified) - do_abort(_("Required memory for repair is " - "greater that the maximum specified " - "with the -m option. Please increase " - "it to at least %lu.\n"), + if (max_mem_specified) { + do_abort( + _("Required memory for repair is greater that the maximum specified\n" + "with the -m option. Please increase it to at least %lu.\n"), mem_used / 1024); + } else { + do_warn( + _("Not enough RAM available for repair to enable prefetching.\n" + "This will be _slow_.\n" + "You need at least %luMB RAM to run with prefetching enabled.\n"), + mem_used * 1280 / (1024 * 1024)); + } do_prefetch = 0; libxfs_bhash_size = 64; } else {