main.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* General filesystem local caching manager
  2. *
  3. * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #define FSCACHE_DEBUG_LEVEL CACHE
  12. #include <linux/module.h>
  13. #include <linux/init.h>
  14. #include <linux/sched.h>
  15. #include <linux/completion.h>
  16. #include <linux/slab.h>
  17. #include "internal.h"
  18. MODULE_DESCRIPTION("FS Cache Manager");
  19. MODULE_AUTHOR("Red Hat, Inc.");
  20. MODULE_LICENSE("GPL");
  21. unsigned fscache_defer_lookup = 1;
  22. module_param_named(defer_lookup, fscache_defer_lookup, uint,
  23. S_IWUSR | S_IRUGO);
  24. MODULE_PARM_DESC(fscache_defer_lookup,
  25. "Defer cookie lookup to background thread");
  26. unsigned fscache_defer_create = 1;
  27. module_param_named(defer_create, fscache_defer_create, uint,
  28. S_IWUSR | S_IRUGO);
  29. MODULE_PARM_DESC(fscache_defer_create,
  30. "Defer cookie creation to background thread");
  31. unsigned fscache_debug;
  32. module_param_named(debug, fscache_debug, uint,
  33. S_IWUSR | S_IRUGO);
  34. MODULE_PARM_DESC(fscache_debug,
  35. "FS-Cache debugging mask");
  36. struct kobject *fscache_root;
  37. /*
  38. * initialise the fs caching module
  39. */
  40. static int __init fscache_init(void)
  41. {
  42. int ret;
  43. ret = slow_work_register_user();
  44. if (ret < 0)
  45. goto error_slow_work;
  46. printk(KERN_NOTICE "FS-Cache: Loaded\n");
  47. return 0;
  48. error_slow_work:
  49. return ret;
  50. }
  51. fs_initcall(fscache_init);
  52. /*
  53. * clean up on module removal
  54. */
  55. static void __exit fscache_exit(void)
  56. {
  57. _enter("");
  58. slow_work_unregister_user();
  59. printk(KERN_NOTICE "FS-Cache: Unloaded\n");
  60. }
  61. module_exit(fscache_exit);