Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nvme-cli] huawei: filter out the partition disks
@ 2021-10-14  9:11 chengjike
  2021-10-18  3:49 ` Chengjike (ISSP)
  2021-10-18  5:30 ` Chaitanya Kulkarni
  0 siblings, 2 replies; 4+ messages in thread
From: chengjike @ 2021-10-14  9:11 UTC (permalink / raw)
  To: kbusch, linux-nvme; +Cc: sunao.sun, chengjike.cheng, jiangtao62

When using "nvme huawei list" command, if the current disk has partitions,
disk partitions will be displayed. This is not expected!
So filter out the disk partitions through disk name.

Signed-off-by: chengjike <chengjike.cheng@huawei.com>
---
 plugins/huawei/huawei-nvme.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c
index 679578f..96de335 100644
--- a/plugins/huawei/huawei-nvme.c
+++ b/plugins/huawei/huawei-nvme.c
@@ -296,6 +296,8 @@ static int huawei_list(int argc, char **argv, struct command *command,
 	unsigned int i, n, fd, ret;
 	unsigned int huawei_num = 0;
 	int fmt;
+	int ctrl, ns, part;
+
 	const char *desc = "Retrieve basic information for the given huawei device";
 	struct config {
 		char *output_format;
@@ -326,6 +328,8 @@ static int huawei_list(int argc, char **argv, struct command *command,
 	}
 
 	for (i = 0; i < n; i++) {
+		if (sscanf(devices[i]->d_name, "nvme%dn%dp%d", &ctrl, &ns, &part) == 3) 
+			continue;
 		snprintf(path, sizeof(path), "/dev/%s", devices[i]->d_name);
 		fd = open(path, O_RDONLY);
 		ret = huawei_get_nvme_info(fd, &list_items[huawei_num], path);
-- 
2.21.0.windows.1



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

* Re: [PATCH nvme-cli] huawei: filter out the partition disks
  2021-10-14  9:11 [PATCH nvme-cli] huawei: filter out the partition disks chengjike
@ 2021-10-18  3:49 ` Chengjike (ISSP)
  2021-10-18  5:30 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 4+ messages in thread
From: Chengjike (ISSP) @ 2021-10-18  3:49 UTC (permalink / raw)
  To: kbusch, linux-nvme; +Cc: sunao.sun, jiangtao62


ping


在 2021/10/14 17:11, chengjike 写道:
> When using "nvme huawei list" command, if the current disk has partitions,
> disk partitions will be displayed. This is not expected!
> So filter out the disk partitions through disk name.
>
> Signed-off-by: chengjike <chengjike.cheng@huawei.com>
> ---
>   plugins/huawei/huawei-nvme.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c
> index 679578f..96de335 100644
> --- a/plugins/huawei/huawei-nvme.c
> +++ b/plugins/huawei/huawei-nvme.c
> @@ -296,6 +296,8 @@ static int huawei_list(int argc, char **argv, struct command *command,
>   	unsigned int i, n, fd, ret;
>   	unsigned int huawei_num = 0;
>   	int fmt;
> +	int ctrl, ns, part;
> +
>   	const char *desc = "Retrieve basic information for the given huawei device";
>   	struct config {
>   		char *output_format;
> @@ -326,6 +328,8 @@ static int huawei_list(int argc, char **argv, struct command *command,
>   	}
>   
>   	for (i = 0; i < n; i++) {
> +		if (sscanf(devices[i]->d_name, "nvme%dn%dp%d", &ctrl, &ns, &part) == 3)
> +			continue;
>   		snprintf(path, sizeof(path), "/dev/%s", devices[i]->d_name);
>   		fd = open(path, O_RDONLY);
>   		ret = huawei_get_nvme_info(fd, &list_items[huawei_num], path);


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

* Re: [PATCH nvme-cli] huawei: filter out the partition disks
  2021-10-14  9:11 [PATCH nvme-cli] huawei: filter out the partition disks chengjike
  2021-10-18  3:49 ` Chengjike (ISSP)
@ 2021-10-18  5:30 ` Chaitanya Kulkarni
  2021-10-18  7:06   ` Chengjike (ISSP)
  1 sibling, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-18  5:30 UTC (permalink / raw)
  To: chengjike, kbusch@kernel.org, linux-nvme@lists.infradead.org
  Cc: sunao.sun@huawei.com, jiangtao62@huawei.com

On 10/14/21 02:11, chengjike wrote:
> When using "nvme huawei list" command, if the current disk has partitions,
> disk partitions will be displayed. This is not expected!
> So filter out the disk partitions through disk name.
> 


Is this specific to the Huawei or generic to all the vendors ?



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

* Re: [PATCH nvme-cli] huawei: filter out the partition disks
  2021-10-18  5:30 ` Chaitanya Kulkarni
@ 2021-10-18  7:06   ` Chengjike (ISSP)
  0 siblings, 0 replies; 4+ messages in thread
From: Chengjike (ISSP) @ 2021-10-18  7:06 UTC (permalink / raw)
  To: Chaitanya Kulkarni, kbusch@kernel.org,
	linux-nvme@lists.infradead.org
  Cc: sunao.sun@huawei.com, jiangtao62@huawei.com


在 2021/10/18 13:30, Chaitanya Kulkarni 写道:
> On 10/14/21 02:11, chengjike wrote:
>> When using "nvme huawei list" command, if the current disk has partitions,
>> disk partitions will be displayed. This is not expected!
>> So filter out the disk partitions through disk name.
>>
>
> Is this specific to the Huawei or generic to all the vendors ?
>

This is a fix patch for huawei, and other vendors don't have this problem.

When the following patch is merged(when replace huawei_scan_dev_filter 
with scan_dev_filter,
the codes of partition filtering are deleted), it has this issue.
nvme-cli: Code reorg
commit: a3b3e93286a30852b7973a524b47ef35d42aa6cf




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

end of thread, other threads:[~2021-10-18  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-14  9:11 [PATCH nvme-cli] huawei: filter out the partition disks chengjike
2021-10-18  3:49 ` Chengjike (ISSP)
2021-10-18  5:30 ` Chaitanya Kulkarni
2021-10-18  7:06   ` Chengjike (ISSP)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox