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