sb.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * sb.h - NILFS on-memory super block structure.
  3. *
  4. * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. *
  20. * Written by Ryusuke Konishi <ryusuke@osrg.net>
  21. *
  22. */
  23. #ifndef _NILFS_SB
  24. #define _NILFS_SB
  25. #include <linux/types.h>
  26. #include <linux/fs.h>
  27. struct the_nilfs;
  28. struct nilfs_sc_info;
  29. /*
  30. * NILFS super-block data in memory
  31. */
  32. struct nilfs_sb_info {
  33. /* Mount options */
  34. unsigned long s_mount_opt;
  35. uid_t s_resuid;
  36. gid_t s_resgid;
  37. unsigned long s_interval; /* construction interval */
  38. unsigned long s_watermark; /* threshold of data amount
  39. for the segment construction */
  40. /* Fundamental members */
  41. struct super_block *s_super; /* reverse pointer to super_block */
  42. struct the_nilfs *s_nilfs;
  43. /* Segment constructor */
  44. struct list_head s_dirty_files; /* dirty files list */
  45. struct nilfs_sc_info *s_sc_info; /* segment constructor info */
  46. spinlock_t s_inode_lock; /* Lock for the nilfs inode.
  47. It covers s_dirty_files list */
  48. /* Inode allocator */
  49. spinlock_t s_next_gen_lock;
  50. u32 s_next_generation;
  51. };
  52. static inline struct nilfs_sb_info *NILFS_SB(struct super_block *sb)
  53. {
  54. return sb->s_fs_info;
  55. }
  56. static inline struct nilfs_sc_info *NILFS_SC(struct nilfs_sb_info *sbi)
  57. {
  58. return sbi->s_sc_info;
  59. }
  60. /*
  61. * Bit operations for the mount option
  62. */
  63. #define nilfs_clear_opt(sbi, opt) \
  64. do { (sbi)->s_mount_opt &= ~NILFS_MOUNT_##opt; } while (0)
  65. #define nilfs_set_opt(sbi, opt) \
  66. do { (sbi)->s_mount_opt |= NILFS_MOUNT_##opt; } while (0)
  67. #define nilfs_test_opt(sbi, opt) ((sbi)->s_mount_opt & NILFS_MOUNT_##opt)
  68. #define nilfs_write_opt(sbi, mask, opt) \
  69. do { (sbi)->s_mount_opt = \
  70. (((sbi)->s_mount_opt & ~NILFS_MOUNT_##mask) | \
  71. NILFS_MOUNT_##opt); \
  72. } while (0)
  73. #endif /* _NILFS_SB */