All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] introduce interface to list all badblocks
@ 2020-06-05  7:31 yangerkun
  2020-06-05  7:32 ` [RFC 1/2] dm dust: add " yangerkun
  2020-06-05  7:32 ` [RFC 2/2] dm dust: introduce listbadblocks in the rst yangerkun
  0 siblings, 2 replies; 6+ messages in thread
From: yangerkun @ 2020-06-05  7:31 UTC (permalink / raw)
  To: bgurney, agk, snitzer; +Cc: dm-devel, yangerkun

We can add/remove/query the badblocks, but no interface to list all
badblocks when we want to know the badblocks we ever set still
available. Add message listbadblocks to do this.

To list all bad block list, run the following message command:

    $ sudo dmsetup message dust1 0 listbadblocks

We will get following message(image that we have insert block 1/2, and
we will list the block index in order)::

device-mapper: dust: dust_list_badblocks: badblocks list as below:
    device-mapper: dust: bad block: 1
    device-mapper: dust: bad block: 2
    device-mapper: dust: dust_list_badblocks: badblocks list end.



yangerkun (2):
  dm dust: add interface to list all badblocks
  dm dust: introduce listbadblocks in the rst

 .../admin-guide/device-mapper/dm-dust.rst     | 16 ++++++++++++++
 drivers/md/dm-dust.c                          | 21 +++++++++++++++++++
 2 files changed, 37 insertions(+)

-- 
2.25.4

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

* [RFC 1/2] dm dust: add interface to list all badblocks
  2020-06-05  7:31 [RFC 0/2] introduce interface to list all badblocks yangerkun
@ 2020-06-05  7:32 ` yangerkun
  2020-06-05 19:47   ` Bryan Gurney
  2020-06-05  7:32 ` [RFC 2/2] dm dust: introduce listbadblocks in the rst yangerkun
  1 sibling, 1 reply; 6+ messages in thread
From: yangerkun @ 2020-06-05  7:32 UTC (permalink / raw)
  To: bgurney, agk, snitzer; +Cc: dm-devel, yangerkun

This interface may help anyone want to know all badblocks without query
block one by one.

Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 drivers/md/dm-dust.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/md/dm-dust.c b/drivers/md/dm-dust.c
index ff03b90072c5..903c0d158c6e 100644
--- a/drivers/md/dm-dust.c
+++ b/drivers/md/dm-dust.c
@@ -280,6 +280,24 @@ static int dust_clear_badblocks(struct dust_device *dd)
 	return 0;
 }
 
+static void dust_list_badblocks(struct dust_device *dd)
+{
+	unsigned long flags;
+	struct rb_root badblocklist;
+	struct rb_node *node;
+	struct badblock *bblk;
+
+	DMINFO("%s: badblocks list as below:", __func__);
+	spin_lock_irqsave(&dd->dust_lock, flags);
+	badblocklist = dd->badblocklist;
+	for (node = rb_first(&badblocklist); node; node = rb_next(node)) {
+		bblk = rb_entry(node, struct badblock, node);
+		DMINFO("bad block: %llu", bblk->bb);
+	}
+	spin_unlock_irqrestore(&dd->dust_lock, flags);
+	DMINFO("%s: badblocks list end.", __func__);
+}
+
 /*
  * Target parameters:
  *
@@ -422,6 +440,9 @@ static int dust_message(struct dm_target *ti, unsigned int argc, char **argv,
 			else
 				dd->quiet_mode = false;
 			r = 0;
+		} else if (!strcasecmp(argv[0], "listbadblocks")) {
+			dust_list_badblocks(dd);
+			r = 0;
 		} else {
 			invalid_msg = true;
 		}
-- 
2.25.4

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

* [RFC 2/2] dm dust: introduce listbadblocks in the rst
  2020-06-05  7:31 [RFC 0/2] introduce interface to list all badblocks yangerkun
  2020-06-05  7:32 ` [RFC 1/2] dm dust: add " yangerkun
@ 2020-06-05  7:32 ` yangerkun
  2020-06-05 19:47   ` Bryan Gurney
  1 sibling, 1 reply; 6+ messages in thread
From: yangerkun @ 2020-06-05  7:32 UTC (permalink / raw)
  To: bgurney, agk, snitzer; +Cc: dm-devel, yangerkun

Since we support the listbadblocks command, introduce the detail in the
doc.

Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 .../admin-guide/device-mapper/dm-dust.rst        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/admin-guide/device-mapper/dm-dust.rst b/Documentation/admin-guide/device-mapper/dm-dust.rst
index b6e7e7ead831..185b3ce6298b 100644
--- a/Documentation/admin-guide/device-mapper/dm-dust.rst
+++ b/Documentation/admin-guide/device-mapper/dm-dust.rst
@@ -205,6 +205,21 @@ appear::
 
         kernel: device-mapper: dust: clearbadblocks: no badblocks found
 
