Blame view

fs/xfs/xfs_mount.h 15.2 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
7b7187698   Nathan Scott   [XFS] Update lice...
2
3
   * Copyright (c) 2000-2005 Silicon Graphics, Inc.
   * All Rights Reserved.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
   *
7b7187698   Nathan Scott   [XFS] Update lice...
5
6
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
   * published by the Free Software Foundation.
   *
7b7187698   Nathan Scott   [XFS] Update lice...
9
10
11
12
   * This program is distributed in the hope that it would be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
   *
7b7187698   Nathan Scott   [XFS] Update lice...
14
15
16
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write the Free Software Foundation,
   * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
   */
  #ifndef __XFS_MOUNT_H__
  #define	__XFS_MOUNT_H__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  typedef struct xfs_trans_reservations {
  	uint	tr_write;	/* extent alloc trans */
  	uint	tr_itruncate;	/* truncate trans */
  	uint	tr_rename;	/* rename trans */
  	uint	tr_link;	/* link trans */
  	uint	tr_remove;	/* unlink trans */
  	uint	tr_symlink;	/* symlink trans */
  	uint	tr_create;	/* create trans */
  	uint	tr_mkdir;	/* mkdir trans */
  	uint	tr_ifree;	/* inode free trans */
  	uint	tr_ichange;	/* inode update trans */
  	uint	tr_growdata;	/* fs data section grow trans */
  	uint	tr_swrite;	/* sync write inode trans */
  	uint	tr_addafork;	/* cvt inode to attributed trans */
  	uint	tr_writeid;	/* write setuid/setgid file */
  	uint	tr_attrinval;	/* attr fork buffer invalidation */
  	uint	tr_attrset;	/* set/create an attribute */
  	uint	tr_attrrm;	/* remove an attribute */
  	uint	tr_clearagi;	/* clear bad agi unlinked ino bucket */
  	uint	tr_growrtalloc;	/* grow realtime allocations */
  	uint	tr_growrtzero;	/* grow realtime zeroing */
  	uint	tr_growrtfree;	/* grow realtime freeing */
  } xfs_trans_reservations_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
  #ifndef __KERNEL__
847fff5ca   Barry Naujok   [XFS] Sync up ker...
44

