ubifs: find.c: replace swap function with built-in one

Replace swap_dirty_idx function with built-in one,
because swap_dirty_idx does only a simple byte to byte swap.

Since Spectre mitigations have made indirect function calls more
expensive, and the default simple byte copies swap is implemented
without them, an "optimized" custom swap function is now
a waste of time as well as code.

Signed-off-by: Andrey Abramov <st5pub@yandex.ru>
Reviewed by: George Spelvin <lkml@sdf.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Andrey Abramov 2019-04-02 23:52:10 +03:00 committed by Richard Weinberger
parent e9cd7dfd7e
commit 257bb92420
1 changed files with 1 additions and 8 deletions

View File

@ -747,12 +747,6 @@ static int cmp_dirty_idx(const struct ubifs_lprops **a,
return lpa->dirty + lpa->free - lpb->dirty - lpb->free; return lpa->dirty + lpa->free - lpb->dirty - lpb->free;
} }
static void swap_dirty_idx(struct ubifs_lprops **a, struct ubifs_lprops **b,
int size)
{
swap(*a, *b);
}
/** /**
* ubifs_save_dirty_idx_lnums - save an array of the most dirty index LEB nos. * ubifs_save_dirty_idx_lnums - save an array of the most dirty index LEB nos.
* @c: the UBIFS file-system description object * @c: the UBIFS file-system description object
@ -772,8 +766,7 @@ int ubifs_save_dirty_idx_lnums(struct ubifs_info *c)
sizeof(void *) * c->dirty_idx.cnt); sizeof(void *) * c->dirty_idx.cnt);
/* Sort it so that the dirtiest is now at the end */ /* Sort it so that the dirtiest is now at the end */
sort(c->dirty_idx.arr, c->dirty_idx.cnt, sizeof(void *), sort(c->dirty_idx.arr, c->dirty_idx.cnt, sizeof(void *),
(int (*)(const void *, const void *))cmp_dirty_idx, (int (*)(const void *, const void *))cmp_dirty_idx, NULL);
(void (*)(void *, void *, int))swap_dirty_idx);
dbg_find("found %d dirty index LEBs", c->dirty_idx.cnt); dbg_find("found %d dirty index LEBs", c->dirty_idx.cnt);
if (c->dirty_idx.cnt) if (c->dirty_idx.cnt)
dbg_find("dirtiest index LEB is %d with dirty %d and free %d", dbg_find("dirtiest index LEB is %d with dirty %d and free %d",