super.c (3fea4d9d160186617ff40490ae01f4f4f36b28ff) super.c (2e3cbf425804fb44a005e252f88f93dff108c911)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * This file is part of UBIFS.
4 *
5 * Copyright (C) 2006-2008 Nokia Corporation.
6 *
7 * Authors: Artem Bityutskiy (Битюцкий Артём)
8 * Adrian Hunter

--- 1250 unchanged lines hidden (view full) ---

1259 err = init_constants_early(c);
1260 if (err)
1261 return err;
1262
1263 err = ubifs_debugging_init(c);
1264 if (err)
1265 return err;
1266
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * This file is part of UBIFS.
4 *
5 * Copyright (C) 2006-2008 Nokia Corporation.
6 *
7 * Authors: Artem Bityutskiy (Битюцкий Артём)
8 * Adrian Hunter

--- 1250 unchanged lines hidden (view full) ---

1259 err = init_constants_early(c);
1260 if (err)
1261 return err;
1262
1263 err = ubifs_debugging_init(c);
1264 if (err)
1265 return err;
1266
1267 err = ubifs_sysfs_register(c);
1268 if (err)
1269 goto out_debugging;
1270
1267 err = check_volume_empty(c);
1268 if (err)
1269 goto out_free;
1270
1271 if (c->empty && (c->ro_mount || c->ro_media)) {
1272 /*
1273 * This UBI volume is empty, and read-only, or the file system
1274 * is mounted read-only - we cannot format it.

--- 360 unchanged lines hidden (view full) ---

1635 ubifs_exit_authentication(c);
1636out_free:
1637 kfree(c->write_reserve_buf);
1638 kfree(c->bu.buf);
1639 vfree(c->ileb_buf);
1640 vfree(c->sbuf);
1641 kfree(c->bottom_up_buf);
1642 kfree(c->sup_node);
1271 err = check_volume_empty(c);
1272 if (err)
1273 goto out_free;
1274
1275 if (c->empty && (c->ro_mount || c->ro_media)) {
1276 /*
1277 * This UBI volume is empty, and read-only, or the file system
1278 * is mounted read-only - we cannot format it.

--- 360 unchanged lines hidden (view full) ---

1639 ubifs_exit_authentication(c);
1640out_free:
1641 kfree(c->write_reserve_buf);
1642 kfree(c->bu.buf);
1643 vfree(c->ileb_buf);
1644 vfree(c->sbuf);
1645 kfree(c->bottom_up_buf);
1646 kfree(c->sup_node);
1647 ubifs_sysfs_unregister(c);
1648out_debugging:
1643 ubifs_debugging_exit(c);
1644 return err;
1645}
1646
1647/**
1648 * ubifs_umount - un-mount UBIFS file-system.
1649 * @c: UBIFS file-system description object
1650 *

--- 27 unchanged lines hidden (view full) ---

1678 kfree(c->mst_node);
1679 kfree(c->write_reserve_buf);
1680 kfree(c->bu.buf);
1681 vfree(c->ileb_buf);
1682 vfree(c->sbuf);
1683 kfree(c->bottom_up_buf);
1684 kfree(c->sup_node);
1685 ubifs_debugging_exit(c);
1649 ubifs_debugging_exit(c);
1650 return err;
1651}
1652
1653/**
1654 * ubifs_umount - un-mount UBIFS file-system.
1655 * @c: UBIFS file-system description object
1656 *

--- 27 unchanged lines hidden (view full) ---

1684 kfree(c->mst_node);
1685 kfree(c->write_reserve_buf);
1686 kfree(c->bu.buf);
1687 vfree(c->ileb_buf);
1688 vfree(c->sbuf);
1689 kfree(c->bottom_up_buf);
1690 kfree(c->sup_node);
1691 ubifs_debugging_exit(c);
1692 ubifs_sysfs_unregister(c);
1686}
1687
1688/**
1689 * ubifs_remount_rw - re-mount in read-write mode.
1690 * @c: UBIFS file-system description object
1691 *
1692 * UBIFS avoids allocating many unnecessary resources when mounted in read-only
1693 * mode. This function allocates the needed resources and re-mounts UBIFS in

--- 734 unchanged lines hidden (view full) ---

2428 goto out_slab;
2429
2430 err = ubifs_compressors_init();
2431 if (err)
2432 goto out_shrinker;
2433
2434 dbg_debugfs_init();
2435
1693}
1694
1695/**
1696 * ubifs_remount_rw - re-mount in read-write mode.
1697 * @c: UBIFS file-system description object
1698 *
1699 * UBIFS avoids allocating many unnecessary resources when mounted in read-only
1700 * mode. This function allocates the needed resources and re-mounts UBIFS in

--- 734 unchanged lines hidden (view full) ---

2435 goto out_slab;
2436
2437 err = ubifs_compressors_init();
2438 if (err)
2439 goto out_shrinker;
2440
2441 dbg_debugfs_init();
2442
2443 err = ubifs_sysfs_init();
2444 if (err)
2445 goto out_dbg;
2446
2436 err = register_filesystem(&ubifs_fs_type);
2437 if (err) {
2438 pr_err("UBIFS error (pid %d): cannot register file system, error %d",
2439 current->pid, err);
2447 err = register_filesystem(&ubifs_fs_type);
2448 if (err) {
2449 pr_err("UBIFS error (pid %d): cannot register file system, error %d",
2450 current->pid, err);
2440 goto out_dbg;
2451 goto out_sysfs;
2441 }
2442 return 0;
2443
2452 }
2453 return 0;
2454
2455out_sysfs:
2456 ubifs_sysfs_exit();
2444out_dbg:
2445 dbg_debugfs_exit();
2446 ubifs_compressors_exit();
2447out_shrinker:
2448 unregister_shrinker(&ubifs_shrinker_info);
2449out_slab:
2450 kmem_cache_destroy(ubifs_inode_slab);
2451 return err;
2452}
2453/* late_initcall to let compressors initialize first */
2454late_initcall(ubifs_init);
2455
2456static void __exit ubifs_exit(void)
2457{
2458 WARN_ON(!list_empty(&ubifs_infos));
2459 WARN_ON(atomic_long_read(&ubifs_clean_zn_cnt) != 0);
2460
2461 dbg_debugfs_exit();
2457out_dbg:
2458 dbg_debugfs_exit();
2459 ubifs_compressors_exit();
2460out_shrinker:
2461 unregister_shrinker(&ubifs_shrinker_info);
2462out_slab:
2463 kmem_cache_destroy(ubifs_inode_slab);
2464 return err;
2465}
2466/* late_initcall to let compressors initialize first */
2467late_initcall(ubifs_init);
2468
2469static void __exit ubifs_exit(void)
2470{
2471 WARN_ON(!list_empty(&ubifs_infos));
2472 WARN_ON(atomic_long_read(&ubifs_clean_zn_cnt) != 0);
2473
2474 dbg_debugfs_exit();
2475 ubifs_sysfs_exit();
2462 ubifs_compressors_exit();
2463 unregister_shrinker(&ubifs_shrinker_info);
2464
2465 /*
2466 * Make sure all delayed rcu free inodes are flushed before we
2467 * destroy cache.
2468 */
2469 rcu_barrier();
2470 kmem_cache_destroy(ubifs_inode_slab);
2471 unregister_filesystem(&ubifs_fs_type);
2472}
2473module_exit(ubifs_exit);
2474
2475MODULE_LICENSE("GPL");
2476MODULE_VERSION(__stringify(UBIFS_VERSION));
2477MODULE_AUTHOR("Artem Bityutskiy, Adrian Hunter");
2478MODULE_DESCRIPTION("UBIFS - UBI File System");
2476 ubifs_compressors_exit();
2477 unregister_shrinker(&ubifs_shrinker_info);
2478
2479 /*
2480 * Make sure all delayed rcu free inodes are flushed before we
2481 * destroy cache.
2482 */
2483 rcu_barrier();
2484 kmem_cache_destroy(ubifs_inode_slab);
2485 unregister_filesystem(&ubifs_fs_type);
2486}
2487module_exit(ubifs_exit);
2488
2489MODULE_LICENSE("GPL");
2490MODULE_VERSION(__stringify(UBIFS_VERSION));
2491MODULE_AUTHOR("Artem Bityutskiy, Adrian Hunter");
2492MODULE_DESCRIPTION("UBIFS - UBI File System");