diff mbox

[ndctl,2/4] libndctl: improve debug prints in wait_for_scrub_completion

Message ID 20180503185050.7559-2-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vishal Verma May 3, 2018, 6:50 p.m. UTC
ndctl_bus_wait_for_scrub_completion() printed the same debug message
irrespective of whether we encountered a failure or not. Add a newe
debug message that is printed for failing cases.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/lib/libndctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Dan Williams May 4, 2018, 12:04 a.m. UTC | #1
On Thu, May 3, 2018 at 11:50 AM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> ndctl_bus_wait_for_scrub_completion() printed the same debug message
> irrespective of whether we encountered a failure or not. Add a newe

*new

> debug message that is printed for failing cases.
>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  ndctl/lib/libndctl.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index 2a3ef0c..6733b85 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -1248,7 +1248,11 @@ NDCTL_EXPORT int ndctl_bus_wait_for_scrub_completion(struct ndctl_bus *bus)
>                 }
>         }
>
> -       dbg(ctx, "bus%d: scrub complete\n", ndctl_bus_get_id(bus));
> +       if (rc == 0)
> +               dbg(ctx, "bus%d: scrub complete\n", ndctl_bus_get_id(bus));
> +       else
> +               dbg(ctx, "bus%d: error waiting for scrub completion: %s\n",
> +                       ndctl_bus_get_id(bus), strerror(-rc));
>         if (fd)
>                 close (fd);
>         return rc;
> --
> 2.14.3
>

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff mbox

Patch

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 2a3ef0c..6733b85 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1248,7 +1248,11 @@  NDCTL_EXPORT int ndctl_bus_wait_for_scrub_completion(struct ndctl_bus *bus)
 		}
 	}
 
-	dbg(ctx, "bus%d: scrub complete\n", ndctl_bus_get_id(bus));
+	if (rc == 0)
+		dbg(ctx, "bus%d: scrub complete\n", ndctl_bus_get_id(bus));
+	else
+		dbg(ctx, "bus%d: error waiting for scrub completion: %s\n",
+			ndctl_bus_get_id(bus), strerror(-rc));
 	if (fd)
 		close (fd);
 	return rc;