dm: Make use of __assign_bit() API

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>
This commit is contained in:
Hongbo Li 2024-09-02 21:11:23 +08:00 committed by Mikulas Patocka
parent 35c9f09b56
commit 26207c6332

View File

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