| .. | .. |
|---|
| 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: Adrian Hunter |
|---|
| 20 | 8 | * Artem Bityutskiy (Битюцкий Артём) |
|---|
| .. | .. |
|---|
| 63 | 51 | static void shrink_liability(struct ubifs_info *c, int nr_to_write) |
|---|
| 64 | 52 | { |
|---|
| 65 | 53 | down_read(&c->vfs_sb->s_umount); |
|---|
| 66 | | - writeback_inodes_sb(c->vfs_sb, WB_REASON_FS_FREE_SPACE); |
|---|
| 54 | + writeback_inodes_sb_nr(c->vfs_sb, nr_to_write, WB_REASON_FS_FREE_SPACE); |
|---|
| 67 | 55 | up_read(&c->vfs_sb->s_umount); |
|---|
| 68 | 56 | } |
|---|
| 69 | 57 | |
|---|
| .. | .. |
|---|
| 224 | 212 | subtract_lebs += 1; |
|---|
| 225 | 213 | |
|---|
| 226 | 214 | /* |
|---|
| 227 | | - * The GC journal head LEB is not really accessible. And since |
|---|
| 228 | | - * different write types go to different heads, we may count only on |
|---|
| 229 | | - * one head's space. |
|---|
| 215 | + * Since different write types go to different heads, we should |
|---|
| 216 | + * reserve one leb for each head. |
|---|
| 230 | 217 | */ |
|---|
| 231 | | - subtract_lebs += c->jhead_cnt - 1; |
|---|
| 218 | + subtract_lebs += c->jhead_cnt; |
|---|
| 232 | 219 | |
|---|
| 233 | 220 | /* We also reserve one LEB for deletions, which bypass budgeting */ |
|---|
| 234 | 221 | subtract_lebs += 1; |
|---|
| .. | .. |
|---|
| 415 | 402 | dd_growth = req->dirtied_page ? c->bi.page_budget : 0; |
|---|
| 416 | 403 | |
|---|
| 417 | 404 | if (req->dirtied_ino) |
|---|
| 418 | | - dd_growth += c->bi.inode_budget << (req->dirtied_ino - 1); |
|---|
| 405 | + dd_growth += c->bi.inode_budget * req->dirtied_ino; |
|---|
| 419 | 406 | if (req->mod_dent) |
|---|
| 420 | 407 | dd_growth += c->bi.dent_budget; |
|---|
| 421 | 408 | dd_growth += req->dirtied_ino_d; |
|---|