2020-12-24 02:02:49

by Yi Li

[permalink] [raw]
Subject: [PATCH] bcache: set pdev_set_uuid before scond loop iteration

There is no need to reassign pdev_set_uuid in the second loop iteration,
so move it to the place before second loop.

Signed-off-by: Yi Li <[email protected]>
---
drivers/md/bcache/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a4752ac410dc..6aa23a6fb394 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2644,8 +2644,8 @@ static ssize_t bch_pending_bdevs_cleanup(struct kobject *k,
}

list_for_each_entry_safe(pdev, tpdev, &pending_devs, list) {
+ char *pdev_set_uuid = pdev->dc->sb.set_uuid;
list_for_each_entry_safe(c, tc, &bch_cache_sets, list) {
- char *pdev_set_uuid = pdev->dc->sb.set_uuid;
char *set_uuid = c->set_uuid;

if (!memcmp(pdev_set_uuid, set_uuid, 16)) {
--
2.25.3




2020-12-24 06:17:12

by Coly Li

[permalink] [raw]
Subject: Re: [PATCH] bcache: set pdev_set_uuid before scond loop iteration

On 12/24/20 9:53 AM, Yi Li wrote:
> There is no need to reassign pdev_set_uuid in the second loop iteration,
> so move it to the place before second loop.
>
> Signed-off-by: Yi Li <[email protected]>

Added into my for-next directory. Thanks.

Coly Li

> ---
> drivers/md/bcache/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index a4752ac410dc..6aa23a6fb394 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -2644,8 +2644,8 @@ static ssize_t bch_pending_bdevs_cleanup(struct kobject *k,
> }
>
> list_for_each_entry_safe(pdev, tpdev, &pending_devs, list) {
> + char *pdev_set_uuid = pdev->dc->sb.set_uuid;
> list_for_each_entry_safe(c, tc, &bch_cache_sets, list) {
> - char *pdev_set_uuid = pdev->dc->sb.set_uuid;
> char *set_uuid = c->set_uuid;
>
> if (!memcmp(pdev_set_uuid, set_uuid, 16)) {
>