blob: 5c4996356226d9bf1731fd097d8503e60edabe0c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scottb83bd132006-06-09 16:48:30 +10002 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
Nathan Scott7b718762005-11-02 14:58:39 +11003 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * 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 Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * 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 Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * 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 Torvalds1da177e2005-04-16 15:20:36 -070017 */
18#ifndef __XFS_VFS_H__
19#define __XFS_VFS_H__
20
21#include <linux/vfs.h>
22#include "xfs_fs.h"
23
Nathan Scottb83bd132006-06-09 16:48:30 +100024struct bhv_vfs;
Christoph Hellwig0a74cd12007-08-29 11:53:12 +100025struct inode;
Nathan Scott8285fb52006-06-09 17:07:12 +100026
Linus Torvalds1da177e2005-04-16 15:20:36 -070027struct fid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028struct cred;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029struct seq_file;
30struct super_block;
Christoph Hellwig739bfb22007-08-29 10:58:01 +100031struct xfs_inode;
Christoph Hellwig745f6912007-08-30 17:20:39 +100032struct xfs_mount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033struct xfs_mount_args;
34
Nathan Scott8285fb52006-06-09 17:07:12 +100035typedef struct kstatfs bhv_statvfs_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Nathan Scottb83bd132006-06-09 16:48:30 +100037typedef struct bhv_vfs_sync_work {
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 struct list_head w_list;
Nathan Scottb83bd132006-06-09 16:48:30 +100039 struct bhv_vfs *w_vfs;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 void *w_data; /* syncer routine argument */
Nathan Scottb83bd132006-06-09 16:48:30 +100041 void (*w_syncer)(struct bhv_vfs *, void *);
42} bhv_vfs_sync_work_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Nathan Scottb83bd132006-06-09 16:48:30 +100044typedef struct bhv_vfs {
Christoph Hellwig745f6912007-08-30 17:20:39 +100045 struct xfs_mount *vfs_mount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 struct super_block *vfs_super; /* generic superblock pointer */
47 struct task_struct *vfs_sync_task; /* generalised sync thread */
Nathan Scottb83bd132006-06-09 16:48:30 +100048 bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 struct list_head vfs_sync_list; /* sync thread work item list */
50 spinlock_t vfs_sync_lock; /* work item list lock */
Nathan Scottb83bd132006-06-09 16:48:30 +100051 int vfs_sync_seq; /* sync thread generation no. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 wait_queue_head_t vfs_wait_single_sync_task;
Nathan Scottb83bd132006-06-09 16:48:30 +100053} bhv_vfs_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#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 */
David Chinner3c0dc772007-02-10 18:37:22 +110063#define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */
David Chinner92821e22007-05-24 15:26:31 +100064#define SYNC_SUPER 0x0200 /* flush superblock to disk */
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
David Chinner516b2e72007-06-18 16:50:48 +100066/*
67 * When remounting a filesystem read-only or freezing the filesystem,
68 * we have two phases to execute. This first phase is syncing the data
69 * before we quiesce the fielsystem, and the second is flushing all the
70 * inodes out after we've waited for all the transactions created by
71 * the first phase to complete. The second phase uses SYNC_INODE_QUIESCE
72 * to ensure that the inodes are written to their location on disk
73 * rather than just existing in transactions in the log. This means
74 * after a quiesce there is no log replay required to write the inodes
75 * to disk (this is the main difference between a sync and a quiesce).
76 */
77#define SYNC_DATA_QUIESCE (SYNC_DELWRI|SYNC_FSDATA|SYNC_WAIT|SYNC_IOWAIT)
78#define SYNC_INODE_QUIESCE (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT)
79
Nathan Scott7d04a332006-06-09 14:58:38 +100080#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */
81#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */
82#define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */
83#define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */
84#define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */
85#define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */
86
Nathan Scott34327e12006-06-09 17:11:55 +100087#define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen)
88#define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l))
89
Nathan Scottb83bd132006-06-09 16:48:30 +100090extern bhv_vfs_t *vfs_allocate(struct super_block *);
91extern bhv_vfs_t *vfs_from_sb(struct super_block *);
92extern void vfs_deallocate(bhv_vfs_t *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#endif /* __XFS_VFS_H__ */