+Listling the bad block list
+---------------------------
+
+To list all bad block list, run the following message command::
+
+        $ sudo dmsetup message dust1 0 listbadblocks
+
+We will get following message(image that we have insert block 1/2, and
+we will list the block index in order)::
+
+        device-mapper: dust: dust_list_badblocks: badblocks list as below:
+        device-mapper: dust: bad block: 1
+        device-mapper: dust: bad block: 2
+        device-mapper: dust: dust_list_badblocks: badblocks list end.
+
 Message commands list
 ---------------------
 
@@ -223,6 +238,7 @@ Single argument message commands::
 
         countbadblocks
         clearbadblocks
+        listbadblocks
         disable
         enable
         quiet
-- 
2.25.4

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

* Re: [RFC 1/2] dm dust: add interface to list all badblocks
  2020-06-05  7:32 ` [RFC 1/2] dm dust: add " yangerkun
@ 2020-06-05 19:47   ` Bryan Gurney
  0 siblings, 0 replies; 6+ messages in thread
From: Bryan Gurney @ 2020-06-05 19:47 UTC (permalink / raw)
  To: yangerkun; +Cc: dm-devel, Mike Snitzer, Alasdair G. Kergon

On Fri, Jun 5, 2020 at 3:48 AM yangerkun <yangerkun@huawei.com> wrote:
>
> This interface may help anyone want to know all badblocks without query
> block one by one.
>
> Signed-off-by: yangerkun <yangerkun@huawei.com>
> ---
>  drivers/md/dm-dust.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/md/dm-dust.c b/drivers/md/dm-dust.c
> index ff03b90072c5..903c0d158c6e 100644
> --- a/drivers/md/dm-dust.c
> +++ b/drivers/md/dm-dust.c
> @@ -280,6 +280,24 @@ static int dust_clear_badblocks(struct dust_device *dd)
>         return 0;
>  }
>
> +static void dust_list_badblocks(struct dust_device *dd)
> +{
> +       unsigned long flags;
> +       struct rb_root badblocklist;
> +       struct rb_node *node;
> +       struct badblock *bblk;
> +
> +       DMINFO("%s: badblocks list as below:", __func__);
> +       spin_lock_irqsave(&dd->dust_lock, flags);
> +       badblocklist = dd->badblocklist;
> +       for (node = rb_first(&badblocklist); node; node = rb_next(node)) {
> +               bblk = rb_entry(node, struct badblock, node);
> +               DMINFO("bad block: %llu", bblk->bb);
> +       }
> +       spin_unlock_irqrestore(&dd->dust_lock, flags);
> +       DMINFO("%s: badblocks list end.", __func__);
> +}
> +
>  /*
>   * Target parameters:
>   *
> @@ -422,6 +440,9 @@ static int dust_message(struct dm_target *ti, unsigned int argc, char **argv,
>                         else
>                                 dd->quiet_mode = false;
>                         r = 0;
> +               } else if (!strcasecmp(argv[0], "listbadblocks")) {
> +                       dust_list_badblocks(dd);
> +                       r = 0;
>                 } else {
>                         invalid_msg = true;
>                 }
> --
> 2.25.4
>

I tested this, and it looks good.

I see that the message says "badblocks list as below"; I'm wondering
if that was meant to say "badblocks list is below".  Or perhaps it
might be better to say "badblocks list below".

Aside from that potential correction,

Reviewed-by: Bryan Gurney <bgurney@redhat.com>


Thanks,

Bryan

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

* Re: [RFC 2/2] dm dust: introduce listbadblocks in the rst
  2020-06-05  7:32 ` [RFC 2/2] dm dust: introduce listbadblocks in the rst yangerkun
@ 2020-06-05 19:47   ` Bryan Gurney
  2020-06-08  1:45     ` yangerkun
  0 siblings, 1 reply; 6+ messages in thread
From: Bryan Gurney @ 2020-06-05 19:47 UTC (permalink / raw)
  To: yangerkun; +Cc: dm-devel, Mike Snitzer, Alasdair G. Kergon

On Fri, Jun 5, 2020 at 3:48 AM yangerkun <yangerkun@huawei.com> wrote:
>
> Since we support the listbadblocks command, introduce the detail in the
> doc.
>
> Signed-off-by: yangerkun <yangerkun@huawei.com>

Thank you for the documentation.  I have a few corrections listed below:

> ---
>  .../admin-guide/device-mapper/dm-dust.rst        | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/Documentation/admin-guide/device-mapper/dm-dust.rst b/Documentation/admin-guide/device-mapper/dm-dust.rst
> index b6e7e7ead831..185b3ce6298b 100644
> --- a/Documentation/admin-guide/device-mapper/dm-dust.rst
> +++ b/Documentation/admin-guide/device-mapper/dm-dust.rst
> @@ -205,6 +205,21 @@ appear::
>
>          kernel: device-mapper: dust: clearbadblocks: no badblocks found
>
> +Listling the bad block list

"Listing the bad block list"

> +---------------------------
> +
> +To list all bad block list, run the following message command::

"To list all bad blocks in the bad block list"

> +
> +        $ sudo dmsetup message dust1 0 listbadblocks
> +
> +We will get following message(image that we have insert block 1/2, and
> +we will list the block index in order)::

"The following message will appear, listing one bad block number per
line (using an example device with blocks 1 and 2 in the bad block
list)"

After those corrections are made,

Reviewed-by: Bryan Gurney <bgurney@redhat.com>


Thanks,

Bryan



> +
> +        device-mapper: dust: dust_list_badblocks: badblocks list as below:
> +        device-mapper: dust: bad block: 1
> +        device-mapper: dust: bad block: 2
> +        device-mapper: dust: dust_list_badblocks: badblocks list end.
> +
>  Message commands list
>  ---------------------
>
> @@ -223,6 +238,7 @@ Single argument message commands::
>
>          countbadblocks
>          clearbadblocks
> +        listbadblocks
>          disable
>          enable
>          quiet
> --
> 2.25.4
>

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

* Re: [RFC 2/2] dm dust: introduce listbadblocks in the rst
  2020-06-05 19:47   ` Bryan Gurney
@ 2020-06-08  1:45     ` yangerkun
  0 siblings, 0 replies; 6+ messages in thread
From: yangerkun @ 2020-06-08  1:45 UTC (permalink / raw)
  To: Bryan Gurney; +Cc: dm-devel, Mike Snitzer, Alasdair G. Kergon



在 2020/6/6 3:47, Bryan Gurney 写道:
> On Fri, Jun 5, 2020 at 3:48 AM yangerkun <yangerkun@huawei.com> wrote:
>>
>> Since we support the listbadblocks command, introduce the detail in the
>> doc.
>>
>> Signed-off-by: yangerkun <yangerkun@huawei.com>
> 
> Thank you for the documentation.  I have a few corrections listed below:
> 
>> ---
>>   .../admin-guide/device-mapper/dm-dust.rst        | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/Documentation/admin-guide/device-mapper/dm-dust.rst b/Documentation/admin-guide/device-mapper/dm-dust.rst
>> index b6e7e7ead831..185b3ce6298b 100644
>> --- a/Documentation/admin-guide/device-mapper/dm-dust.rst
>> +++ b/Documentation/admin-guide/device-mapper/dm-dust.rst
>> @@ -205,6 +205,21 @@ appear::
>>
>>           kernel: device-mapper: dust: clearbadblocks: no badblocks found
>>
>> +Listling the bad block list
> 
> "Listing the bad block list"
> 
>> +---------------------------
>> +
>> +To list all bad block list, run the following message command::
> 
> "To list all bad blocks in the bad block list"
> 
>> +
>> +        $ sudo dmsetup message dust1 0 listbadblocks
>> +
>> +We will get following message(image that we have insert block 1/2, and
>> +we will list the block index in order)::
> 
> "The following message will appear, listing one bad block number per
> line (using an example device with blocks 1 and 2 in the bad block
> list)"
> 
> After those corrections are made,
> 
> Reviewed-by: Bryan Gurney <bgurney@redhat.com>


Thanks for your advise for this series, I will fix it and send v2 with
your review tag!

Thanks,
Kun.

> 
> 
> Thanks,
> 
> Bryan
> 
> 
> 
>> +
>> +        device-mapper: dust: dust_list_badblocks: badblocks list as below:
>> +        device-mapper: dust: bad block: 1
>> +        device-mapper: dust: bad block: 2
>> +        device-mapper: dust: dust_list_badblocks: badblocks list end.
>> +
>>   Message commands list
>>   ---------------------
>>
>> @@ -223,6 +238,7 @@ Single argument message commands::
>>
>>           countbadblocks
>>           clearbadblocks
>> +        listbadblocks
>>           disable
>>           enable
>>           quiet
>> --
>> 2.25.4
>>
> 
> 


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

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

end of thread, other threads:[~2020-06-08  1:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05  7:31 [RFC 0/2] introduce interface to list all badblocks yangerkun
2020-06-05  7:32 ` [RFC 1/2] dm dust: add " yangerkun
2020-06-05 19:47   ` Bryan Gurney
2020-06-05  7:32 ` [RFC 2/2] dm dust: introduce listbadblocks in the rst yangerkun
2020-06-05 19:47   ` Bryan Gurney
2020-06-08  1:45     ` yangerkun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.