linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bcache: journel: use for_each_clear_bit() to simplify the  code
@ 2020-06-24  6:52 Xu Wang
  2020-06-24  6:52 ` Xu Wang
  2020-06-24 14:51 ` Coly Li
  0 siblings, 2 replies; 3+ messages in thread
From: Xu Wang @ 2020-06-24  6:52 UTC (permalink / raw)
  To: colyli, kent.overstreet; +Cc: linux-bcache, linux-kernel

Using for_each_clear_bit() to simplify the code.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/md/bcache/journal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 90aac4e2333f..b01c953e214c 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -217,10 +217,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)
 		 */
 		pr_debug("falling back to linear search\n");
 
-		for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets);
-		     l < ca->sb.njournal_buckets;
-		     l = find_next_zero_bit(bitmap, ca->sb.njournal_buckets,
-					    l + 1))
+		for_each_clear_bit(l, bitmap, ca->sb.njournal_buckets)
 			if (read_bucket(l))
 				goto bsearch;
 
-- 
2.17.1

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

* [PATCH] bcache: journel: use for_each_clear_bit() to simplify the  code
  2020-06-24  6:52 [PATCH] bcache: journel: use for_each_clear_bit() to simplify the code Xu Wang
@ 2020-06-24  6:52 ` Xu Wang
  2020-06-24 14:51 ` Coly Li
  1 sibling, 0 replies; 3+ messages in thread
From: Xu Wang @ 2020-06-24  6:52 UTC (permalink / raw)
  To: colyli, kent.overstreet; +Cc: linux-bcache, linux-kernel

Using for_each_clear_bit() to simplify the code.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/md/bcache/journal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 90aac4e2333f..b01c953e214c 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -217,10 +217,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)
 		 */
 		pr_debug("falling back to linear search\n");
 
-		for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets);
-		     l < ca->sb.njournal_buckets;
-		     l = find_next_zero_bit(bitmap, ca->sb.njournal_buckets,
-					    l + 1))
+		for_each_clear_bit(l, bitmap, ca->sb.njournal_buckets)
 			if (read_bucket(l))
 				goto bsearch;
 
-- 
2.17.1


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

* Re: [PATCH] bcache: journel: use for_each_clear_bit() to simplify the code
  2020-06-24  6:52 [PATCH] bcache: journel: use for_each_clear_bit() to simplify the code Xu Wang
  2020-06-24  6:52 ` Xu Wang
@ 2020-06-24 14:51 ` Coly Li
  1 sibling, 0 replies; 3+ messages in thread
From: Coly Li @ 2020-06-24 14:51 UTC (permalink / raw)
  To: Xu Wang; +Cc: kent.overstreet, linux-bcache, linux-kernel

On 2020/6/24 14:52, Xu Wang wrote:
> Using for_each_clear_bit() to simplify the code.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

It looks good to me, I will add it in my testing patches.

Thanks.

Coly Li

> ---
>  drivers/md/bcache/journal.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
> index 90aac4e2333f..b01c953e214c 100644
> --- a/drivers/md/bcache/journal.c
> +++ b/drivers/md/bcache/journal.c
> @@ -217,10 +217,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)
>  		 */
>  		pr_debug("falling back to linear search\n");
>  
> -		for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets);
> -		     l < ca->sb.njournal_buckets;
> -		     l = find_next_zero_bit(bitmap, ca->sb.njournal_buckets,
> -					    l + 1))
> +		for_each_clear_bit(l, bitmap, ca->sb.njournal_buckets)
>  			if (read_bucket(l))
>  				goto bsearch;
>  
> 

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

end of thread, other threads:[~2020-06-24 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  6:52 [PATCH] bcache: journel: use for_each_clear_bit() to simplify the code Xu Wang
2020-06-24  6:52 ` Xu Wang
2020-06-24 14:51 ` Coly Li

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