util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] chmem: Remove commit - chmem print warnings about failures always
@ 2025-08-22 15:09 Sumanth Korikkar
  0 siblings, 0 replies; 3+ messages in thread
From: Sumanth Korikkar @ 2025-08-22 15:09 UTC (permalink / raw)
  To: Karel Zak, util-linux; +Cc: Gerald Schaefer, sumanthk

Users do not care which blocks are set offline, when using size option
Consistently printing warnings/errors in this case may confuse them and
create the false impression that the enable/disable operation itself has
failed.

If size option succeeds, chmem should not print errors/warnings.

Hence, revert commit
48675a744 ("chmem: print warnings about failures always (not only with --verbose)")
---
 sys-utils/chmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index 52e6f49b3..bee2a90f8 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -146,12 +146,12 @@ static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
 
 		idxtostr(desc, index, str, sizeof(str));
 		rc = ul_path_writef_string(desc->sysmem, onoff, "%s/state", name);
-		if (rc != 0) {
+		if (rc != 0 && desc->verbose) {
 			if (enable)
-				warn(_("%s enable failed"), str);
+				fprintf(stdout, _("%s enable failed\n"), str);
 			else
-				warn(_("%s disable failed"), str);
-		} else if (desc->verbose) {
+				fprintf(stdout, _("%s disable failed\n"), str);
+		} else if (rc == 0 && desc->verbose) {
 			if (enable)
 				fprintf(stdout, _("%s enabled\n"), str);
 			else
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] chmem: Remove commit - chmem print warnings about failures always
@ 2025-08-22 15:13 Sumanth Korikkar
  2025-08-26  9:30 ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Sumanth Korikkar @ 2025-08-22 15:13 UTC (permalink / raw)
  To: Karel Zak, util-linux; +Cc: Gerald Schaefer, sumanthk

Users do not care which blocks are set offline, when using size option
Consistently printing warnings/errors in this case may confuse them and
create the false impression that the enable/disable operation itself has
failed.

If size option succeeds, chmem should not print errors/warnings.

Hence, revert commit
48675a744 ("chmem: print warnings about failures always (not only with --verbose)")

Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
---
Add signed-off-by

 sys-utils/chmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index 52e6f49b3..bee2a90f8 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -146,12 +146,12 @@ static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
 
 		idxtostr(desc, index, str, sizeof(str));
 		rc = ul_path_writef_string(desc->sysmem, onoff, "%s/state", name);
-		if (rc != 0) {
+		if (rc != 0 && desc->verbose) {
 			if (enable)
-				warn(_("%s enable failed"), str);
+				fprintf(stdout, _("%s enable failed\n"), str);
 			else
-				warn(_("%s disable failed"), str);
-		} else if (desc->verbose) {
+				fprintf(stdout, _("%s disable failed\n"), str);
+		} else if (rc == 0 && desc->verbose) {
 			if (enable)
 				fprintf(stdout, _("%s enabled\n"), str);
 			else
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] chmem: Remove commit - chmem print warnings about failures always
  2025-08-22 15:13 Sumanth Korikkar
@ 2025-08-26  9:30 ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2025-08-26  9:30 UTC (permalink / raw)
  To: Sumanth Korikkar; +Cc: util-linux, Gerald Schaefer

On Fri, Aug 22, 2025 at 05:13:53PM +0200, Sumanth Korikkar wrote:
>  sys-utils/chmem.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-26  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 15:09 [PATCH] chmem: Remove commit - chmem print warnings about failures always Sumanth Korikkar
  -- strict thread matches above, loose matches on Subject: below --
2025-08-22 15:13 Sumanth Korikkar
2025-08-26  9:30 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).