linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl, ars: don't invalidate the user-provided command
@ 2018-06-01 23:28 Vishal Verma
  2018-06-02  0:05 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Vishal Verma @ 2018-06-01 23:28 UTC (permalink / raw)
  To: linux-nvdimm

In ndctl_cmd_ars_in_progress, which expects a successfully completed
ars_status command, we used to invalidate the command by setting its
status to '1', so that the user has to provide a fresh ars_status
command the next time this check is performed.

In hindsight, this is needless and violates the principle of least
surprise. We shouldn't be touching the user's data (command), so remove
this invalidation. If the user uses the same ars_status command again,
we will simply report that ARS is still in progress.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/lib/ars.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c
index b199646..48a9819 100644
--- a/ndctl/lib/ars.c
+++ b/ndctl/lib/ars.c
@@ -224,16 +224,7 @@ NDCTL_EXPORT int ndctl_cmd_ars_in_progress(struct ndctl_cmd *cmd)
 	if (!validate_ars_stat(ctx, cmd))
 		return 0;
 
-	if (ndctl_cmd_get_firmware_status(cmd) == 1 << 16) {
-		/*
-		 * If in-progress, invalidate the ndctl_cmd, so
-		 * that if we're called again without a fresh
-		 * ars_status command, we fail.
-		 */
-		cmd->status = 1;
-		return 1;
-	}
-	return 0;
+	return (ndctl_cmd_get_firmware_status(cmd) == 1 << 16);
 }
 
 NDCTL_EXPORT unsigned int ndctl_cmd_ars_num_records(struct ndctl_cmd *ars_stat)
-- 
2.17.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH] ndctl, ars: don't invalidate the user-provided command
  2018-06-01 23:28 [ndctl PATCH] ndctl, ars: don't invalidate the user-provided command Vishal Verma
@ 2018-06-02  0:05 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2018-06-02  0:05 UTC (permalink / raw)
  To: Vishal Verma; +Cc: linux-nvdimm

On Fri, Jun 1, 2018 at 4:28 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> In ndctl_cmd_ars_in_progress, which expects a successfully completed
> ars_status command, we used to invalidate the command by setting its
> status to '1', so that the user has to provide a fresh ars_status
> command the next time this check is performed.
>
> In hindsight, this is needless and violates the principle of least
> surprise. We shouldn't be touching the user's data (command), so remove
> this invalidation. If the user uses the same ars_status command again,
> we will simply report that ARS is still in progress.
>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  ndctl/lib/ars.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)

Looks good,

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2018-06-02  0:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-01 23:28 [ndctl PATCH] ndctl, ars: don't invalidate the user-provided command Vishal Verma
2018-06-02  0:05 ` Dan Williams

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).