.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * NFTL mount code with extensive checks |
---|
3 | 4 | * |
---|
4 | 5 | * Author: Fabrice Bellard (fabrice.bellard@netgem.com) |
---|
5 | 6 | * Copyright © 2000 Netgem S.A. |
---|
6 | 7 | * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | | - * |
---|
18 | | - * You should have received a copy of the GNU General Public License |
---|
19 | | - * along with this program; if not, write to the Free Software |
---|
20 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
21 | 8 | */ |
---|
22 | 9 | |
---|
23 | 10 | #include <linux/kernel.h> |
---|
.. | .. |
---|
346 | 333 | goto fail; |
---|
347 | 334 | } |
---|
348 | 335 | |
---|
349 | | - /* increase and write Wear-Leveling info */ |
---|
350 | | - nb_erases = le32_to_cpu(uci.WearInfo); |
---|
351 | | - nb_erases++; |
---|
| 336 | + /* increase and write Wear-Leveling info */ |
---|
| 337 | + nb_erases = le32_to_cpu(uci.WearInfo); |
---|
| 338 | + nb_erases++; |
---|
352 | 339 | |
---|
353 | | - /* wrap (almost impossible with current flash) or free block */ |
---|
354 | | - if (nb_erases == 0) |
---|
355 | | - nb_erases = 1; |
---|
| 340 | + /* wrap (almost impossible with current flash) or free block */ |
---|
| 341 | + if (nb_erases == 0) |
---|
| 342 | + nb_erases = 1; |
---|
356 | 343 | |
---|
357 | | - /* check the "freeness" of Erase Unit before updating metadata |
---|
358 | | - * FixMe: is this check really necessary ? since we have check the |
---|
359 | | - * return code after the erase operation. */ |
---|
360 | | - if (check_free_sectors(nftl, instr->addr, nftl->EraseSize, 1) != 0) |
---|
361 | | - goto fail; |
---|
| 344 | + /* check the "freeness" of Erase Unit before updating metadata |
---|
| 345 | + * FixMe: is this check really necessary ? since we have check the |
---|
| 346 | + * return code after the erase operation. |
---|
| 347 | + */ |
---|
| 348 | + if (check_free_sectors(nftl, instr->addr, nftl->EraseSize, 1) != 0) |
---|
| 349 | + goto fail; |
---|
362 | 350 | |
---|
363 | | - uci.WearInfo = le32_to_cpu(nb_erases); |
---|
364 | | - if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE + |
---|
365 | | - 8, 8, &retlen, (char *)&uci) < 0) |
---|
366 | | - goto fail; |
---|
367 | | - return 0; |
---|
| 351 | + uci.WearInfo = le32_to_cpu(nb_erases); |
---|
| 352 | + if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE + |
---|
| 353 | + 8, 8, &retlen, (char *)&uci) < 0) |
---|
| 354 | + goto fail; |
---|
| 355 | + return 0; |
---|
368 | 356 | fail: |
---|
369 | 357 | /* could not format, update the bad block table (caller is responsible |
---|
370 | 358 | for setting the ReplUnitTable to BLOCK_RESERVED on failure) */ |
---|