summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Abramov <st5pub@yandex.ru>2019-04-02 16:52:10 -0400
committerRichard Weinberger <richard@nod.at>2019-05-07 15:58:29 -0400
commit257bb92420d63c4d38da4cf0ae9a0b61ac985eca (patch)
treeb476c4a7128121424c4162240393fd553e3922dc
parente9cd7dfd7ef939394436ef6d03ff156e587ba39e (diff)
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>
-rw-r--r--fs/ubifs/find.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index f9646835b026..5deaae7fcead 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -747,12 +747,6 @@ static int cmp_dirty_idx(const struct ubifs_lprops **a,
747 return lpa->dirty + lpa->free - lpb->dirty - lpb->free; 747 return lpa->dirty + lpa->free - lpb->dirty - lpb->free;
748} 748}
749 749
750static void swap_dirty_idx(struct ubifs_lprops **a, struct ubifs_lprops **b,
751 int size)
752{
753 swap(*a, *b);
754}
755
756/** 750/**
757 * ubifs_save_dirty_idx_lnums - save an array of the most dirty index LEB nos. 751 * ubifs_save_dirty_idx_lnums - save an array of the most dirty index LEB nos.
758 * @c: the UBIFS file-system description object 752 * @c: the UBIFS file-system description object
@@ -772,8 +766,7 @@ int ubifs_save_dirty_idx_lnums(struct ubifs_info *c)
772 sizeof(void *) * c->dirty_idx.cnt); 766 sizeof(void *) * c->dirty_idx.cnt);
773 /* Sort it so that the dirtiest is now at the end */ 767 /* Sort it so that the dirtiest is now at the end */
774 sort(c->dirty_idx.arr, c->dirty_idx.cnt, sizeof(void *), 768 sort(c->dirty_idx.arr, c->dirty_idx.cnt, sizeof(void *),
775 (int (*)(const void *, const void *))cmp_dirty_idx, 769 (int (*)(const void *, const void *))cmp_dirty_idx, NULL);
776 (void (*)(void *, void *, int))swap_dirty_idx);
777 dbg_find("found %d dirty index LEBs", c->dirty_idx.cnt); 770 dbg_find("found %d dirty index LEBs", c->dirty_idx.cnt);
778 if (c->dirty_idx.cnt) 771 if (c->dirty_idx.cnt)
779 dbg_find("dirtiest index LEB is %d with dirty %d and free %d", 772 dbg_find("dirtiest index LEB is %d with dirty %d and free %d",