]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm: Make use of __assign_bit() API
authorHongbo Li <lihongbo22@huawei.com>
Mon, 2 Sep 2024 13:11:23 +0000 (21:11 +0800)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 2 Sep 2024 14:53:53 +0000 (16:53 +0200)
We have for some time the __assign_bit() API to replace
open coded
    if (foo)
        __set_bit(n, bar);
    else
        __clear_bit(n, bar);

Use this API to simplify the code. No functional change
intended.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-clone-metadata.c

index 2db84cd2202b068d069fa982bd6b3de04a9b9b3f..14c5c28d938b26256096eacd15ba10b85320cc74 100644 (file)
@@ -530,10 +530,7 @@ static int __load_bitset_in_core(struct dm_clone_metadata *cmd)
                return r;
 
        for (i = 0; ; i++) {
-               if (dm_bitset_cursor_get_value(&c))
-                       __set_bit(i, cmd->region_map);
-               else
-                       __clear_bit(i, cmd->region_map);
+               __assign_bit(i, cmd->region_map, dm_bitset_cursor_get_value(&c));
 
                if (i >= (cmd->nr_regions - 1))
                        break;