Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 2 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
| 18 | #ifndef __XFS_VFS_H__ |
| 19 | #define __XFS_VFS_H__ |
| 20 | |
| 21 | #include <linux/vfs.h> |
| 22 | #include "xfs_fs.h" |
| 23 | |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 24 | struct bhv_vfs; |
Christoph Hellwig | 0a74cd1 | 2007-08-29 11:53:12 +1000 | [diff] [blame] | 25 | struct inode; |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | struct fid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | struct cred; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | struct seq_file; |
| 30 | struct super_block; |
Christoph Hellwig | 739bfb2 | 2007-08-29 10:58:01 +1000 | [diff] [blame] | 31 | struct xfs_inode; |
Christoph Hellwig | 745f691 | 2007-08-30 17:20:39 +1000 | [diff] [blame^] | 32 | struct xfs_mount; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | struct xfs_mount_args; |
| 34 | |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 35 | typedef struct kstatfs bhv_statvfs_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 37 | typedef struct bhv_vfs_sync_work { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | struct list_head w_list; |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 39 | struct bhv_vfs *w_vfs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | void *w_data; /* syncer routine argument */ |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 41 | void (*w_syncer)(struct bhv_vfs *, void *); |
| 42 | } bhv_vfs_sync_work_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 44 | typedef struct bhv_vfs { |
Christoph Hellwig | 745f691 | 2007-08-30 17:20:39 +1000 | [diff] [blame^] | 45 | struct xfs_mount *vfs_mount; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | u_int vfs_flag; /* flags */ |
| 47 | xfs_fsid_t vfs_fsid; /* file system ID */ |
| 48 | xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | struct super_block *vfs_super; /* generic superblock pointer */ |
| 50 | struct task_struct *vfs_sync_task; /* generalised sync thread */ |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 51 | bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | struct list_head vfs_sync_list; /* sync thread work item list */ |
| 53 | spinlock_t vfs_sync_lock; /* work item list lock */ |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 54 | int vfs_sync_seq; /* sync thread generation no. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | wait_queue_head_t vfs_wait_single_sync_task; |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 56 | } bhv_vfs_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #define VFS_RDONLY 0x0001 /* read-only vfs */ |
| 59 | #define VFS_GRPID 0x0002 /* group-ID assigned from directory */ |
| 60 | #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */ |
Nathan Scott | 29b6d22 | 2006-09-28 10:59:06 +1000 | [diff] [blame] | 61 | /* ---- VFS_UMOUNT ---- 0x0008 -- unneeded, fixed via kthread APIs */ |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 62 | #define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */ |
| 63 | #define VFS_END 0x0010 /* max flag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | #define SYNC_ATTR 0x0001 /* sync attributes */ |
| 66 | #define SYNC_CLOSE 0x0002 /* close file system down */ |
| 67 | #define SYNC_DELWRI 0x0004 /* look at delayed writes */ |
| 68 | #define SYNC_WAIT 0x0008 /* wait for i/o to complete */ |
| 69 | #define SYNC_BDFLUSH 0x0010 /* BDFLUSH is calling -- don't block */ |
| 70 | #define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ |
| 71 | #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ |
| 72 | #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ |
David Chinner | 3c0dc77 | 2007-02-10 18:37:22 +1100 | [diff] [blame] | 73 | #define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */ |
David Chinner | 92821e2 | 2007-05-24 15:26:31 +1000 | [diff] [blame] | 74 | #define SYNC_SUPER 0x0200 /* flush superblock to disk */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
David Chinner | 516b2e7 | 2007-06-18 16:50:48 +1000 | [diff] [blame] | 76 | /* |
| 77 | * When remounting a filesystem read-only or freezing the filesystem, |
| 78 | * we have two phases to execute. This first phase is syncing the data |
| 79 | * before we quiesce the fielsystem, and the second is flushing all the |
| 80 | * inodes out after we've waited for all the transactions created by |
| 81 | * the first phase to complete. The second phase uses SYNC_INODE_QUIESCE |
| 82 | * to ensure that the inodes are written to their location on disk |
| 83 | * rather than just existing in transactions in the log. This means |
| 84 | * after a quiesce there is no log replay required to write the inodes |
| 85 | * to disk (this is the main difference between a sync and a quiesce). |
| 86 | */ |
| 87 | #define SYNC_DATA_QUIESCE (SYNC_DELWRI|SYNC_FSDATA|SYNC_WAIT|SYNC_IOWAIT) |
| 88 | #define SYNC_INODE_QUIESCE (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT) |
| 89 | |
Nathan Scott | 7d04a33 | 2006-06-09 14:58:38 +1000 | [diff] [blame] | 90 | #define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */ |
| 91 | #define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */ |
| 92 | #define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */ |
| 93 | #define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */ |
| 94 | #define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */ |
| 95 | #define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */ |
| 96 | |
Nathan Scott | 34327e1 | 2006-06-09 17:11:55 +1000 | [diff] [blame] | 97 | #define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen) |
| 98 | #define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l)) |
| 99 | |
Nathan Scott | b83bd13 | 2006-06-09 16:48:30 +1000 | [diff] [blame] | 100 | extern bhv_vfs_t *vfs_allocate(struct super_block *); |
| 101 | extern bhv_vfs_t *vfs_from_sb(struct super_block *); |
| 102 | extern void vfs_deallocate(bhv_vfs_t *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | #endif /* __XFS_VFS_H__ */ |