xfs_vfs.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) 2000-2006 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_VFS_H__
  19. #define __XFS_VFS_H__
  20. #include <linux/vfs.h>
  21. #include "xfs_fs.h"
  22. struct bhv_vfs;
  23. struct inode;
  24. struct fid;
  25. struct cred;
  26. struct seq_file;
  27. struct super_block;
  28. struct xfs_inode;
  29. struct xfs_mount;
  30. struct xfs_mount_args;
  31. typedef struct kstatfs bhv_statvfs_t;
  32. typedef struct bhv_vfs_sync_work {
  33. struct list_head w_list;
  34. struct bhv_vfs *w_vfs;
  35. void *w_data; /* syncer routine argument */
  36. void (*w_syncer)(struct bhv_vfs *, void *);
  37. } bhv_vfs_sync_work_t;
  38. typedef struct bhv_vfs {
  39. struct xfs_mount *vfs_mount;
  40. u_int vfs_flag; /* flags */
  41. struct super_block *vfs_super; /* generic superblock pointer */
  42. struct task_struct *vfs_sync_task; /* generalised sync thread */
  43. bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */
  44. struct list_head vfs_sync_list; /* sync thread work item list */
  45. spinlock_t vfs_sync_lock; /* work item list lock */
  46. int vfs_sync_seq; /* sync thread generation no. */
  47. wait_queue_head_t vfs_wait_single_sync_task;
  48. } bhv_vfs_t;
  49. #define VFS_RDONLY 0x0001 /* read-only vfs */
  50. #define VFS_GRPID 0x0002 /* group-ID assigned from directory */
  51. #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */
  52. /* ---- VFS_UMOUNT ---- 0x0008 -- unneeded, fixed via kthread APIs */
  53. #define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */
  54. #define VFS_END 0x0010 /* max flag */
  55. #define SYNC_ATTR 0x0001 /* sync attributes */
  56. #define SYNC_CLOSE 0x0002 /* close file system down */
  57. #define SYNC_DELWRI 0x0004 /* look at delayed writes */
  58. #define SYNC_WAIT 0x0008 /* wait for i/o to complete */
  59. #define SYNC_BDFLUSH 0x0010 /* BDFLUSH is calling -- don't block */
  60. #define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
  61. #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
  62. #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
  63. #define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */
  64. #define SYNC_SUPER 0x0200 /* flush superblock to disk */
  65. /*
  66. * When remounting a filesystem read-only or freezing the filesystem,
  67. * we have two phases to execute. This first phase is syncing the data
  68. * before we quiesce the fielsystem, and the second is flushing all the
  69. * inodes out after we've waited for all the transactions created by
  70. * the first phase to complete. The second phase uses SYNC_INODE_QUIESCE
  71. * to ensure that the inodes are written to their location on disk
  72. * rather than just existing in transactions in the log. This means
  73. * after a quiesce there is no log replay required to write the inodes
  74. * to disk (this is the main difference between a sync and a quiesce).
  75. */
  76. #define SYNC_DATA_QUIESCE (SYNC_DELWRI|SYNC_FSDATA|SYNC_WAIT|SYNC_IOWAIT)
  77. #define SYNC_INODE_QUIESCE (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT)
  78. #define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */
  79. #define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */
  80. #define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */
  81. #define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */
  82. #define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */
  83. #define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */
  84. #define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen)
  85. #define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l))
  86. extern bhv_vfs_t *vfs_allocate(struct super_block *);
  87. extern bhv_vfs_t *vfs_from_sb(struct super_block *);
  88. extern void vfs_deallocate(bhv_vfs_t *);
  89. #endif /* __XFS_VFS_H__ */