Commit 7017ded0 authored by Jiapeng Chong's avatar Jiapeng Chong Committed by Mikulas Patocka

dm vdo indexer: use swap() instead of open coding it

Use existing swap() macro rather than duplicating its implementation.
Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9173Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
parent b956d1a3
...@@ -197,15 +197,12 @@ static int finish_previous_chapter(struct uds_index *index, u64 current_chapter_ ...@@ -197,15 +197,12 @@ static int finish_previous_chapter(struct uds_index *index, u64 current_chapter_
static int swap_open_chapter(struct index_zone *zone) static int swap_open_chapter(struct index_zone *zone)
{ {
int result; int result;
struct open_chapter_zone *temporary_chapter;
result = finish_previous_chapter(zone->index, zone->newest_virtual_chapter); result = finish_previous_chapter(zone->index, zone->newest_virtual_chapter);
if (result != UDS_SUCCESS) if (result != UDS_SUCCESS)
return result; return result;
temporary_chapter = zone->open_chapter; swap(zone->open_chapter, zone->writing_chapter);
zone->open_chapter = zone->writing_chapter;
zone->writing_chapter = temporary_chapter;
return UDS_SUCCESS; return UDS_SUCCESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment