Re: [PATCH] badblocks: avoid checking invalid range in badblocks_check()

2023-12-23 Thread Coly Li
> 2023年12月24日 09:38,Jens Axboe 写道: > > On 12/23/23 5:32 PM, Coly Li wrote: >>> 2023?12?24? 08:28?Coly Li ??? >>> >>> If prev_badblocks() returns '-1', it means no valid badblocks record >>> before the checking range. It doesn't

Re: [PATCH] badblocks: avoid checking invalid range in badblocks_check()

2023-12-23 Thread Coly Li
> 2023年12月24日 08:28,Coly Li 写道: > > If prev_badblocks() returns '-1', it means no valid badblocks record > before the checking range. It doesn't make sense to check whether > the input checking range is overlapped with the non-existed invalid > front range

[PATCH] badblocks: avoid checking invalid range in badblocks_check()

2023-12-23 Thread Coly Li
calling overlap_front(), to void such invalid operations. Fixes: 3ea3354cb9f0 ("badblocks: improve badblocks_check() for multiple ranges handling") Reported-and-tested-by: Ira Weiny Signed-off-by: Coly Li Link: https://lore.kernel.org/nvdimm/3035e75a-9be0-4bc3-8d4a-6e52c207f.

Re: Bug in commit aa511ff8218b ("badblocks: switch to the improved badblock handling

2023-12-23 Thread Coly Li
> 2023年12月24日 01:13,Ira Weiny 写道: > > Coly Li wrote: > > [snip] > >> >> Hi Ira, >> >> The above information is accurate and very helpful, thank you! >> >> From __badblocks_check(), the problematic code block is, >> 1303 re_c

Re: Bug in commit aa511ff8218b ("badblocks: switch to the improved badblock handling

2023-12-23 Thread Coly Li
blocks_set() and badblocks_clear(), 'prev < 0' is explicitly checked, value '-1' doesn't go though into following code. Could you please apply and try the attached patch? Hope it may help a bit. And now it is weekend time, you may be out of office and not able to a

Re: Bug in commit aa511ff8218b ("badblocks: switch to the improved badblock handling

2023-12-22 Thread Coly Li
notice that this work was due to a bug report in badblock_set(). > Therefore, I'm not sure of that severity of that fix is vs a revert. But > at this point I'm not seeing an easy fix so I'm in favor of a revert. Hi Ira, Thanks for the information reported. Let me look into the situation now. Coly Li

[PATCH] test: user space code to test badblocks APIs

2023-08-11 Thread Coly Li
l 512 badblock slots from being full filled. Of course the testing code is not perfect, this is the try-best effort to verify simple conditions of bad blocks setting/clearing with random generated ranges. For complicated situations, manual check by people are still necessary. Signed-off-by: Coly Li Cc

[PATCH v7 6/6] badblocks: switch to the improved badblock handling code

2023-08-11 Thread Coly Li
() and _badblocks_check(). This patch only contains the changes of old code deletion, new added code for the improved algorithms are in previous patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni

[PATCH v7 3/6] badblocks: improve badblocks_set() for multiple ranges handling

2023-08-11 Thread Coly Li
ocks_set(), and just add a new one named _badblocks_set(). Later patch will remove current existing badblocks_set() code and make it as a wrapper of _badblocks_set(). So the new added change won't be mixed with deleted code, the code review can be easier. Signed-off-by: Coly Li Cc: Dan Willi

[PATCH v7 4/6] badblocks: improve badblocks_clear() for multiple ranges handling

2023-08-11 Thread Coly Li
_badblock_clear() for the improvement. Later patch will delete current code of badblock_clear() and make it as a wrapper to _badblock_clear(), so the code change can be much clear for review. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown

[PATCH v7 5/6] badblocks: improve badblocks_check() for multiple ranges handling

2023-08-11 Thread Coly Li
eview. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni --- block/badblocks.c | 97 +++ 1 file changed, 97 insertions(+) diff --git a/block/badblocks.c b/

[PATCH v7 2/6] badblocks: add helper routines for badblock ranges handling

2023-08-11 Thread Coly Li
ks_set()/badblocks_clear()/badblocks_check(). Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni --- block/badblocks.c | 386 ++ 1 file changed, 386 insertions(

[PATCH v7 1/6] badblocks: add more helper structure and routines in badblocks.h

2023-08-11 Thread Coly Li
sed in the improved badblocks code in following patches. Signed-off-by: Coly Li Reviewed-by: Xiao Ni Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- include/linux/badblocks.h | 30 ++ 1 file changed, 30

[PATCH v7 0/6] badblocks improvement for multiple bad block ranges

2023-08-11 Thread Coly Li
r the code review accomplished. Please review the code and response. Thank you all in advance. Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma Cc: Wols Lists Cc: Xiao Ni --- Coly Li (6): badblocks: add m

Re: [PATCH v6 4/7] badblocks: improve badblocks_clear() for multiple ranges handling

2023-08-11 Thread Coly Li
On Wed, Sep 21, 2022 at 11:26:52PM +0800, Xiao Ni wrote: > On Thu, Jul 21, 2022 at 8:12 PM Coly Li wrote: >> [snipped] >> + * setting does, but much more simpler. The only thing needs to be noticed >> is >> + * when the clearing range hits middle of a bad block

Re: [PATCH v6 4/7] badblocks: improve badblocks_clear() for multiple ranges handling

2023-08-11 Thread Coly Li
On Wed, Sep 21, 2022 at 11:26:52PM +0800, Xiao Ni wrote: > On Thu, Jul 21, 2022 at 8:12 PM Coly Li wrote: >> [snipped] >> + * setting does, but much more simpler. The only thing needs to be noticed >> is >> + * when the clearing range hits middle of a bad block

Re: [PATCH v6 3/7] badblocks: improve badblocks_set() for multiple ranges handling

2023-08-11 Thread Coly Li
> 2022年9月21日 20:13,Xiao Ni 写道: > > On Thu, Jul 21, 2022 at 8:12 PM Coly Li wrote: [snipped] >> >> + *+--+ >> + * 4.2.2) If range E is acked and the setting range S is unacked, the >> setting >> + *request of

Re: [PATCH v6 2/7] badblocks: add helper routines for badblock ranges handling

2023-08-11 Thread Coly Li
AKE(BB_OFFSET(p[prev]), >> + bad->start - BB_OFFSET(p[prev]), >> + BB_ACK(p[prev])); > > s/BB_ACK(p[prev])/orig_ack/g It will be used in next version. > >> + /* >> +* prev + 3 -> prev + 1 + 2, which is for, >> +* 1) prev + 1: the slot index of the previous one >> +* 2) + 2: two more slots for extra being 2. >> +*/ >> + memmove(p + prev + 3, p + prev + 1, >> + (bb->count - prev - 1) * 8); >> + p[prev + 1] = BB_MAKE(bad->start, bad->len, bad->ack); >> + p[prev + 2] = BB_MAKE(BB_END(p[prev + 1]), >> + orig_end - BB_END(p[prev + 1]), >> + BB_ACK(p[prev])); > > s/BB_ACK(p[prev])/orig_ack/g It will be used in next version. >> + break; >> + default: >> + break; >> + } >> + >> + return bad->len; >> +} >> + >> +/* Thank you for the review! Coly Li

Re: [PATCH v6 0/7] badblocks improvement for multiple bad block ranges

2023-05-22 Thread Coly Li
> 2023年5月23日 10:38,Li Nan 写道: > > Hi Coly Li, > > Recently, I have been trying to fix the bug of backblocks settings, and I > found that your patch series has already fixed the bug. This patch series has > not been applied to mainline at present, may I ask if you stil

[PATCH v6 7/7] test: user space code to test badblocks APIs

2022-07-21 Thread Coly Li
l 512 badblock slots from being full filled. Of course the testing code is not perfect, this is the try-best effort to verify simple conditions of bad blocks setting/clearing with random generated ranges. For complicated situations, manual check by people are still necessary. Signed-off-by: Coly Li Cc

[PATCH v6 6/7] badblocks: switch to the improved badblock handling code

2022-07-21 Thread Coly Li
() and _badblocks_check(). This patch only contains the changes of old code deletion, new added code for the improved algorithms are in previous patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni

[PATCH v6 5/7] badblocks: improve badblocks_check() for multiple ranges handling

2022-07-21 Thread Coly Li
eview. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni --- block/badblocks.c | 97 +++ 1 file changed, 97 insertions(+) diff --git a/block/badblocks.c b/

[PATCH v6 4/7] badblocks: improve badblocks_clear() for multiple ranges handling

2022-07-21 Thread Coly Li
_badblock_clear() for the improvement. Later patch will delete current code of badblock_clear() and make it as a wrapper to _badblock_clear(), so the code change can be much clear for review. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown

[PATCH v6 3/7] badblocks: improve badblocks_set() for multiple ranges handling

2022-07-21 Thread Coly Li
ocks_set(), and just add a new one named _badblocks_set(). Later patch will remove current existing badblocks_set() code and make it as a wrapper of _badblocks_set(). So the new added change won't be mixed with deleted code, the code review can be easier. Signed-off-by: Coly Li Cc: Dan Willi

[PATCH v6 2/7] badblocks: add helper routines for badblock ranges handling

2022-07-21 Thread Coly Li
ks_set()/badblocks_clear()/badblocks_check(). Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni --- block/badblocks.c | 377 ++ 1 file changed, 377 insertions(

[PATCH v6 1/7] badblocks: add more helper structure and routines in badblocks.h

2022-07-21 Thread Coly Li
sed in the improved badblocks code in following patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma Cc: Xiao Ni --- include/linux/badblocks.h | 30 ++ 1 file changed, 30 insertions(+)

[PATCH v6 0/7] badblocks improvement for multiple bad block ranges

2022-07-21 Thread Coly Li
The whole change is divided into 6 patches to make the code review more clear and easier. If people prefer, I'd like to post a single large patch finally after the code review accomplished. Please review the code and response. Thank you all in advance. Coly Li Cc: Dan Williams Cc: Geli

Re: [PATCH v5 3/6] badblocks: improve badblocks_set() for multiple ranges handling

2022-06-06 Thread Coly Li
> 2022年1月2日 21:48,Xiao Ni 写道: > > On Sat, Dec 11, 2021 at 12:05 AM Coly Li wrote: >> >> Recently I received a bug report that current badblocks code does not >> properly handle multiple ranges. For example, >>badblocks_set(bb, 32, 1, true); >&g

Re: [PATCH v5 2/6] badblocks: add helper routines for badblock ranges handling

2022-06-06 Thread Coly Li
> 2022年1月2日 15:04,Xiao Ni 写道: > > On Sat, Dec 11, 2021 at 12:05 AM Coly Li wrote: >> >> [snipped] >> block/badblocks.c | 376 ++ >> 1 file changed, 376 insertions(+) >> >> diff --git a/block/badblock

Re: [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum

2022-03-05 Thread Coly Li
On 3/3/22 7:19 PM, Christoph Hellwig wrote: Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Acked-by: Coly Li Thanks. Coly Li --- drivers/md/bcache/request.c | 4 ++-- 1 file

[PATCH v5] test: user space code to test badblocks APIs

2021-12-10 Thread Coly Li
l 512 badblock slots from being full filled. Of course the testing code is not perfect, this is the try-best effort to verify simple conditions of bad blocks setting/clearing with random generated ranges. For complicated situations, manual check by people are still necessary. Signed-off-by: Coly Li Cc

[PATCH v5 6/6] badblocks: switch to the improved badblock handling code

2021-12-10 Thread Coly Li
() and _badblocks_check(). This patch only contains the changes of old code deletion, new added code for the improved algorithms are in previous patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block

[PATCH v5 5/6] badblocks: improve badblocks_check() for multiple ranges handling

2021-12-10 Thread Coly Li
eview. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 97 +++ 1 file changed, 97 insertions(+) diff --git a/block/badblocks.c b/block/badblocks.c

[PATCH v5 4/6] badblocks: improve badblocks_clear() for multiple ranges handling

2021-12-10 Thread Coly Li
_badblock_clear() for the improvement. Later patch will delete current code of badblock_clear() and make it as a wrapper to _badblock_clear(), so the code change can be much clear for review. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown

[PATCH v5 3/6] badblocks: improve badblocks_set() for multiple ranges handling

2021-12-10 Thread Coly Li
badblocks_set(), and just add a new one named _badblocks_set(). Later patch will remove current existing badblocks_set() code and make it as a wrapper of _badblocks_set(). So the new added change won't be mixed with deleted code, the code review can be easier. Signed-off-by: Coly Li Cc: Dan W

[PATCH v5 2/6] badblocks: add helper routines for badblock ranges handling

2021-12-10 Thread Coly Li
ks_set()/badblocks_clear()/badblocks_check(). Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 376 ++ 1 file changed, 376 insertions(+) diff --gi

[PATCH v5 1/6] badblocks: add more helper structure and routines in badblocks.h

2021-12-10 Thread Coly Li
sed in the improved badblocks code in following patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- include/linux/badblocks.h | 30 ++ 1 file changed, 30 insertions(+) diff --git

[PATCH v5 0/7] badblocks improvement for multiple bad block ranges

2021-12-10 Thread Coly Li
d. Please review the code and response. Thank you all in advance. Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma Cc: Wols Lists --- Coly Li (6): badblocks: add more helper structure and routines in b

Re: [PATCH v3 2/6] badblocks: add helper routines for badblock ranges handling

2021-12-09 Thread Coly Li
On 12/9/21 3:22 PM, Geliang Tang wrote: Hi Coly, Thanks for this new version! Thank you so much for the review comments. I fix all the typos and change the code as you suggested with dropping extra local variables. The modification will be posted in next version. Coly Li [snip]

Re: [PATCH v3 3/6] badblocks: improvement badblocks_set() for multiple ranges handling

2021-12-09 Thread Coly Li
On 12/10/21 2:37 AM, Wols Lists wrote: On 09/12/2021 07:28, Geliang Tang wrote: On Thu, Dec 02, 2021 at 08:52:41PM +0800, Coly Li wrote: Recently I received a bug report that current badblocks code does not + *    +++ + *    |    S   | E

[PATCH] test: user space code to test badblocks APIs

2021-12-02 Thread Coly Li
l 512 badblock slots from being full filled. Of course the testing code is not perfect, this is the try-best effort to verify simple conditions of bad blocks setting/clearing with random generated ranges. For complicated situations, manual check by people are still necessary. Signed-off-by: Coly Li Cc

[PATCH v3 6/6] badblocks: switch to the improved badblock handling code

2021-12-02 Thread Coly Li
() and _badblocks_check(). This patch only contains the changes of old code deletion, new added code for the improved algorithms are in previous patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block

[PATCH v3 5/6] badblocks: improve badblocks_check() for multiple ranges handling

2021-12-02 Thread Coly Li
eview. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 97 +++ 1 file changed, 97 insertions(+) diff --git a/block/badblocks.c b/block/badblocks.c

[PATCH v3 4/6] badblocks: improve badblocks_clear() for multiple ranges handling

2021-12-02 Thread Coly Li
_badblock_clear() for the improvement. Later patch will delete current code of badblock_clear() and make it as a wrapper to _badblock_clear(), so the code change can be much clear for review. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown

[PATCH v3 3/6] badblocks: improvement badblocks_set() for multiple ranges handling

2021-12-02 Thread Coly Li
badblocks_set(), and just add a new one named _badblocks_set(). Later patch will remove current existing badblocks_set() code and make it as a wrapper of _badblocks_set(). So the new added change won't be mixed with deleted code, the code review can be easier. Signed-off-by: Coly Li Cc: Dan W

[PATCH v3 2/6] badblocks: add helper routines for badblock ranges handling

2021-12-02 Thread Coly Li
ks_set()/badblocks_clear()/badblocks_check(). Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 374 ++ 1 file changed, 374 insertions(+) diff --gi

[PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h

2021-12-02 Thread Coly Li
sed in the improved badblocks code in following patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- include/linux/badblocks.h | 30 ++ 1 file changed, 30 insertions(+) diff --git

[PATCH v4 0/6] badblocks improvement for multiple bad block ranges

2021-12-02 Thread Coly Li
ngle large patch finally after the code review accomplished. Please review the code and response. Thank you all in advance. Coly Li Cc: Dan Williams Cc: Geliang Tang Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma --- Coly Li (6): badblocks: add m

Re: [PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h

2021-09-27 Thread Coly Li
On 9/27/21 3:23 PM, Geliang Tang wrote: Hi Coly, On 9/14/21 00:36, Coly Li wrote: This patch adds the following helper structure and routines into badblocks.h, - struct badblocks_context    This structure is used in improved badblocks code for bad table    iteration. - BB_END()    The macro to

Re: [PATCH v3 2/6] badblocks: add helper routines for badblock ranges handling

2021-09-27 Thread Coly Li
On 9/27/21 3:25 PM, Geliang Tang wrote: On 9/14/21 00:36, Coly Li wrote: This patch adds several helper routines to improve badblock ranges handling. These helper routines will be used later in the improved version of badblocks_set()/badblocks_clear()/badblocks_check(). - Helpers prev_by_hint

Re: [PATCH v3 3/6] badblocks: improvement badblocks_set() for multiple ranges handling

2021-09-27 Thread Coly Li
On 9/27/21 3:30 PM, Geliang Tang wrote: On 9/14/21 00:36, Coly Li wrote: [snipped] + * 2.1.1) If S and E are both acked or unacked range, the setting range S can + *    be merged into existing bad range E. The result is, + *    +-+ + *    |  S

Re: Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges)

2021-09-23 Thread Coly Li
On 9/23/21 6:09 PM, NeilBrown wrote: On Thu, 23 Sep 2021, Coly Li wrote: Hi all the kernel gurus, and folks in mailing lists, This is a question about exporting 4KB+ text information via sysfs interface. I need advice on how to handle the problem. Hi Neil, Why do you think there is a

Re: Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges)

2021-09-23 Thread Coly Li
On 9/23/21 2:47 PM, Greg Kroah-Hartman wrote: On Thu, Sep 23, 2021 at 02:14:12PM +0800, Coly Li wrote: On 9/23/21 2:08 PM, Greg Kroah-Hartman wrote: On Thu, Sep 23, 2021 at 01:59:28PM +0800, Coly Li wrote: Hi all the kernel gurus, and folks in mailing lists, This is a question about

Re: Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges)

2021-09-22 Thread Coly Li
On 9/23/21 2:08 PM, Greg Kroah-Hartman wrote: On Thu, Sep 23, 2021 at 01:59:28PM +0800, Coly Li wrote: Hi all the kernel gurus, and folks in mailing lists, This is a question about exporting 4KB+ text information via sysfs interface. I need advice on how to handle the problem. Hi Greg, This

Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges)

2021-09-22 Thread Coly Li
xceed the page size limitation of sysfs file. 2) Add seq_file support to sysfs interface if there is no It is probably there is other better solution to fix. So I do want to get hint/advice from you. Thanks in advance for any comment :-) Coly Li On 9/14/21 12:36 AM, Coly Li wrote: This is

[PATCH v2 0/7] badblocks improvement for multiple bad block ranges

2021-09-13 Thread Coly Li
this version. The whole change is divided into 6 patches to make the code review more clear and easier. If people prefer, I'd like to post a single large patch finally after the code review accomplished. This version is seriously tested, and so far no more defect observed. Coly Li Cc: Da

[PATCH] test: user space code to test badblocks APIs

2021-09-13 Thread Coly Li
l 512 badblock slots from being full filled. Of course the testing code is not perfect, this is the try-best effort to verify simple conditions of bad blocks setting/clearing with random generated ranges. For complicated situations, manual check by people are still necessary. Signed-off-by: Coly Li Cc

[PATCH v3 6/6] badblocks: switch to the improved badblock handling code

2021-09-13 Thread Coly Li
() and _badblocks_check(). This patch only contains the changes of old code deletion, new added code for the improved algorithms are in previous patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma --- block

[PATCH v3 5/6] badblocks: improve badblocks_check() for multiple ranges handling

2021-09-13 Thread Coly Li
eview. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma --- block/badblocks.c | 99 +++ 1 file changed, 99 insertions(+) diff --git a/block/badblocks.c b/block/badblocks.c

[PATCH v3 4/6] badblocks: improve badblocks_clear() for multiple ranges handling

2021-09-13 Thread Coly Li
_badblock_clear() for the improvement. Later patch will delete current code of badblock_clear() and make it as a wrapper to _badblock_clear(), so the code change can be much clear for review. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan

[PATCH v3 3/6] badblocks: improvement badblocks_set() for multiple ranges handling

2021-09-13 Thread Coly Li
badblocks_set(), and just add a new one named _badblocks_set(). Later patch will remove current existing badblocks_set() code and make it as a wrapper of _badblocks_set(). So the new added change won't be mixed with deleted code, the code review can be easier. Signed-off-by: Coly Li Cc: Dan Will

[PATCH v3 2/6] badblocks: add helper routines for badblock ranges handling

2021-09-13 Thread Coly Li
ks_set()/badblocks_clear()/badblocks_check(). Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma --- block/badblocks.c | 374 ++ 1 file changed, 374 insertions(+) diff --gi

[PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h

2021-09-13 Thread Coly Li
sed in the improved badblocks code in following patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Richard Fan Cc: Vishal L Verma --- include/linux/badblocks.h | 32 1 file changed, 32 insertions(+) diff --git

[PATCH v3 0/7] badblocks improvement for multiple bad block ranges

2021-09-13 Thread Coly Li
this version. The whole change is divided into 6 patches to make the code review more clear and easier. If people prefer, I'd like to post a single large patch finally after the code review accomplished. This version is seriously tested, and so far no more defect observed. Coly Li Cc: Da

[PATCH] test: user space code to test badblocks APIs

2021-09-13 Thread Coly Li
l 512 badblock slots from being full filled. Of course the testing code is not perfect, this is the try-best effort to verify simple conditions of bad blocks setting/clearing with random generated ranges. For complicated situations, manual check by people are still necessary. Signed-off-by: Coly Li Cc

[PATCH v2 6/6] badblocks: switch to the improved badblock handling code

2021-09-13 Thread Coly Li
() and _badblocks_check(). This patch only contains the changes of old code deletion, new added code for the improved algorithms are in previous patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 310

[PATCH v2 5/6] badblocks: improve badblocks_check() for multiple ranges handling

2021-09-13 Thread Coly Li
eview. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 99 +++ 1 file changed, 99 insertions(+) diff --git a/block/badblocks.c b/block/badblocks.c index b8d466e

[PATCH v2 4/6] badblocks: improve badblocks_clear() for multiple ranges handling

2021-09-13 Thread Coly Li
_badblock_clear() for the improvement. Later patch will delete current code of badblock_clear() and make it as a wrapper to _badblock_clear(), so the code change can be much clear for review. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L

[PATCH v2 3/6] badblocks: improvement badblocks_set() for multiple ranges handling

2021-09-13 Thread Coly Li
badblocks_set(), and just add a new one named _badblocks_set(). Later patch will remove current existing badblocks_set() code and make it as a wrapper of _badblocks_set(). So the new added change won't be mixed with deleted code, the code review can be easier. Signed-off-by: Coly Li Cc:

[PATCH v2 2/6] badblocks: add helper routines for badblock ranges handling

2021-09-13 Thread Coly Li
ks_set()/badblocks_clear()/badblocks_check(). Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- block/badblocks.c | 374 ++ 1 file changed, 374 insertions(+) diff --git a/block/badblocks.c

[PATCH v2 1/6] badblocks: add more helper structure and routines in badblocks.h

2021-09-13 Thread Coly Li
sed in the improved badblocks code in following patches. Signed-off-by: Coly Li Cc: Dan Williams Cc: Hannes Reinecke Cc: Jens Axboe Cc: NeilBrown Cc: Vishal L Verma --- include/linux/badblocks.h | 32 1 file changed, 32 insertions(+) diff --git a/include/linux/b

Re: [PATCH 02/10] bcache: add error handling support for add_disk()

2021-08-29 Thread Coly Li
that tradition. Signed-off-by: Luis Chamberlain Acked-by: Coly Li Thanks. --- drivers/md/bcache/super.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index f2874c77ff79..f0c32cdd6594 100644 --- a/dr

Re: bcache kbuild cleanups

2019-10-19 Thread Coly Li
On 2019/10/16 12:04 上午, Christoph Hellwig wrote: > Hi Coly, > > this series removes a pointless cflags override and unused exports > from bcache. > Sure, I add them in my for-next series. Thansk. -- Coly Li

Re: [RFC] How to handle an ugly md raid0 sector map bug ?

2019-08-23 Thread Coly Li
On 2019/8/24 1:17 上午, Song Liu wrote: > > >> On Aug 23, 2019, at 10:03 AM, Coly Li wrote: >> >> On 2019/8/24 12:37 上午, Song Liu wrote: >>> Thanks Coly and Neil. >>> >>>> On Aug 22, 2019, at 5:02 PM, NeilBrown wrote: >>>

Re: [RFC] How to handle an ugly md raid0 sector map bug ?

2019-08-23 Thread Coly Li
On 2019/8/24 12:37 上午, Song Liu wrote: > Thanks Coly and Neil. > >> On Aug 22, 2019, at 5:02 PM, NeilBrown wrote: >> >> On Thu, Aug 22 2019, Coly Li wrote: >> >>> Hi folks, >>> >>> First line: This bug only influences md raid0 dev

[RFC] How to handle an ugly md raid0 sector map bug ?

2019-08-22 Thread Coly Li
veloper community to work together for a solution, this is the motivation I post this email for your comments. Thanks in advance. -- Coly Li

Re: [PATCH] bcache: fix a lost wake-up problem caused by mca_cannibalize_lock

2019-08-20 Thread Coly Li
IBLE. Then process A > goes to sleep but no one will wake up it. This problem may cause bcache > device to dead. > > Signed-off-by: Guoju Fang Hi Guoju, It looks good to me at the first glance, let me add it into my for-test directory. Thanks. Coly Li > --- > drivers/md/bca

[PATCH v2 1/1] bcache: Revert "bcache: use sysfs_match_string() instead of __sysfs_match_string()"

2019-08-08 Thread Coly Li
atch_string() instead of __sysfs_match_string()"). This bug was introduced in Linux v5.2, so this fix only applies to Linux v5.2 is enough for stable tree maintainer. Fixes: 89e0341af082 ("bcache: use sysfs_match_string() instead of __sysfs_match_string()") Signed-off-by: Coly Li

[PATCH v2 0/1] bcache fixes for Linux v5.3-rc4

2019-08-08 Thread Coly Li
Hi Jens, I have a bug report that is frequent happens in product environment, the problem was introduced in Linux v5.2, we should have the fix in in Linux v5.3. I add the missing 'Fixes:' field for the patch in v2. Thanks in advance for taking this. Coly Li --- Coly Li (1): bcac

[PATCH 1/1] bcache: Revert "bcache: use sysfs_match_string() instead of __sysfs_match_string()"

2019-08-08 Thread Coly Li
atch_string() instead of __sysfs_match_string()"). This bug was introduced in Linux v5.2, so this fix only applies to Linux v5.2 is enough for stable tree maintainer. Signed-off-by: Coly Li Reported-by: Peifeng Lin Cc: sta...@vger.kernel.org Cc: Alexandru Ardelean --- drivers/md/bca

[PATCH 0/1] bcache fixes for Linux v5.3-rc4

2019-08-08 Thread Coly Li
Hi Jens, I have a bug report that is frequent happens in product environment, the problem was introduced in Linux v5.2, we should have the fix in in Linux v5.3. Thanks in advance for taking this. Coly Li --- Coly Li (1): bcache: Revert "bcache: use sysfs_match_string() inste

[PATCH 1/1] bcache: fix possible memory leak in bch_cached_dev_run()

2019-07-22 Thread Coly Li
From: Wei Yongjun memory malloced in bch_cached_dev_run() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: 0b13efecf5f2 ("bcache: add return value check to bch_cached_dev_run()") Signed-off-by: Wei Yongjun Signed-off-b

[PATCH 0/1] bcache fix for Linux v5.3-rc2

2019-07-22 Thread Coly Li
Hi Jens, Up to now we have one fix from Wei Yongjun for the patches merged in Linux v5.3-rc1, which is for a possible memory leak when running a cached device. Thank you in advance, for taking it in v5.3-rc2. Coly Li --- Wei Yongjun (1): bcache: fix possible memory leak in bch_cached_dev_run

[PATCH 36/37] bcache: performance improvement for btree_flush_write()

2019-06-28 Thread Coly Li
he above change decreases 50%+ CPU consumption when journal space is full. Some times IOPS drops to 0 for 5-8 seconds, comparing blocking I/O for 120+ seconds in previous code, this is much better. Maybe there is room to improve in future, but at this momment the fix looks fine and performs well in m

[PATCH 30/37] bcache: Revert "bcache: free heap cache_set->flush_btree in bch_journal_free"

2019-06-28 Thread Coly Li
>flush_btree in bch_journal_free") Signed-off-by: Coly Li Cc: sta...@vger.kernel.org Cc: Shenghui Wang --- drivers/md/bcache/journal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 3d321bffddc9..11d8c93b88bb 100644 --- a/drivers/md

[PATCH 34/37] bcache: remove retry_flush_write from struct cache_set

2019-06-28 Thread Coly Li
In struct cache_set, retry_flush_write is added for commit c4dc2497d50d ("bcache: fix high CPU occupancy during journal") which is reverted in previous patch. Now it is useless anymore, and this patch removes it from bcache code. Signed-off-by: Coly Li --- drivers/md/bcache/bca

[PATCH 37/37] bcache: add reclaimed_journal_buckets to struct cache_set

2019-06-28 Thread Coly Li
many journal buckets are reclaimed since cache set runs. From all these three counters (reclaim, reclaimed_journal_buckets, flush_write), we can have idea how well current journal space reclaim code works. Signed-off-by: Coly Li --- drivers/md/bcache/bcache.h | 1 + drivers/md/bcache/journal.

[PATCH 35/37] bcache: fix race in btree_flush_write()

2019-06-28 Thread Coly Li
_NODE_journal_flush bit cleared, and free the btree node memory. Fixes: cafe56359144 ("bcache: A block layer cache") Signed-off-by: Coly Li Reported-and-tested-by: kbuild test robot Cc: sta...@vger.kernel.org --- drivers/md/bcache/btree.c | 28 +++- dri

[PATCH 25/37] bcache: acquire bch_register_lock later in cached_dev_free()

2019-06-28 Thread Coly Li
p;bch_register_lock) to a later location where before atomic_read(&dc->running) in cached_dev_free(), such A-A lock problem can be solved without any reboot time registration race. Signed-off-by: Coly Li --- drivers/md/bcache/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH 27/37] bcache: add code comments for journal_read_bucket()

2019-06-28 Thread Coly Li
This patch adds more code comments in journal_read_bucket(), this is an effort to make the code to be more understandable. Signed-off-by: Coly Li --- drivers/md/bcache/journal.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/md/bcache/journal.c b/drivers

[PATCH 24/37] bcache: acquire bch_register_lock later in cached_dev_detach_finish()

2019-06-28 Thread Coly Li
(). Which is later then original location in cached_dev_detach_finish(). Signed-off-by: Coly Li --- drivers/md/bcache/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index a88238ad5da1..40d857e690f9 100644 --- a

[PATCH 32/37] bcache: only clear BTREE_NODE_dirty bit when it is set

2019-06-28 Thread Coly Li
Indeed if btree_node_dirty(b) returns false, it means BTREE_NODE_dirty bit is cleared, then it is unnecessary to clear the bit again. This patch only clears BTREE_NODE_dirty when btree_node_dirty(b) is true (the bit is set), to save a few CPU cycles. Signed-off-by: Coly Li --- drivers/md/bcache/

linux-block@vger.kernel.org

2019-06-28 Thread Coly Li
g or clearing BTREE_NODE_dirty bit there. Signed-off-by: Coly Li --- drivers/md/bcache/btree.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 88e5aa3fbb07..846306c3a887 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/b

[PATCH 26/37] bcache: fix potential deadlock in cached_def_free()

2019-06-28 Thread Coly Li
k_write_wq in writebach kthread routine bch_writeback_thread(), where after quit the thread main while-loop and before cached_dev_put() is called. By this fix, dc->writeback_write_wq will be stopped and destroy before the writeback kthread stopped, so the chance for a A-A locking on wq->

[PATCH 31/37] bcache: Revert "bcache: fix high CPU occupancy during journal"

2019-06-28 Thread Coly Li
: c4dc2497d50d ("bcache: fix high CPU occupancy during journal") Signed-off-by: Coly Li Cc: sta...@vger.kernel.org Cc: Tang Junhui --- drivers/md/bcache/bcache.h | 2 -- drivers/md/bcache/journal.c | 47 +++-- drivers/md/bcache/util.h| 2 -

[PATCH 29/37] bcache: shrink btree node cache after bch_btree_check()

2019-06-28 Thread Coly Li
base, or I/O service of distributed storage node). This patch tries to call bcache mca shrinker routine to proactively release mca cache memory, to decrease the memory pressure of system and avoid negative effort of the overall system I/O performance. Signed-off-by: Coly Li --- drivers/md/bcache

[PATCH 28/37] bcache: set largest seq to ja->seq[bucket_index] in journal_read_bucket()

2019-06-28 Thread Coly Li
gger then current value. Signed-off-by: Coly Li --- drivers/md/bcache/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 98ee467ec3f7..3d321bffddc9 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/

[PATCH 23/37] bcache: avoid a deadlock in bcache_reboot()

2019-06-28 Thread Coly Li
In register_bcache(), if bcache_is_reboot is checked to be true, reject the registration by returning -EBUSY immediately. Signed-off-by: Coly Li --- drivers/md/bcache/super.c | 40 +++- drivers/md/bcache/sysfs.c | 26 ++ 2 files cha

[PATCH 16/37] bcache: improve error message in bch_cached_dev_run()

2019-06-28 Thread Coly Li
to attach to the cache devince and run, so it won't be an error level message in kernel message. Signed-off-by: Coly Li --- drivers/md/bcache/super.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c ind

[PATCH 15/37] bcache: add more error message in bch_cached_dev_attach()

2019-06-28 Thread Coly Li
This patch adds more error message for attaching cached device, this is helpful to debug code failure during bache device start up. Signed-off-by: Coly Li --- drivers/md/bcache/super.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c

  1   2   3   4   5   6   7   8   9   >