| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This file is part of UBIFS. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2006-2008 Nokia Corporation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 8 | | - * the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 16 | | - * this program; if not, write to the Free Software Foundation, Inc., 51 |
|---|
| 17 | | - * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 18 | 6 | * |
|---|
| 19 | 7 | * Authors: Artem Bityutskiy (Битюцкий Артём) |
|---|
| 20 | 8 | * Adrian Hunter |
|---|
| .. | .. |
|---|
| 747 | 735 | return lpa->dirty + lpa->free - lpb->dirty - lpb->free; |
|---|
| 748 | 736 | } |
|---|
| 749 | 737 | |
|---|
| 750 | | -static void swap_dirty_idx(struct ubifs_lprops **a, struct ubifs_lprops **b, |
|---|
| 751 | | - int size) |
|---|
| 752 | | -{ |
|---|
| 753 | | - swap(*a, *b); |
|---|
| 754 | | -} |
|---|
| 755 | | - |
|---|
| 756 | 738 | /** |
|---|
| 757 | 739 | * ubifs_save_dirty_idx_lnums - save an array of the most dirty index LEB nos. |
|---|
| 758 | 740 | * @c: the UBIFS file-system description object |
|---|
| .. | .. |
|---|
| 772 | 754 | sizeof(void *) * c->dirty_idx.cnt); |
|---|
| 773 | 755 | /* Sort it so that the dirtiest is now at the end */ |
|---|
| 774 | 756 | sort(c->dirty_idx.arr, c->dirty_idx.cnt, sizeof(void *), |
|---|
| 775 | | - (int (*)(const void *, const void *))cmp_dirty_idx, |
|---|
| 776 | | - (void (*)(void *, void *, int))swap_dirty_idx); |
|---|
| 757 | + (int (*)(const void *, const void *))cmp_dirty_idx, NULL); |
|---|
| 777 | 758 | dbg_find("found %d dirty index LEBs", c->dirty_idx.cnt); |
|---|
| 778 | 759 | if (c->dirty_idx.cnt) |
|---|
| 779 | 760 | dbg_find("dirtiest index LEB is %d with dirty %d and free %d", |
|---|