]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xfs_mount.h
make xfs_info/growfs report v2 log data
[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;
73struct xfs_args;
74struct xfs_ihash;
75struct xfs_chash;
76struct xfs_inode;
77struct xfs_perag;
78struct xfs_quotainfo;
79struct xfs_iocore;
80struct xfs_dio;
81struct xfs_bmbt_irec;
82struct xfs_bmap_free;
83
5000d01d
SL
84#define SPLDECL(s) unsigned long s
85#define AIL_LOCK_T lock_t
86#define AIL_LOCKINIT(x,y) spinlock_init(x,y)
87#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
88#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock)
89#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s)
2bd0ea18
NS
90
91
92/* Prototypes and functions for I/O core modularization, a vector
93 * of functions is used to indirect from xfs/cxfs independent code
94 * to the xfs/cxfs dependent code.
95 * The vector is placed in the mount structure so that we can
96 * minimize the number of memory indirections involved.
97 */
98
99typedef int (*xfs_dio_write_t)(struct xfs_dio *);
100typedef int (*xfs_dio_read_t)(struct xfs_dio *);
101typedef int (*xfs_strat_write_t)(struct xfs_iocore *, struct xfs_buf *);
102typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *,
103 xfs_fileoff_t, xfs_filblks_t, int,
104 xfs_fsblock_t *, xfs_extlen_t,
105 struct xfs_bmbt_irec *, int *,
106 struct xfs_bmap_free *);
107typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *);
108typedef int (*xfs_rsync_t)(void *, int, xfs_off_t, xfs_off_t);
109typedef uint (*xfs_lck_map_shared_t)(void *);
110typedef void (*xfs_lock_t)(void *, uint);
111typedef void (*xfs_lock_demote_t)(void *, uint);
112typedef int (*xfs_lock_nowait_t)(void *, uint);
113typedef void (*xfs_unlk_t)(void *, unsigned int);
114typedef void (*xfs_chgtime_t)(void *, int);
115typedef xfs_fsize_t (*xfs_size_t)(void *);
116typedef xfs_fsize_t (*xfs_setsize_t)(void *, xfs_off_t);
117typedef xfs_fsize_t (*xfs_lastbyte_t)(void *);
118
2bd0ea18
NS
119typedef struct xfs_ioops {
120 xfs_dio_write_t xfs_dio_write_func;
121 xfs_dio_read_t xfs_dio_read_func;
122 xfs_strat_write_t xfs_strat_write_func;
123 xfs_bmapi_t xfs_bmapi_func;
124 xfs_bmap_eof_t xfs_bmap_eof_func;
125 xfs_rsync_t xfs_rsync_func;
126 xfs_lck_map_shared_t xfs_lck_map_shared;
127 xfs_lock_t xfs_ilock;
128 xfs_lock_demote_t xfs_ilock_demote;
129 xfs_lock_nowait_t xfs_ilock_nowait;
130 xfs_unlk_t xfs_unlock;
5000d01d 131 xfs_chgtime_t xfs_chgtime;
2bd0ea18
NS
132 xfs_size_t xfs_size_func;
133 xfs_setsize_t xfs_setsize_func;
134 xfs_lastbyte_t xfs_lastbyte;
2bd0ea18
NS
135} xfs_ioops_t;
136
137
138#define XFS_DIO_WRITE(mp, diop) \
139 (*(mp)->m_io_ops.xfs_dio_write_func)(diop)
140
141#define XFS_DIO_READ(mp, diop) \
142 (*(mp)->m_io_ops.xfs_dio_read_func)(diop)
143
144#define XFS_STRAT_WRITE(mp, io, bp) \
145 (*(mp)->m_io_ops.xfs_strat_write_func)(io, bp)
146
147#define XFS_BMAPI(mp, trans,io,bno,len,f,first,tot,mval,nmap,flist) \
148 (*(mp)->m_io_ops.xfs_bmapi_func) \
149 (trans,(io)->io_obj,bno,len,f,first,tot,mval,nmap,flist)
150
151#define XFS_BMAP_EOF(mp, io, endoff, whichfork, eof) \
152 (*(mp)->m_io_ops.xfs_bmap_eof_func) \
153 ((io)->io_obj, endoff, whichfork, eof)
154
155#define XFS_RSYNC(mp, io, ioflag, start, end) \
156 (*(mp)->m_io_ops.xfs_rsync_func)((io)->io_obj, ioflag, start, end)
157
158#define XFS_LCK_MAP_SHARED(mp, io) \
159 (*(mp)->m_io_ops.xfs_lck_map_shared)((io)->io_obj)
160
161#define XFS_UNLK_MAP_SHARED(mp, io, mode) \
162 (*(mp)->m_io_ops.xfs_unlock)((io)->io_obj, mode)
163
164#define XFS_ILOCK(mp, io, mode) \
165 (*(mp)->m_io_ops.xfs_ilock)((io)->io_obj, mode)
166
167#define XFS_ILOCK_NOWAIT(mp, io, mode) \
168 (*(mp)->m_io_ops.xfs_ilock_nowait)((io)->io_obj, mode)
169
170#define XFS_IUNLOCK(mp, io, mode) \
171 (*(mp)->m_io_ops.xfs_unlock)((io)->io_obj, mode)
172
173#define XFS_ILOCK_DEMOTE(mp, io, mode) \
174 (*(mp)->m_io_ops.xfs_ilock_demote)((io)->io_obj, mode)
175
176#define XFS_CHGTIME(mp, io, flags) \
177 (*(mp)->m_io_ops.xfs_chgtime)((io)->io_obj, flags)
178
179#define XFS_SIZE(mp, io) \
180 (*(mp)->m_io_ops.xfs_size_func)((io)->io_obj)
181
182#define XFS_SETSIZE(mp, io, newsize) \
183 (*(mp)->m_io_ops.xfs_setsize_func)((io)->io_obj, newsize)
184
185#define XFS_LASTBYTE(mp, io) \
186 (*(mp)->m_io_ops.xfs_lastbyte)((io)->io_obj)
187
188
189typedef struct xfs_mount {
190 bhv_desc_t m_bhv; /* vfs xfs behavior */
191 xfs_tid_t m_tid; /* next unused tid for fs */
192 AIL_LOCK_T m_ail_lock; /* fs AIL mutex */
193 xfs_ail_entry_t m_ail; /* fs active log item list */
194 uint m_ail_gen; /* fs AIL generation count */
195 xfs_sb_t m_sb; /* copy of fs superblock */
196 lock_t m_sb_lock; /* sb counter mutex */
197 struct xfs_buf *m_sb_bp; /* buffer for superblock */
5000d01d 198 char *m_fsname; /* filesystem name */
2bd0ea18
NS
199 int m_fsname_len; /* strlen of fs name */
200 int m_bsize; /* fs logical block size */
201 xfs_agnumber_t m_agfrotor; /* last ag where space found */
202 xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */
6d1d29a7 203 xfs_agnumber_t m_maxagi; /* highest inode alloc group */
2bd0ea18
NS
204 int m_ihsize; /* size of next field */
205 struct xfs_ihash *m_ihash; /* fs private inode hash table*/
206 struct xfs_inode *m_inodes; /* active inode list */
207 mutex_t m_ilock; /* inode list mutex */
208 uint m_ireclaims; /* count of calls to reclaim*/
209 uint m_readio_log; /* min read size log bytes */
210 uint m_readio_blocks; /* min read size blocks */
211 uint m_writeio_log; /* min write size log bytes */
212 uint m_writeio_blocks; /* min write size blocks */
213 void *m_log; /* log specific stuff */
214 int m_logbufs; /* number of log buffers */
215 int m_logbsize; /* size of each log buffer */
216 uint m_rsumlevels; /* rt summary levels */
217 uint m_rsumsize; /* size of rt summary, bytes */
218 struct xfs_inode *m_rbmip; /* pointer to bitmap inode */
219 struct xfs_inode *m_rsumip; /* pointer to summary inode */
220 struct xfs_inode *m_rootip; /* pointer to root directory */
221 struct xfs_quotainfo *m_quotainfo; /* disk quota information */
222 buftarg_t m_ddev_targ; /* ptr to data device */
223 buftarg_t m_logdev_targ; /* ptr to log device */
224 buftarg_t m_rtdev_targ; /* ptr to rt device */
225 buftarg_t *m_ddev_targp; /* saves taking the address */
6d1d29a7 226#define m_rtdev_targp(m)(&(m)->m_rtdev_targ)
2bd0ea18
NS
227#define m_dev m_ddev_targ.dev
228#define m_logdev m_logdev_targ.dev
229#define m_rtdev m_rtdev_targ.dev
5000d01d 230 __uint8_t m_dircook_elog; /* log d-cookie entry bits */
2bd0ea18
NS
231 __uint8_t m_blkbit_log; /* blocklog + NBBY */
232 __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
233 __uint8_t m_agno_log; /* log #ag's */
234 __uint8_t m_agino_log; /* #bits for agino in inum */
235 __uint8_t m_nreadaheads; /* #readahead buffers */
236 __uint16_t m_inode_cluster_size;/* min inode buf size */
237 uint m_blockmask; /* sb_blocksize-1 */
238 uint m_blockwsize; /* sb_blocksize in words */
239 uint m_blockwmask; /* blockwsize-1 */
5000d01d
SL
240 uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
241 uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
242 uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
243 uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
244 uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
245 uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
246 uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
2bd0ea18 247 uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
5000d01d 248 uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
2bd0ea18 249 struct xfs_perag *m_perag; /* per-ag accounting info */
e56fcdce 250 struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
2bd0ea18 251 sema_t m_growlock; /* growfs mutex */
5000d01d 252 int m_fixedfsid[2]; /* unchanged for life of FS */
2bd0ea18
NS
253 uint m_dmevmask; /* DMI events for this FS */
254 uint m_flags; /* global mount flags */
255 uint m_attroffset; /* inode attribute offset */
5000d01d 256 int m_da_node_ents; /* how many entries in danode */
2bd0ea18
NS
257 int m_ialloc_inos; /* inodes in inode allocation */
258 int m_ialloc_blks; /* blocks in inode allocation */
259 int m_litino; /* size of inode union area */
260 int m_inoalign_mask;/* mask sb_inoalignmt if used */
261 uint m_qflags; /* quota status flags */
262 xfs_trans_reservations_t m_reservations;/* precomputed res values */
263 __uint64_t m_maxicount; /* maximum inode count */
264 __uint64_t m_resblks; /* total reserved blocks */
265 __uint64_t m_resblks_avail;/* available reserved blocks */
266#if XFS_BIG_FILESYSTEMS
267 xfs_ino_t m_inoadd; /* add value for ino64_offset */
268#endif
269 int m_dalign; /* stripe unit */
270 int m_swidth; /* stripe width */
73bf5988 271 int m_lstripemask; /* log stripe mask */
2bd0ea18
NS
272 int m_sinoalign; /* stripe unit inode alignmnt */
273 int m_attr_magicpct;/* 37% of the blocksize */
5000d01d 274 int m_dir_magicpct; /* 37% of the dir blocksize */
2bd0ea18 275 __uint8_t m_mk_sharedro; /* mark shared ro on unmount */
5000d01d
SL
276 __uint8_t m_inode_quiesce;/* call quiesce on new inodes.
277 field governed by m_ilock */
2bd0ea18
NS
278 __uint8_t m_dirversion; /* 1 or 2 */
279 xfs_dirops_t m_dirops; /* table of dir funcs */
280 int m_dirblksize; /* directory block sz--bytes */
281 int m_dirblkfsbs; /* directory block sz--fsbs */
282 xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */
283 xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */
284 xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */
285 int m_chsize; /* size of next field */
286 struct xfs_chash *m_chash; /* fs private inode per-cluster
287 * hash table */
288 struct xfs_ioops m_io_ops; /* vector of I/O ops */
5000d01d
SL
289 struct xfs_expinfo *m_expinfo; /* info to export to other
290 cells. */
2bd0ea18
NS
291 uint64_t m_shadow_pinmask;
292 /* which bits matter in rpc
293 log item pin masks */
294 uint m_cxfstype; /* mounted shared, etc. */
0ddd9902
NS
295 lock_t m_freeze_lock; /* Lock for m_frozen */
296 uint m_frozen; /* FS frozen for shutdown or
297 * snapshot */
298 sv_t m_wait_unfreeze;/* waiting to unfreeze */
5000d01d 299 atomic_t m_active_trans; /* number trans frozen */
933d7884
ES
300 struct timer_list m_sbdirty_timer;/* superblock dirty timer
301 * for nfs refcache */
2bd0ea18
NS
302} xfs_mount_t;
303
304/*
305 * Flags for m_flags.
306 */
5000d01d 307#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops
2bd0ea18
NS
308 must be synchronous except
309 for space allocations */
310#if XFS_BIG_FILESYSTEMS
5000d01d 311#define XFS_MOUNT_INO64 0x00000002
2bd0ea18
NS
312#endif
313#define XFS_MOUNT_ROOTQCHECK 0x00000004
314 /* 0x00000008 -- currently unused */
315#define XFS_MOUNT_FS_SHUTDOWN 0x00000010 /* atomic stop of all filesystem
316 operations, typically for
317 disk errors in metadata */
318#define XFS_MOUNT_NOATIME 0x00000020 /* don't modify inode access
319 times on reads */
5000d01d
SL
320#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to
321 user */
322#define XFS_MOUNT_NOALIGN 0x00000080 /* turn off stripe alignment
2bd0ea18 323 allocations */
5000d01d
SL
324 /* 0x00000100 -- currently unused */
325#define XFS_MOUNT_REGISTERED 0x00000200 /* registered with cxfs master
326 cell logic */
327#define XFS_MOUNT_NORECOVERY 0x00000400 /* no recovery - dirty fs */
328#define XFS_MOUNT_SHARED 0x00000800 /* shared mount */
329#define XFS_MOUNT_DFLT_IOSIZE 0x00001000 /* set default i/o size */
330#define XFS_MOUNT_OSYNCISOSYNC 0x00002000 /* o_sync is REALLY o_sync */
5ffc734a 331 /* osyncisdsync is now default*/
fc8202ba 332#define XFS_MOUNT_NOUUID 0x00004000 /* ignore uuid during mount */
6d1d29a7
NS
333#define XFS_MOUNT_32BITINODES 0x00008000 /* do not create inodes above
334 * 32 bits in size */
7b9b8961 335#define XFS_MOUNT_IRIXSGID 0x00010000 /* Irix-style sgid inheritance */
d663096d 336#define XFS_MOUNT_NOLOGFLUSH 0x00020000
2bd0ea18
NS
337
338/*
339 * Flags for m_cxfstype
340 */
341#define XFS_CXFS_NOT 0x00000001 /* local mount */
342#define XFS_CXFS_SERVER 0x00000002 /* we're the CXFS server */
343#define XFS_CXFS_CLIENT 0x00000004 /* We're a CXFS client */
344#define XFS_CXFS_REC_ENABLED 0x00000008 /* recovery is enabled */
345
5000d01d 346#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
2bd0ea18
NS
347
348/*
349 * Default minimum read and write sizes.
350 */
5000d01d
SL
351#define XFS_READIO_LOG_LARGE 12
352#define XFS_WRITEIO_LOG_LARGE 12
2e72c460
ES
353/*
354 * Default allocation size
355 */
356#define XFS_WRITE_IO_LOG 16
2bd0ea18
NS
357
358/*
13f0b353 359 * Max and min values for UIO and mount-option defined I/O sizes;
5000d01d 360 * min value can't be less than a page. Currently unused.
2bd0ea18
NS
361 */
362#define XFS_MAX_IO_LOG 16 /* 64K */
13f0b353 363#define XFS_MIN_IO_LOG PAGE_SHIFT
2bd0ea18
NS
364
365/*
366 * Synchronous read and write sizes. This should be
367 * better for NFSv2 wsync filesystems.
368 */
5000d01d
SL
369#define XFS_WSYNC_READIO_LOG 15 /* 32K */
370#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */
2bd0ea18 371
3fbc9137 372#define xfs_force_shutdown(m,f) _xfs_force_shutdown(m,f,__FILE__,__LINE__);
5000d01d 373/*
2bd0ea18
NS
374 * Flags sent to xfs_force_shutdown.
375 */
376#define XFS_METADATA_IO_ERROR 0x1
377#define XFS_LOG_IO_ERROR 0x2
378#define XFS_FORCE_UMOUNT 0x4
379#define XFS_CORRUPT_INCORE 0x8 /* corrupt in-memory data structures */
380#if CELL_CAPABLE
5000d01d 381#define XFS_SHUTDOWN_REMOTE_REQ 0x10 /* shutdown req came from remote cell */
2bd0ea18
NS
382#endif
383
384/*
385 * xflags for xfs_syncsub
386 */
387#define XFS_XSYNC_RELOC 0x01
388
389/*
390 * Flags for xfs_mountfs
391 */
5000d01d 392#define XFS_MFSI_SECOND 0x01 /* Is a cxfs secondary mount -- skip */
2bd0ea18
NS
393 /* stuff which should only be done */
394 /* once. */
5000d01d 395#define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */
2bd0ea18
NS
396#define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */
397 /* log recovery */
398
399/*
400 * Macros for getting from mount to vfs and back.
401 */
402#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS)
403struct vfs *xfs_mtovfs(xfs_mount_t *mp);
5000d01d 404#define XFS_MTOVFS(mp) xfs_mtovfs(mp)
2bd0ea18 405#else
5000d01d 406#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv))
2bd0ea18
NS
407#endif
408#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM)
409xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp);
5000d01d 410#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
2bd0ea18 411#else
5000d01d 412#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp))
2bd0ea18 413#endif
5000d01d 414
2bd0ea18
NS
415
416/*
417 * Moved here from xfs_ag.h to avoid reordering header files
418 */
419
420#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO)
421xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d);
5000d01d 422#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
2bd0ea18
NS
423#else
424
425static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d)
426{
5000d01d
SL
427 d = XFS_BB_TO_FSBT(mp, d);
428 do_div(d, mp->m_sb.sb_agblocks);
429 return (xfs_agnumber_t) d;
2bd0ea18
NS
430}
431
432#endif
433#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO)
434xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d);
5000d01d 435#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
2bd0ea18
NS
436#else
437
438static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d)
439{
5000d01d
SL
440 d = XFS_BB_TO_FSBT(mp, d);
441 return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks);
2bd0ea18
NS
442}
443
444#endif
445
446/*
447 * This structure is for use by the xfs_mod_incore_sb_batch() routine.
448 */
449typedef struct xfs_mod_sb {
450 xfs_sb_field_t msb_field; /* Field to modify, see below */
451 int msb_delta; /* change to make to the specified field */
452} xfs_mod_sb_t;
453
5000d01d
SL
454#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD)
455#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock))
456#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock)
457#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s))
2bd0ea18
NS
458
459void xfs_mod_sb(xfs_trans_t *, __int64_t);
460xfs_mount_t *xfs_mount_init(void);
461void xfs_mount_free(xfs_mount_t *mp, int remove_bhv);
9911e5dc 462int xfs_mountfs(struct vfs *, xfs_mount_t *mp, kdev_t, int);
2bd0ea18
NS
463
464int xfs_unmountfs(xfs_mount_t *, int, struct cred *);
465void xfs_unmountfs_close(xfs_mount_t *, int, struct cred *);
5000d01d
SL
466int xfs_unmountfs_writesb(xfs_mount_t *);
467int xfs_unmount_flush(xfs_mount_t *, int);
2bd0ea18
NS
468int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int, int);
469int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, uint, int);
9911e5dc 470int xfs_readsb(xfs_mount_t *mp);
2bd0ea18 471struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
5000d01d 472void xfs_freesb(xfs_mount_t *);
3fbc9137 473void _xfs_force_shutdown(struct xfs_mount *, int, char *, int);
2bd0ea18 474int xfs_syncsub(xfs_mount_t *, int, int, int *);
6d1d29a7 475void xfs_initialize_perag(xfs_mount_t *, int);
2bd0ea18 476void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, __int64_t);
d9eab45c 477
0ddd9902
NS
478/*
479 * Flags for freeze operations.
480 */
d9eab45c
SL
481#define XFS_FREEZE_WRITE 1
482#define XFS_FREEZE_TRANS 2
483
484void xfs_start_freeze(xfs_mount_t *, int);
485void xfs_finish_freeze(xfs_mount_t *);
5000d01d 486void xfs_check_frozen(xfs_mount_t *, bhv_desc_t *, int);
d9eab45c 487
2bd0ea18
NS
488extern struct vfsops xfs_vfsops;
489
490#endif /* __KERNEL__ */
491
492#endif /* __XFS_MOUNT_H__ */