]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xfs_mount.h
Remove do_error after libxfs_device_zero, this is left
[thirdparty/xfsprogs-dev.git] / include / xfs_mount.h
CommitLineData
2bd0ea18 1/*
0d3e0b37 2 * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
5000d01d 3 *
2bd0ea18
NS
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
5000d01d 7 *
2bd0ea18
NS
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5000d01d 11 *
2bd0ea18
NS
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
5000d01d 14 * or the like. Any license provided herein, whether implied or
2bd0ea18
NS
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
5000d01d 18 *
2bd0ea18
NS
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
5000d01d 22 *
2bd0ea18
NS
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
5000d01d
SL
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
2bd0ea18
NS
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32#ifndef __XFS_MOUNT_H__
5000d01d 33#define __XFS_MOUNT_H__
2bd0ea18
NS
34
35
36typedef struct xfs_trans_reservations {
37 uint tr_write; /* extent alloc trans */
38 uint tr_itruncate; /* truncate trans */
39 uint tr_rename; /* rename trans */
40 uint tr_link; /* link trans */
41 uint tr_remove; /* unlink trans */
42 uint tr_symlink; /* symlink trans */
43 uint tr_create; /* create trans */
44 uint tr_mkdir; /* mkdir trans */
45 uint tr_ifree; /* inode free trans */
46 uint tr_ichange; /* inode update trans */
47 uint tr_growdata; /* fs data section grow trans */
48 uint tr_swrite; /* sync write inode trans */
49 uint tr_addafork; /* cvt inode to attributed trans */
50 uint tr_writeid; /* write setuid/setgid file */
51 uint tr_attrinval; /* attr fork buffer invalidation */
52 uint tr_attrset; /* set/create an attribute */
53 uint tr_attrrm; /* remove an attribute */
54 uint tr_clearagi; /* clear bad agi unlinked ino bucket */
5000d01d 55 uint tr_growrtalloc; /* grow realtime allocations */
2bd0ea18
NS
56 uint tr_growrtzero; /* grow realtime zeroing */
57 uint tr_growrtfree; /* grow realtime freeing */
58} xfs_trans_reservations_t;
59
60
61#ifndef __KERNEL__
62/*
63 * Moved here from xfs_ag.h to avoid reordering header files
64 */
65#define XFS_DADDR_TO_AGNO(mp,d) \
66 ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
67#define XFS_DADDR_TO_AGBNO(mp,d) \
68 ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
69#else
70struct cred;
2bd0ea18
NS
71struct vfs;
72struct vnode;
4542f191 73struct xfs_mount_args;
2bd0ea18
NS
74struct xfs_ihash;
75struct xfs_chash;
76struct xfs_inode;
77struct xfs_perag;
78struct xfs_quotainfo;
79struct xfs_iocore;
2bd0ea18
NS
80struct xfs_bmbt_irec;
81struct xfs_bmap_free;
82
5000d01d
SL
83#define SPLDECL(s) unsigned long s
84#define AIL_LOCK_T lock_t
85#define AIL_LOCKINIT(x,y) spinlock_init(x,y)
86#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
87#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock)
88#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s)
2bd0ea18 89
f9e56f43
NS
90/*
91 * Prototypes and functions for I/O core modularization.
2bd0ea18 92 */
f9e56f43
NS
93
94struct flid;
95struct buf;
2bd0ea18 96
f9e56f43
NS
97typedef int (*xfs_ioinit_t)(struct vfs *,
98 struct xfs_mount_args *, int *);
2bd0ea18
NS
99typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *,
100 xfs_fileoff_t, xfs_filblks_t, int,
101 xfs_fsblock_t *, xfs_extlen_t,
102 struct xfs_bmbt_irec *, int *,
103 struct xfs_bmap_free *);
104typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *);
f9e56f43
NS
105typedef int (*xfs_iomap_write_direct_t)(
106 void *, loff_t, size_t, int,
107 struct xfs_bmbt_irec *, int *, int);
108typedef int (*xfs_iomap_write_delay_t)(
109 void *, loff_t, size_t, int,
110 struct xfs_bmbt_irec *, int *);
111typedef int (*xfs_iomap_write_allocate_t)(
112 void *, struct xfs_bmbt_irec *, int *);
113typedef int (*xfs_iomap_write_unwritten_t)(
114 void *, loff_t, size_t);
115typedef uint (*xfs_lck_map_shared_t)(void *);
2bd0ea18
NS
116typedef void (*xfs_lock_t)(void *, uint);
117typedef void (*xfs_lock_demote_t)(void *, uint);
118typedef int (*xfs_lock_nowait_t)(void *, uint);
119typedef void (*xfs_unlk_t)(void *, unsigned int);
2bd0ea18 120typedef xfs_fsize_t (*xfs_size_t)(void *);
f9e56f43 121typedef xfs_fsize_t (*xfs_iodone_t)(struct vfs *);
2bd0ea18 122
2bd0ea18 123typedef struct xfs_ioops {
f9e56f43
NS
124 xfs_ioinit_t xfs_ioinit;
125 xfs_bmapi_t xfs_bmapi_func;
126 xfs_bmap_eof_t xfs_bmap_eof_func;
127 xfs_iomap_write_direct_t xfs_iomap_write_direct;
128 xfs_iomap_write_delay_t xfs_iomap_write_delay;
129 xfs_iomap_write_allocate_t xfs_iomap_write_allocate;
130 xfs_iomap_write_unwritten_t xfs_iomap_write_unwritten;
131 xfs_lock_t xfs_ilock;
132 xfs_lck_map_shared_t xfs_lck_map_shared;
133 xfs_lock_demote_t xfs_ilock_demote;
134 xfs_lock_nowait_t xfs_ilock_nowait;
135 xfs_unlk_t xfs_unlock;
136 xfs_size_t xfs_size_func;
137 xfs_iodone_t xfs_iodone;
2bd0ea18
NS
138} xfs_ioops_t;
139
140
f9e56f43
NS
141#define XFS_IOINIT(vfsp, args, flags) \
142 (*(mp)->m_io_ops.xfs_ioinit)(vfsp, args, flags)
143
2bd0ea18
NS
144#define XFS_BMAPI(mp, trans,io,bno,len,f,first,tot,mval,nmap,flist) \
145 (*(mp)->m_io_ops.xfs_bmapi_func) \
146 (trans,(io)->io_obj,bno,len,f,first,tot,mval,nmap,flist)
147
148#define XFS_BMAP_EOF(mp, io, endoff, whichfork, eof) \
149 (*(mp)->m_io_ops.xfs_bmap_eof_func) \
150 ((io)->io_obj, endoff, whichfork, eof)
151
f9e56f43
NS
152#define XFS_IOMAP_WRITE_DIRECT(mp, io, offset, count, flags, mval, nmap, found)\
153 (*(mp)->m_io_ops.xfs_iomap_write_direct) \
154 ((io)->io_obj, offset, count, flags, mval, nmap, found)
155
156#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \
157 (*(mp)->m_io_ops.xfs_iomap_write_delay) \
158 ((io)->io_obj, offset, count, flags, mval, nmap)
159
160#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, mval, nmap) \
161 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \
162 ((io)->io_obj, mval, nmap)
163
164#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \
165 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \
166 ((io)->io_obj, offset, count)
167
168#define XFS_LCK_MAP_SHARED(mp, io) \
169 (*(mp)->m_io_ops.xfs_lck_map_shared)((io)->io_obj)
170
2bd0ea18
NS
171#define XFS_ILOCK(mp, io, mode) \
172 (*(mp)->m_io_ops.xfs_ilock)((io)->io_obj, mode)
173
f9e56f43
NS
174#define XFS_ILOCK_NOWAIT(mp, io, mode) \
175 (*(mp)->m_io_ops.xfs_ilock_nowait)((io)->io_obj, mode)
176
2bd0ea18
NS
177#define XFS_IUNLOCK(mp, io, mode) \
178 (*(mp)->m_io_ops.xfs_unlock)((io)->io_obj, mode)
179
180#define XFS_ILOCK_DEMOTE(mp, io, mode) \
181 (*(mp)->m_io_ops.xfs_ilock_demote)((io)->io_obj, mode)
182
2bd0ea18
NS
183#define XFS_SIZE(mp, io) \
184 (*(mp)->m_io_ops.xfs_size_func)((io)->io_obj)
185
f9e56f43
NS
186#define XFS_IODONE(vfsp) \
187 (*(mp)->m_io_ops.xfs_iodone)(vfsp)
188
189
190/*
191 * Prototypes and functions for the XFS realtime subsystem.
192 */
2bd0ea18
NS
193
194
195typedef struct xfs_mount {
196 bhv_desc_t m_bhv; /* vfs xfs behavior */
197 xfs_tid_t m_tid; /* next unused tid for fs */
198 AIL_LOCK_T m_ail_lock; /* fs AIL mutex */
199 xfs_ail_entry_t m_ail; /* fs active log item list */
200 uint m_ail_gen; /* fs AIL generation count */
201 xfs_sb_t m_sb; /* copy of fs superblock */
202 lock_t m_sb_lock; /* sb counter mutex */
203 struct xfs_buf *m_sb_bp; /* buffer for superblock */
5000d01d 204 char *m_fsname; /* filesystem name */
2bd0ea18
NS
205 int m_fsname_len; /* strlen of fs name */
206 int m_bsize; /* fs logical block size */
207 xfs_agnumber_t m_agfrotor; /* last ag where space found */
208 xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */
6d1d29a7 209 xfs_agnumber_t m_maxagi; /* highest inode alloc group */
2bd0ea18
NS
210 int m_ihsize; /* size of next field */
211 struct xfs_ihash *m_ihash; /* fs private inode hash table*/
212 struct xfs_inode *m_inodes; /* active inode list */
213 mutex_t m_ilock; /* inode list mutex */
214 uint m_ireclaims; /* count of calls to reclaim*/
215 uint m_readio_log; /* min read size log bytes */
216 uint m_readio_blocks; /* min read size blocks */
217 uint m_writeio_log; /* min write size log bytes */
218 uint m_writeio_blocks; /* min write size blocks */
219 void *m_log; /* log specific stuff */
220 int m_logbufs; /* number of log buffers */
221 int m_logbsize; /* size of each log buffer */
222 uint m_rsumlevels; /* rt summary levels */
223 uint m_rsumsize; /* size of rt summary, bytes */
224 struct xfs_inode *m_rbmip; /* pointer to bitmap inode */
225 struct xfs_inode *m_rsumip; /* pointer to summary inode */
226 struct xfs_inode *m_rootip; /* pointer to root directory */
227 struct xfs_quotainfo *m_quotainfo; /* disk quota information */
b391b7cd
NS
228 xfs_buftarg_t *m_ddev_targp; /* saves taking the address */
229 xfs_buftarg_t *m_logdev_targp;/* ptr to log device */
230 xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */
231#define m_dev m_ddev_targp->pbr_dev
5000d01d 232 __uint8_t m_dircook_elog; /* log d-cookie entry bits */
2bd0ea18
NS
233 __uint8_t m_blkbit_log; /* blocklog + NBBY */
234 __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
235 __uint8_t m_agno_log; /* log #ag's */
236 __uint8_t m_agino_log; /* #bits for agino in inum */
237 __uint8_t m_nreadaheads; /* #readahead buffers */
238 __uint16_t m_inode_cluster_size;/* min inode buf size */
239 uint m_blockmask; /* sb_blocksize-1 */
240 uint m_blockwsize; /* sb_blocksize in words */
241 uint m_blockwmask; /* blockwsize-1 */
5000d01d
SL
242 uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
243 uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
244 uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
245 uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
246 uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
247 uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
248 uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
2bd0ea18 249 uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
5000d01d 250 uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
2bd0ea18 251 struct xfs_perag *m_perag; /* per-ag accounting info */
e56fcdce 252 struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
2bd0ea18 253 sema_t m_growlock; /* growfs mutex */
5000d01d 254 int m_fixedfsid[2]; /* unchanged for life of FS */
2bd0ea18
NS
255 uint m_dmevmask; /* DMI events for this FS */
256 uint m_flags; /* global mount flags */
257 uint m_attroffset; /* inode attribute offset */
6bef826c
NS
258 uint m_dir_node_ents; /* #entries in a dir danode */
259 uint m_attr_node_ents; /* #entries in attr danode */
2bd0ea18
NS
260 int m_ialloc_inos; /* inodes in inode allocation */
261 int m_ialloc_blks; /* blocks in inode allocation */
262 int m_litino; /* size of inode union area */
263 int m_inoalign_mask;/* mask sb_inoalignmt if used */
264 uint m_qflags; /* quota status flags */
265 xfs_trans_reservations_t m_reservations;/* precomputed res values */
266 __uint64_t m_maxicount; /* maximum inode count */
267 __uint64_t m_resblks; /* total reserved blocks */
268 __uint64_t m_resblks_avail;/* available reserved blocks */
269#if XFS_BIG_FILESYSTEMS
270 xfs_ino_t m_inoadd; /* add value for ino64_offset */
271#endif
272 int m_dalign; /* stripe unit */
273 int m_swidth; /* stripe width */
73bf5988 274 int m_lstripemask; /* log stripe mask */
2bd0ea18
NS
275 int m_sinoalign; /* stripe unit inode alignmnt */
276 int m_attr_magicpct;/* 37% of the blocksize */
5000d01d 277 int m_dir_magicpct; /* 37% of the dir blocksize */
2bd0ea18 278 __uint8_t m_mk_sharedro; /* mark shared ro on unmount */
5000d01d
SL
279 __uint8_t m_inode_quiesce;/* call quiesce on new inodes.
280 field governed by m_ilock */
9440d84d 281 __uint8_t m_sectbb_log; /* sectlog - BBSHIFT */
2bd0ea18
NS
282 __uint8_t m_dirversion; /* 1 or 2 */
283 xfs_dirops_t m_dirops; /* table of dir funcs */
284 int m_dirblksize; /* directory block sz--bytes */
285 int m_dirblkfsbs; /* directory block sz--fsbs */
286 xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */
287 xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */
288 xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */
289 int m_chsize; /* size of next field */
290 struct xfs_chash *m_chash; /* fs private inode per-cluster
291 * hash table */
292 struct xfs_ioops m_io_ops; /* vector of I/O ops */
5000d01d
SL
293 struct xfs_expinfo *m_expinfo; /* info to export to other
294 cells. */
2bd0ea18
NS
295 uint64_t m_shadow_pinmask;
296 /* which bits matter in rpc
297 log item pin masks */
298 uint m_cxfstype; /* mounted shared, etc. */
0ddd9902
NS
299 lock_t m_freeze_lock; /* Lock for m_frozen */
300 uint m_frozen; /* FS frozen for shutdown or
301 * snapshot */
302 sv_t m_wait_unfreeze;/* waiting to unfreeze */
5000d01d 303 atomic_t m_active_trans; /* number trans frozen */
933d7884
ES
304 struct timer_list m_sbdirty_timer;/* superblock dirty timer
305 * for nfs refcache */
2bd0ea18
NS
306} xfs_mount_t;
307
308/*
309 * Flags for m_flags.
310 */
5000d01d 311#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops
2bd0ea18
NS
312 must be synchronous except
313 for space allocations */
314#if XFS_BIG_FILESYSTEMS
5000d01d 315#define XFS_MOUNT_INO64 0x00000002
2bd0ea18 316#endif
f9e56f43 317 /* 0x00000004 -- currently unused */
2bd0ea18
NS
318 /* 0x00000008 -- currently unused */
319#define XFS_MOUNT_FS_SHUTDOWN 0x00000010 /* atomic stop of all filesystem
320 operations, typically for
321 disk errors in metadata */
322#define XFS_MOUNT_NOATIME 0x00000020 /* don't modify inode access
323 times on reads */
5000d01d
SL
324#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to
325 user */
326#define XFS_MOUNT_NOALIGN 0x00000080 /* turn off stripe alignment
2bd0ea18 327 allocations */
5000d01d
SL
328 /* 0x00000100 -- currently unused */
329#define XFS_MOUNT_REGISTERED 0x00000200 /* registered with cxfs master
330 cell logic */
331#define XFS_MOUNT_NORECOVERY 0x00000400 /* no recovery - dirty fs */
332#define XFS_MOUNT_SHARED 0x00000800 /* shared mount */
333#define XFS_MOUNT_DFLT_IOSIZE 0x00001000 /* set default i/o size */
334#define XFS_MOUNT_OSYNCISOSYNC 0x00002000 /* o_sync is REALLY o_sync */
5ffc734a 335 /* osyncisdsync is now default*/
fc8202ba 336#define XFS_MOUNT_NOUUID 0x00004000 /* ignore uuid during mount */
6d1d29a7
NS
337#define XFS_MOUNT_32BITINODES 0x00008000 /* do not create inodes above
338 * 32 bits in size */
32181a02 339#define XFS_MOUNT_NOLOGFLUSH 0x00010000
2bd0ea18
NS
340
341/*
342 * Flags for m_cxfstype
343 */
344#define XFS_CXFS_NOT 0x00000001 /* local mount */
345#define XFS_CXFS_SERVER 0x00000002 /* we're the CXFS server */
346#define XFS_CXFS_CLIENT 0x00000004 /* We're a CXFS client */
347#define XFS_CXFS_REC_ENABLED 0x00000008 /* recovery is enabled */
348
5000d01d 349#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
2bd0ea18
NS
350
351/*
352 * Default minimum read and write sizes.
353 */
f9e56f43
NS
354#define XFS_READIO_LOG_LARGE 16
355#define XFS_WRITEIO_LOG_LARGE 16
2e72c460
ES
356/*
357 * Default allocation size
358 */
359#define XFS_WRITE_IO_LOG 16
2bd0ea18
NS
360
361/*
13f0b353 362 * Max and min values for UIO and mount-option defined I/O sizes;
5000d01d 363 * min value can't be less than a page. Currently unused.
2bd0ea18
NS
364 */
365#define XFS_MAX_IO_LOG 16 /* 64K */
13f0b353 366#define XFS_MIN_IO_LOG PAGE_SHIFT
2bd0ea18
NS
367
368/*
369 * Synchronous read and write sizes. This should be
370 * better for NFSv2 wsync filesystems.
371 */
5000d01d
SL
372#define XFS_WSYNC_READIO_LOG 15 /* 32K */
373#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */
2bd0ea18 374
4542f191 375#define xfs_force_shutdown(m,f) VFS_FORCE_SHUTDOWN(XFS_MTOVFS(m),f)
5000d01d 376/*
2bd0ea18
NS
377 * Flags sent to xfs_force_shutdown.
378 */
379#define XFS_METADATA_IO_ERROR 0x1
380#define XFS_LOG_IO_ERROR 0x2
381#define XFS_FORCE_UMOUNT 0x4
382#define XFS_CORRUPT_INCORE 0x8 /* corrupt in-memory data structures */
4542f191 383#define XFS_SHUTDOWN_REMOTE_REQ 0x10 /* shutdown came from remote cell */
2bd0ea18
NS
384
385/*
386 * xflags for xfs_syncsub
387 */
388#define XFS_XSYNC_RELOC 0x01
389
390/*
391 * Flags for xfs_mountfs
392 */
5000d01d 393#define XFS_MFSI_SECOND 0x01 /* Is a cxfs secondary mount -- skip */
2bd0ea18
NS
394 /* stuff which should only be done */
395 /* once. */
5000d01d 396#define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */
2bd0ea18
NS
397#define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */
398 /* log recovery */
399
400/*
401 * Macros for getting from mount to vfs and back.
402 */
403#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS)
404struct vfs *xfs_mtovfs(xfs_mount_t *mp);
5000d01d 405#define XFS_MTOVFS(mp) xfs_mtovfs(mp)
2bd0ea18 406#else
5000d01d 407#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv))
2bd0ea18
NS
408#endif
409#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM)
410xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp);
5000d01d 411#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
2bd0ea18 412#else
5000d01d 413#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp))
2bd0ea18 414#endif
5000d01d 415
2bd0ea18
NS
416
417/*
418 * Moved here from xfs_ag.h to avoid reordering header files
419 */
420
421#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO)
422xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d);
5000d01d 423#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
2bd0ea18
NS
424#else
425
426static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d)
427{
5000d01d
SL
428 d = XFS_BB_TO_FSBT(mp, d);
429 do_div(d, mp->m_sb.sb_agblocks);
430 return (xfs_agnumber_t) d;
2bd0ea18
NS
431}
432
433#endif
434#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO)
435xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d);
5000d01d 436#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
2bd0ea18
NS
437#else
438
439static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d)
440{
5000d01d
SL
441 d = XFS_BB_TO_FSBT(mp, d);
442 return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks);
2bd0ea18
NS
443}
444
445#endif
446
447/*
448 * This structure is for use by the xfs_mod_incore_sb_batch() routine.
449 */
450typedef struct xfs_mod_sb {
451 xfs_sb_field_t msb_field; /* Field to modify, see below */
452 int msb_delta; /* change to make to the specified field */
453} xfs_mod_sb_t;
454
5000d01d
SL
455#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD)
456#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock))
457#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock)
458#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s))
2bd0ea18
NS
459
460void xfs_mod_sb(xfs_trans_t *, __int64_t);
461xfs_mount_t *xfs_mount_init(void);
462void xfs_mount_free(xfs_mount_t *mp, int remove_bhv);
4542f191 463int xfs_mountfs(struct vfs *, xfs_mount_t *mp, dev_t, int);
2bd0ea18 464
4542f191
NS
465int xfs_unmountfs(xfs_mount_t *, struct cred *);
466void xfs_unmountfs_close(xfs_mount_t *, struct cred *);
5000d01d
SL
467int xfs_unmountfs_writesb(xfs_mount_t *);
468int xfs_unmount_flush(xfs_mount_t *, int);
2bd0ea18
NS
469int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int, int);
470int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, uint, int);
f9e56f43 471int xfs_readsb(xfs_mount_t *mp);
2bd0ea18 472struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
5000d01d 473void xfs_freesb(xfs_mount_t *);
4542f191 474void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int);
2bd0ea18 475int xfs_syncsub(xfs_mount_t *, int, int, int *);
6d1d29a7 476void xfs_initialize_perag(xfs_mount_t *, int);
2bd0ea18 477void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, __int64_t);
d9eab45c 478
0ddd9902
NS
479/*
480 * Flags for freeze operations.
481 */
d9eab45c
SL
482#define XFS_FREEZE_WRITE 1
483#define XFS_FREEZE_TRANS 2
484
485void xfs_start_freeze(xfs_mount_t *, int);
486void xfs_finish_freeze(xfs_mount_t *);
5000d01d 487void xfs_check_frozen(xfs_mount_t *, bhv_desc_t *, int);
d9eab45c 488
2bd0ea18
NS
489extern struct vfsops xfs_vfsops;
490
491#endif /* __KERNEL__ */
492
493#endif /* __XFS_MOUNT_H__ */