9d87c3192   Eric Sandeen   [XFS] Remove the ...
45
  #define xfs_daddr_to_agno(mp,d) \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
  	((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
9d87c3192   Eric Sandeen   [XFS] Remove the ...
47
  #define xfs_daddr_to_agbno(mp,d) \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
  	((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
847fff5ca   Barry Naujok   [XFS] Sync up ker...
49
50
  
  #else /* __KERNEL__ */
6d73cf133   Christoph Hellwig   [XFS] resync head...
51
  #include "xfs_sync.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
  struct log;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
53
  struct xfs_mount_args;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
  struct xfs_inode;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
56
  struct xfs_bmbt_irec;
  struct xfs_bmap_free;
3e57ecf64   Olaf Weber   [XFS] Add paramet...
57
58
  struct xfs_extdelta;
  struct xfs_swapext;
2a82b8be8   David Chinner   [XFS] Concurrent ...
59
  struct xfs_mru_cache;
5163f95a0   Barry Naujok   [XFS] Name operat...
60
  struct xfs_nameops;
82fa90124   David Chinner   [XFS] Allocate th...
61
  struct xfs_ail;
7d095257e   Christoph Hellwig   xfs: kill xfs_qmops
62
  struct xfs_quotainfo;
8d280b98c   David Chinner   [XFS] On machines...
63
64
65
66
67
68
69
70
71
72
73
74
75
  #ifdef HAVE_PERCPU_SB
  
  /*
   * Valid per-cpu incore superblock counters. Note that if you add new counters,
   * you may need to define new counter disabled bit field descriptors as there
   * are more possible fields in the superblock that can fit in a bitfield on a
   * 32 bit platform. The XFS_SBS_* values for the current current counters just
   * fit.
   */
  typedef struct xfs_icsb_cnts {
  	uint64_t	icsb_fdblocks;
  	uint64_t	icsb_ifree;
  	uint64_t	icsb_icount;
01e1b69cf   David Chinner   [XFS] using a spi...
76
  	unsigned long	icsb_flags;
8d280b98c   David Chinner   [XFS] On machines...
77
  } xfs_icsb_cnts_t;
01e1b69cf   David Chinner   [XFS] using a spi...
78
  #define XFS_ICSB_FLAG_LOCK	(1 << 0)	/* counter lock bit */
8d280b98c   David Chinner   [XFS] On machines...
79
80
81
  #define XFS_ICSB_LAZY_COUNT	(1 << 1)	/* accuracy not needed */
  
  extern int	xfs_icsb_init_counters(struct xfs_mount *);
5478eead8   Lachlan McIlroy   [XFS] Re-initiali...
82
  extern void	xfs_icsb_reinit_counters(struct xfs_mount *);
c962fb790   Christoph Hellwig   [XFS] kill xfs_mo...
83
  extern void	xfs_icsb_destroy_counters(struct xfs_mount *);
d4d90b577   Christoph Hellwig   [XFS] Add xfs_ics...
84
85
  extern void	xfs_icsb_sync_counters(struct xfs_mount *, int);
  extern void	xfs_icsb_sync_counters_locked(struct xfs_mount *, int);
96540c785   Christoph Hellwig   xfs: do not use x...
86
87
  extern int	xfs_icsb_modify_counters(struct xfs_mount *, xfs_sb_field_t,
  						int64_t, int);
8d280b98c   David Chinner   [XFS] On machines...
88
89
  
  #else
c962fb790   Christoph Hellwig   [XFS] kill xfs_mo...
90
91
92
  #define xfs_icsb_init_counters(mp)		(0)
  #define xfs_icsb_destroy_counters(mp)		do { } while (0)
  #define xfs_icsb_reinit_counters(mp)		do { } while (0)
d4d90b577   Christoph Hellwig   [XFS] Add xfs_ics...
93
  #define xfs_icsb_sync_counters(mp, flags)	do { } while (0)
7155054c9   Eric Sandeen   [XFS] fix non-smp...
94
  #define xfs_icsb_sync_counters_locked(mp, flags) do { } while (0)
96540c785   Christoph Hellwig   xfs: do not use x...
95
96
  #define xfs_icsb_modify_counters(mp, field, delta, rsvd) \
  	xfs_mod_incore_sb(mp, field, delta, rsvd)
8d280b98c   David Chinner   [XFS] On machines...
97
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
98

055388a31   Dave Chinner   xfs: dynamic spec...
99
100
101
102
103
104
105
106
107
  /* dynamic preallocation free space thresholds, 5% down to 1% */
  enum {
  	XFS_LOWSP_1_PCNT = 0,
  	XFS_LOWSP_2_PCNT,
  	XFS_LOWSP_3_PCNT,
  	XFS_LOWSP_4_PCNT,
  	XFS_LOWSP_5_PCNT,
  	XFS_LOWSP_MAX,
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
  typedef struct xfs_mount {
b267ce995   Christoph Hellwig   [XFS] kill struct...
109
  	struct super_block	*m_super;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
110
  	xfs_tid_t		m_tid;		/* next unused tid for fs */
82fa90124   David Chinner   [XFS] Allocate th...
111
  	struct xfs_ail		*m_ail;		/* fs active log item list */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112
  	xfs_sb_t		m_sb;		/* copy of fs superblock */
3685c2a1d   Eric Sandeen   [XFS] Unwrap XFS_...
113
  	spinlock_t		m_sb_lock;	/* sb counter lock */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114
115
116
  	struct xfs_buf		*m_sb_bp;	/* buffer for superblock */
  	char			*m_fsname;	/* filesystem name */
  	int			m_fsname_len;	/* strlen of fs name */
fc1f8c1ca   Nathan Scott   [XFS] Track exter...
117
118
  	char			*m_rtname;	/* realtime device name */
  	char			*m_logname;	/* external log device name */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
120
121
  	int			m_bsize;	/* fs logical block size */
  	xfs_agnumber_t		m_agfrotor;	/* last ag where space found */
  	xfs_agnumber_t		m_agirotor;	/* last ag dir inode alloced */
36e41eebd   Eric Sandeen   [XFS] Cleanup loc...
122
  	spinlock_t		m_agirotor_lock;/* .. and lock protecting it */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
123
  	xfs_agnumber_t		m_maxagi;	/* highest inode alloc group */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  	uint			m_readio_log;	/* min read size log bytes */
  	uint			m_readio_blocks; /* min read size blocks */
  	uint			m_writeio_log;	/* min write size log bytes */
  	uint			m_writeio_blocks; /* min write size blocks */
  	struct log		*m_log;		/* log specific stuff */
  	int			m_logbufs;	/* number of log buffers */
  	int			m_logbsize;	/* size of each log buffer */
  	uint			m_rsumlevels;	/* rt summary levels */
  	uint			m_rsumsize;	/* size of rt summary, bytes */
  	struct xfs_inode	*m_rbmip;	/* pointer to bitmap inode */
  	struct xfs_inode	*m_rsumip;	/* pointer to summary inode */
  	struct xfs_inode	*m_rootip;	/* pointer to root directory */
  	struct xfs_quotainfo	*m_quotainfo;	/* disk quota information */
  	xfs_buftarg_t		*m_ddev_targp;	/* saves taking the address */
  	xfs_buftarg_t		*m_logdev_targp;/* ptr to log device */
  	xfs_buftarg_t		*m_rtdev_targp;	/* ptr to rt device */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
141
142
143
  	__uint8_t		m_blkbit_log;	/* blocklog + NBBY */
  	__uint8_t		m_blkbb_log;	/* blocklog - BBSHIFT */
  	__uint8_t		m_agno_log;	/* log #ag's */
  	__uint8_t		m_agino_log;	/* #bits for agino in inum */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
144
145
146
147
  	__uint16_t		m_inode_cluster_size;/* min inode buf size */
  	uint			m_blockmask;	/* sb_blocksize-1 */
  	uint			m_blockwsize;	/* sb_blocksize in words */
  	uint			m_blockwmask;	/* blockwsize-1 */
60197e8df   Christoph Hellwig   [XFS] Cleanup max...
148
149
150
151
152
153
  	uint			m_alloc_mxr[2];	/* max alloc btree records */
  	uint			m_alloc_mnr[2];	/* min alloc btree records */
  	uint			m_bmap_dmxr[2];	/* max bmap btree records */
  	uint			m_bmap_dmnr[2];	/* min bmap btree records */
  	uint			m_inobt_mxr[2];	/* max inobt btree records */
  	uint			m_inobt_mnr[2];	/* min inobt btree records */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
154
155
  	uint			m_ag_maxlevels;	/* XFS_AG_MAXLEVELS */
  	uint			m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
0d87e656d   Christoph Hellwig   xfs: remove super...
156
  	uint			m_in_maxlevels;	/* max inobt btree levels. */
1c1c6ebcf   Dave Chinner   xfs: Replace per-...
157
158
  	struct radix_tree_root	m_perag_tree;	/* per-ag accounting info */
  	spinlock_t		m_perag_lock;	/* lock for m_perag_tree */
cc92e7ac8   Christoph Hellwig   [XFS] growlock sh...
159
  	struct mutex		m_growlock;	/* growfs mutex */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
160
161
  	int			m_fixedfsid[2];	/* unchanged for life of FS */
  	uint			m_dmevmask;	/* DMI events for this FS */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
162
  	__uint64_t		m_flags;	/* global mount flags */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
164
165
166
  	uint			m_dir_node_ents; /* #entries in a dir danode */
  	uint			m_attr_node_ents; /* #entries in attr danode */
  	int			m_ialloc_inos;	/* inodes in inode allocation */
  	int			m_ialloc_blks;	/* blocks in inode allocation */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167
168
169
170
171
172
173
  	int			m_inoalign_mask;/* mask sb_inoalignmt if used */
  	uint			m_qflags;	/* quota status flags */
  	xfs_trans_reservations_t m_reservations;/* precomputed res values */
  	__uint64_t		m_maxicount;	/* maximum inode count */
  	__uint64_t		m_maxioffset;	/* maximum inode offset */
  	__uint64_t		m_resblks;	/* total reserved blocks */
  	__uint64_t		m_resblks_avail;/* available reserved blocks */
cbe132a8b   Dave Chinner   xfs: don't hold o...
174
  	__uint64_t		m_resblks_save;	/* reserved blks @ remount,ro */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
175
176
  	int			m_dalign;	/* stripe unit */
  	int			m_swidth;	/* stripe width */
c41564b5a   Nathan Scott   [XFS] We really s...
177
  	int			m_sinoalign;	/* stripe unit inode alignment */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
  	int			m_attr_magicpct;/* 37% of the blocksize */
  	int			m_dir_magicpct;	/* 37% of the dir blocksize */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
180
  	__uint8_t		m_sectbb_log;	/* sectlog - BBSHIFT */
5163f95a0   Barry Naujok   [XFS] Name operat...
181
  	const struct xfs_nameops *m_dirnameops;	/* vector of dir name ops */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
182
183
184
185
186
187
188
189
  	int			m_dirblksize;	/* directory block sz--bytes */
  	int			m_dirblkfsbs;	/* directory block sz--fsbs */
  	xfs_dablk_t		m_dirdatablk;	/* blockno of dir data v2 */
  	xfs_dablk_t		m_dirleafblk;	/* blockno of dir non-data v2 */
  	xfs_dablk_t		m_dirfreeblk;	/* blockno of dirfreeindex v2 */
  	uint			m_chsize;	/* size of next field */
  	struct xfs_chash	*m_chash;	/* fs private inode per-cluster
  						 * hash table */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
190
  	atomic_t		m_active_trans;	/* number trans frozen */
8d280b98c   David Chinner   [XFS] On machines...
191
  #ifdef HAVE_PERCPU_SB
003cb608a   Tejun Heo   percpu: add __per...
192
  	xfs_icsb_cnts_t __percpu *m_sb_cnts;	/* per-cpu superblock counters */
8d280b98c   David Chinner   [XFS] On machines...
193
  	unsigned long		m_icsb_counters; /* disabled per-cpu counters */
e8234a687   David Chinner   [XFS] Add support...
194
  	struct notifier_block	m_icsb_notifier; /* hotplug cpu notifier */
20b642858   David Chinner   [XFS] Reduction g...
195
  	struct mutex		m_icsb_mutex;	/* balancer sync lock */
8d280b98c   David Chinner   [XFS] On machines...
196
  #endif
2a82b8be8   David Chinner   [XFS] Concurrent ...
197
  	struct xfs_mru_cache	*m_filestream;  /* per-mount filestream data */
c6d09b666   Dave Chinner   xfs: introduce a ...
198
  	struct delayed_work	m_sync_work;	/* background sync work */
a7b339f1b   Dave Chinner   xfs: introduce ba...
199
  	struct delayed_work	m_reclaim_work;	/* background inode reclaim */
89e4cb550   Dave Chinner   xfs: convert ENOS...
200
  	struct work_struct	m_flush_work;	/* background inode flush */
7884bc861   Christoph Hellwig   xfs: fix bad_feat...
201
202
  	__int64_t		m_update_flags;	/* sb flags we need to update
  						   on the next remount,rw */
70e60ce71   Dave Chinner   xfs: convert inod...
203
  	struct shrinker		m_inode_shrink;	/* inode reclaim shrinker */
055388a31   Dave Chinner   xfs: dynamic spec...
204
205
  	int64_t			m_low_space[XFS_LOWSP_MAX];
  						/* low free space thresholds */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
206
207
208
209
210
  } xfs_mount_t;
  
  /*
   * Flags for m_flags.
   */
92821e2ba   David Chinner   [XFS] Lazy Superb...
211
  #define XFS_MOUNT_WSYNC		(1ULL << 0)	/* for nfs - all metadata ops
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
212
213
  						   must be synchronous except
  						   for space allocations */
71e330b59   Dave Chinner   xfs: Introduce de...
214
  #define XFS_MOUNT_DELAYLOG	(1ULL << 1)	/* delayed logging is enabled */
92821e2ba   David Chinner   [XFS] Lazy Superb...
215
  #define XFS_MOUNT_WAS_CLEAN	(1ULL << 3)
e718eeb4f   Nathan Scott   [XFS] Rework the ...
216
  #define XFS_MOUNT_FS_SHUTDOWN	(1ULL << 4)	/* atomic stop of all filesystem
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
217
218
  						   operations, typically for
  						   disk errors in metadata */
e84661aa8   Christoph Hellwig   xfs: add online d...
219
  #define XFS_MOUNT_DISCARD	(1ULL << 5)	/* discard unused blocks */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
220
  #define XFS_MOUNT_RETERR	(1ULL << 6)     /* return alignment errors to
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
221
  						   user */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
222
  #define XFS_MOUNT_NOALIGN	(1ULL << 7)	/* turn off stripe alignment
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
223
  						   allocations */
13059ff04   Nathan Scott   [XFS] Reverse the...
224
  #define XFS_MOUNT_ATTR2		(1ULL << 8)	/* allow use of attr2 format */
bd186aa90   Christoph Hellwig   [XFS] kill the vf...
225
  #define XFS_MOUNT_GRPID		(1ULL << 9)	/* group-ID assigned from directory */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
226
  #define XFS_MOUNT_NORECOVERY	(1ULL << 10)	/* no recovery - dirty fs */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
227
  #define XFS_MOUNT_DFLT_IOSIZE	(1ULL << 12)	/* set default i/o size */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
228
  #define XFS_MOUNT_32BITINODES	(1ULL << 14)	/* do not create inodes above
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
229
  						 * 32 bits in size */
bd186aa90   Christoph Hellwig   [XFS] kill the vf...
230
  #define XFS_MOUNT_SMALL_INUMS	(1ULL << 15)	/* users wants 32bit inodes */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
231
232
  #define XFS_MOUNT_NOUUID	(1ULL << 16)	/* ignore uuid during mount */
  #define XFS_MOUNT_BARRIER	(1ULL << 17)
1bd960ee2   Josef Jeff Sipek   [XFS] If you moun...
233
  #define XFS_MOUNT_IKEEP		(1ULL << 18)	/* keep empty inode clusters*/
e718eeb4f   Nathan Scott   [XFS] Rework the ...
234
  #define XFS_MOUNT_SWALLOC	(1ULL << 19)	/* turn on stripe width
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
235
  						 * allocation */
bd186aa90   Christoph Hellwig   [XFS] kill the vf...
236
  #define XFS_MOUNT_RDONLY	(1ULL << 20)	/* read-only fs */
e718eeb4f   Nathan Scott   [XFS] Rework the ...
237
238
  #define XFS_MOUNT_DIRSYNC	(1ULL << 21)	/* synchronous directory ops */
  #define XFS_MOUNT_COMPAT_IOSIZE	(1ULL << 22)	/* don't report large preferred
e8c8b3a79   David Chinner   [XFS] Introduce t...
239
  						 * I/O size in stat() */
2a82b8be8   David Chinner   [XFS] Concurrent ...
240
241
  #define XFS_MOUNT_FILESTREAMS	(1ULL << 24)	/* enable the filestreams
  						   allocator */
7c12f2965   Tim Shimmin   [XFS] Fix up noat...
242
  #define XFS_MOUNT_NOATTR2	(1ULL << 25)	/* disable use of attr2 format */
e8c8b3a79   David Chinner   [XFS] Introduce t...
243

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
244
245
246
247
248
249
250
251
  
  /*
   * Default minimum read and write sizes.
   */
  #define XFS_READIO_LOG_LARGE	16
  #define XFS_WRITEIO_LOG_LARGE	16
  
  /*
1f443ad70   Nathan Scott   [XFS] Allow initi...
252
253
   * Max and min values for mount-option defined I/O
   * preallocation sizes.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
254
   */
1f443ad70   Nathan Scott   [XFS] Allow initi...
255
  #define XFS_MAX_IO_LOG		30	/* 1G */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
256
257
258
259
260
261
  #define XFS_MIN_IO_LOG		PAGE_SHIFT
  
  /*
   * Synchronous read and write sizes.  This should be
   * better for NFSv2 wsync filesystems.
   */
9da096fd1   Malcolm Parsons   xfs: fix various ...
262
263
  #define	XFS_WSYNC_READIO_LOG	15	/* 32k */
  #define	XFS_WSYNC_WRITEIO_LOG	14	/* 16k */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
264

e8c8b3a79   David Chinner   [XFS] Introduce t...
265
266
  /*
   * Allow large block sizes to be reported to userspace programs if the
556b8b166   Barry Naujok   [XFS] remove bhv_...
267
   * "largeio" mount option is used.
e8c8b3a79   David Chinner   [XFS] Introduce t...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
   *
   * If compatibility mode is specified, simply return the basic unit of caching
   * so that we don't get inefficient read/modify/write I/O from user apps.
   * Otherwise....
   *
   * If the underlying volume is a stripe, then return the stripe width in bytes
   * as the recommended I/O size. It is not a stripe and we've set a default
   * buffered I/O size, return that, otherwise return the compat default.
   */
  static inline unsigned long
  xfs_preferred_iosize(xfs_mount_t *mp)
  {
  	if (mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)
  		return PAGE_CACHE_SIZE;
  	return (mp->m_swidth ?
  		(mp->m_swidth << mp->m_sb.sb_blocklog) :
  		((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) ?
  			(1 << (int)MAX(mp->m_readio_log, mp->m_writeio_log)) :
  			PAGE_CACHE_SIZE));
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
288
  #define XFS_MAXIOFFSET(mp)	((mp)->m_maxioffset)
92821e2ba   David Chinner   [XFS] Lazy Superb...
289
290
  #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp)	\
  				((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
291
  #define XFS_FORCED_SHUTDOWN(mp)	((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
745f69191   Christoph Hellwig   [XFS] call common...
292
293
  void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
  		int lnnum);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
294
  #define xfs_force_shutdown(m,f)	\
745f69191   Christoph Hellwig   [XFS] call common...
295
  	xfs_do_force_shutdown(m, f, __FILE__, __LINE__)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
296

2b5decd09   Christoph Hellwig   [XFS] remove xfs_...
297
298
299
300
301
302
303
304
305
  #define SHUTDOWN_META_IO_ERROR	0x0001	/* write attempt to metadata failed */
  #define SHUTDOWN_LOG_IO_ERROR	0x0002	/* write attempt to the log failed */
  #define SHUTDOWN_FORCE_UMOUNT	0x0004	/* shutdown from a forced unmount */
  #define SHUTDOWN_CORRUPT_INCORE	0x0008	/* corrupt in-memory data structures */
  #define SHUTDOWN_REMOTE_REQ	0x0010	/* shutdown came from remote cell */
  #define SHUTDOWN_DEVICE_REQ	0x0020	/* failed all paths to the device */
  
  #define xfs_test_for_freeze(mp)		((mp)->m_super->s_frozen)
  #define xfs_wait_for_freeze(mp,l)	vfs_check_frozen((mp)->m_super, (l))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
306
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
307
308
   * Flags for xfs_mountfs
   */
764d1f89a   Nathan Scott   [XFS] Implement t...
309
  #define XFS_MFSI_QUIET		0x40	/* Be silent if mount errors found */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
310

a844f4510   Nathan Scott   [XFS] Remove xfs_...
311
312
  static inline xfs_agnumber_t
  xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
313
  {
a844f4510   Nathan Scott   [XFS] Remove xfs_...
314
315
316
  	xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
  	do_div(ld, mp->m_sb.sb_agblocks);
  	return (xfs_agnumber_t) ld;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
317
  }
a844f4510   Nathan Scott   [XFS] Remove xfs_...
318
319
  static inline xfs_agblock_t
  xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
320
  {
a844f4510   Nathan Scott   [XFS] Remove xfs_...
321
322
  	xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
  	return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
323
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
324
  /*
aed3bb90a   Dave Chinner   xfs: Reference co...
325
   * perag get/put wrappers for ref counting
da353b0d6   David Chinner   [XFS] Radix tree ...
326
   */
0fa800fbd   Dave Chinner   xfs: Add trace po...
327
  struct xfs_perag *xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno);
65d0f2053   Dave Chinner   xfs: split inode ...
328
329
  struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *mp, xfs_agnumber_t agno,
  					int tag);
0fa800fbd   Dave Chinner   xfs: Add trace po...
330
  void	xfs_perag_put(struct xfs_perag *pag);
da353b0d6   David Chinner   [XFS] Radix tree ...
331
332
  
  /*
03135cf72   David Chinner   [XFS] Fix UP buil...
333
334
335
   * Per-cpu superblock locking functions
   */
  #ifdef HAVE_PERCPU_SB
b8f82a4a6   Christoph Hellwig   xfs: kill the STA...
336
  static inline void
03135cf72   David Chinner   [XFS] Fix UP buil...
337
338
339
340
  xfs_icsb_lock(xfs_mount_t *mp)
  {
  	mutex_lock(&mp->m_icsb_mutex);
  }
b8f82a4a6   Christoph Hellwig   xfs: kill the STA...
341
  static inline void
03135cf72   David Chinner   [XFS] Fix UP buil...
342
343
344
345
346
347
348
349
350
351
  xfs_icsb_unlock(xfs_mount_t *mp)
  {
  	mutex_unlock(&mp->m_icsb_mutex);
  }
  #else
  #define xfs_icsb_lock(mp)
  #define xfs_icsb_unlock(mp)
  #endif
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
352
   * This structure is for use by the xfs_mod_incore_sb_batch() routine.
20f4ebf2b   David Chinner   [XFS] Make growfs...
353
   * xfs_growfs can specify a few fields which are more than int limit
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
354
355
356
   */
  typedef struct xfs_mod_sb {
  	xfs_sb_field_t	msb_field;	/* Field to modify, see below */
20f4ebf2b   David Chinner   [XFS] Make growfs...
357
  	int64_t		msb_delta;	/* Change to make to specified field */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
358
  } xfs_mod_sb_t;
adab0f67d   Chandra Seetharaman   xfs: Remove the s...
359
  extern int	xfs_log_sbcount(xfs_mount_t *);
d5db0f97f   Eric Sandeen   xfs: more reserve...
360
  extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
4249023a5   Christoph Hellwig   [XFS] cleanup xfs...
361
  extern int	xfs_mountfs(xfs_mount_t *mp);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
362

41b5c2e77   Christoph Hellwig   [XFS] xfs_unmount...
363
  extern void	xfs_unmountfs(xfs_mount_t *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
364
  extern int	xfs_unmountfs_writesb(xfs_mount_t *);
20f4ebf2b   David Chinner   [XFS] Make growfs...
365
  extern int	xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
366
367
  extern int	xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *,
  			uint, int);
7884bc861   Christoph Hellwig   xfs: fix bad_feat...
368
  extern int	xfs_mount_log_sb(xfs_mount_t *, __int64_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
369
  extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
764d1f89a   Nathan Scott   [XFS] Implement t...
370
  extern int	xfs_readsb(xfs_mount_t *, int);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
371
  extern void	xfs_freesb(xfs_mount_t *);
92821e2ba   David Chinner   [XFS] Lazy Superb...
372
  extern int	xfs_fs_writable(xfs_mount_t *);
4cc929ee3   Nathan Scott   [XFS] Don't grow ...
373
  extern int	xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
374

d7658d487   Christoph Hellwig   xfs: kill xfs_lrw.h
375
  extern int	xfs_dev_is_read_only(struct xfs_mount *, char *);
055388a31   Dave Chinner   xfs: dynamic spec...
376
  extern void	xfs_set_low_space_thresholds(struct xfs_mount *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
377
  #endif	/* __KERNEL__ */
847fff5ca   Barry Naujok   [XFS] Sync up ker...
378
  extern void	xfs_mod_sb(struct xfs_trans *, __int64_t);
1c1c6ebcf   Dave Chinner   xfs: Replace per-...
379
380
  extern int	xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t,
  					xfs_agnumber_t *);
847fff5ca   Barry Naujok   [XFS] Sync up ker...
381
382
  extern void	xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
  extern void	xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
383
  #endif	/* __XFS_MOUNT_H__ */