super.c (aaccf3c97418f169afdbb5855e9cbcbda34e90fd) super.c (0f843e65d9eef4936929bb036c5f771fb261eea4)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * bcache setup/teardown code, and some metadata io - read a superblock and
4 * figure out what to do with it.
5 *
6 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
7 * Copyright 2012 Google, Inc.
8 */

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

42struct mutex bch_register_lock;
43LIST_HEAD(bch_cache_sets);
44static LIST_HEAD(uncached_devices);
45
46static int bcache_major;
47static DEFINE_IDA(bcache_device_idx);
48static wait_queue_head_t unregister_wait;
49struct workqueue_struct *bcache_wq;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * bcache setup/teardown code, and some metadata io - read a superblock and
4 * figure out what to do with it.
5 *
6 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
7 * Copyright 2012 Google, Inc.
8 */

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

42struct mutex bch_register_lock;
43LIST_HEAD(bch_cache_sets);
44static LIST_HEAD(uncached_devices);
45
46static int bcache_major;
47static DEFINE_IDA(bcache_device_idx);
48static wait_queue_head_t unregister_wait;
49struct workqueue_struct *bcache_wq;
50struct workqueue_struct *bch_journal_wq;
50
51#define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE)
52/* limitation of partitions number on single bcache device */
53#define BCACHE_MINORS 128
54/* limitation of bcache devices number on single system */
55#define BCACHE_DEVICE_IDX_MAX ((1U << MINORBITS)/BCACHE_MINORS)
56
57/* Superblock */

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

2336static void bcache_exit(void)
2337{
2338 bch_debug_exit();
2339 bch_request_exit();
2340 if (bcache_kobj)
2341 kobject_put(bcache_kobj);
2342 if (bcache_wq)
2343 destroy_workqueue(bcache_wq);
51
52#define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE)
53/* limitation of partitions number on single bcache device */
54#define BCACHE_MINORS 128
55/* limitation of bcache devices number on single system */
56#define BCACHE_DEVICE_IDX_MAX ((1U << MINORBITS)/BCACHE_MINORS)
57
58/* Superblock */

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

2337static void bcache_exit(void)
2338{
2339 bch_debug_exit();
2340 bch_request_exit();
2341 if (bcache_kobj)
2342 kobject_put(bcache_kobj);
2343 if (bcache_wq)
2344 destroy_workqueue(bcache_wq);
2345 if (bch_journal_wq)
2346 destroy_workqueue(bch_journal_wq);
2347
2344 if (bcache_major)
2345 unregister_blkdev(bcache_major, "bcache");
2346 unregister_reboot_notifier(&reboot);
2347 mutex_destroy(&bch_register_lock);
2348}
2349
2350static int __init bcache_init(void)
2351{

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

2365 mutex_destroy(&bch_register_lock);
2366 return bcache_major;
2367 }
2368
2369 bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0);
2370 if (!bcache_wq)
2371 goto err;
2372
2348 if (bcache_major)
2349 unregister_blkdev(bcache_major, "bcache");
2350 unregister_reboot_notifier(&reboot);
2351 mutex_destroy(&bch_register_lock);
2352}
2353
2354static int __init bcache_init(void)
2355{

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

2369 mutex_destroy(&bch_register_lock);
2370 return bcache_major;
2371 }
2372
2373 bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0);
2374 if (!bcache_wq)
2375 goto err;
2376
2377 bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0);
2378 if (!bch_journal_wq)
2379 goto err;
2380
2373 bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
2374 if (!bcache_kobj)
2375 goto err;
2376
2377 if (bch_request_init() ||
2378 sysfs_create_files(bcache_kobj, files))
2379 goto err;
2380
2381 bch_debug_init(bcache_kobj);
2382 closure_debug_init();
2383
2384 return 0;
2385err:
2386 bcache_exit();
2387 return -ENOMEM;
2388}
2389
2390module_exit(bcache_exit);
2391module_init(bcache_init);
2381 bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
2382 if (!bcache_kobj)
2383 goto err;
2384
2385 if (bch_request_init() ||
2386 sysfs_create_files(bcache_kobj, files))
2387 goto err;
2388
2389 bch_debug_init(bcache_kobj);
2390 closure_debug_init();
2391
2392 return 0;
2393err:
2394 bcache_exit();
2395 return -ENOMEM;
2396}
2397
2398module_exit(bcache_exit);
2399module_init(bcache_init);