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