Skip to contentSkip to conversation

repair: warn if running in low memory mode

PATCH In review Dave Chinner 3 participants 3 messages Jan 4, 2011 – Jan 5, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 repair: warn if running in low memory mode

From: Dave Chinner <[email protected]>

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.

---
 repair/xfs_repair.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
repair/xfs_repair.c +9 -1
index e36eeae..eea1b34 100644
@@ -650,12 +650,20 @@ main(int argc, char **argv)
 			 * Turn off prefetch and minimise libxfs cache if
 			 * physical memory is deemed insufficient
 			 */
-			if (max_mem_specified)
+			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"),
 					mem_used / 1024);
+			} else {
+				do_warn(_("Not enough RAM available for repair "
+					"to enable prefetching. This will be "
+					"_slow_.\n"
+					"You need at least %luMB RAM to run "
+					"with prefetching enabled."),
+					mem_used * 1280 / (1024 * 1024));
+			}
 			do_prefetch = 0;
 			libxfs_bhash_size = 64;
 		} else {
Signature · 6 lines
1.7.2.3

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dave Chinner

From: Dave Chinner <[email protected]>

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.

Looks good,

repair/xfs_repair.c main(int argc, char **argv) · line 665

Quoted 6 lines
repair/xfs_repair.c +6 -0
+				do_warn(_("Not enough RAM available for repair "
+					"to enable prefetching. This will be "
+					"_slow_.\n"
+					"You need at least %luMB RAM to run "
+					"with prefetching enabled."),
+					mem_used * 1280 / (1024 * 1024));

Maybe but the strings on a separate line to be easier readable and greppable, e.g.:

do_warn(
_("Not enough RAM available for repair to enable prefetching. "
"This will be _slow_.\n"
"You need at least %luMB RAM to run with prefetching enabled."),

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#2 lore raw
In reply to Dave Chinner
Quoted 9 lines · Dave Chinner

From: Dave Chinner <[email protected]>

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.

This looks good.

If someone specifies a maximum memory amount using -m, but that amount exceeds the memory available and/or the process' address space rlimit, it is silently reduced to the maximum possible. That may then be followed by the "...please increase it..." message, which might be confusing and possibly annoying. Maybe a single message that was a bit more informative would suffice, whether or not max_mem was specified.

Just a thought. Your change looks fine.

Quoted 21 lines
---
 repair/xfs_repair.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
repair/xfs_repair.c +2 -1
index e36eeae..eea1b34 100644
@@ -650,12 +650,20 @@ main(int argc, char **argv)
 			 * Turn off prefetch and minimise libxfs cache if
 			 * physical memory is deemed insufficient
 			 */
-			if (max_mem_specified)
+			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"),
 					mem_used / 1024);
+			} else {

repair/xfs_repair.c main(int argc, char **argv) · line 669

Quoted 10 lines
repair/xfs_repair.c +7 -0
+				do_warn(_("Not enough RAM available for repair "
+					"to enable prefetching. This will be "
+					"_slow_.\n"
+					"You need at least %luMB RAM to run "
+					"with prefetching enabled."),
+					mem_used * 1280 / (1024 * 1024));
+			}
 			do_prefetch = 0;
 			libxfs_bhash_size = 64;
 		} else {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs