xfs_mount.h revision 153323
1/* 2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 3 * 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. 7 * 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. 11 * 12 * Further, this software is distributed without any warranty that it is 13 * free of the rightful claim of any third person regarding infringement 14 * or the like. Any license provided herein, whether implied or 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. 18 * 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. 22 * 23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 24 * Mountain View, CA 94043, or: 25 * 26 * http://www.sgi.com 27 * 28 * For further information regarding this notice, see: 29 * 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 31 */ 32#ifndef __XFS_MOUNT_H__ 33#define __XFS_MOUNT_H__ 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 */ 55 uint tr_growrtalloc; /* grow realtime allocations */ 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; 71struct log; 72struct xfs_vfs; 73struct xfs_vnode; 74struct xfs_mount_args; 75struct xfs_ihash; 76struct xfs_chash; 77struct xfs_inode; 78struct xfs_perag; 79struct xfs_iocore; 80struct xfs_bmbt_irec; 81struct xfs_bmap_free; 82 83#define AIL_LOCK_T lock_t 84#define AIL_LOCKINIT(x,y) spinlock_init(x,y) 85#define AIL_LOCK_DESTROY(x) spinlock_destroy(x) 86#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock) 87#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s) 88 89 90/* 91 * Prototypes and functions for the Data Migration subsystem. 92 */ 93 94typedef int (*xfs_send_data_t)(int, struct xfs_vnode *, 95 xfs_off_t, size_t, int, vrwlock_t *); 96typedef int (*xfs_send_mmap_t)(void*, uint); 97 98typedef int (*xfs_send_destroy_t)(struct xfs_vnode *, dm_right_t); 99 100typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_vnode *, 101 dm_right_t, struct xfs_vnode *, dm_right_t, 102 char *, char *, mode_t, int, int); 103typedef void (*xfs_send_unmount_t)(struct xfs_vfs *, struct xfs_vnode *, 104 dm_right_t, mode_t, int, int); 105 106typedef struct xfs_dmops { 107 xfs_send_data_t xfs_send_data; 108 xfs_send_mmap_t xfs_send_mmap; 109 xfs_send_destroy_t xfs_send_destroy; 110 xfs_send_namesp_t xfs_send_namesp; 111 xfs_send_unmount_t xfs_send_unmount; 112} xfs_dmops_t; 113 114#define XFS_SEND_DATA(mp, ev,vp,off,len,fl,lock) \ 115 (*(mp)->m_dm_ops.xfs_send_data)(ev,vp,off,len,fl,lock) 116#define XFS_SEND_MMAP(mp, vma,fl) \ 117 (*(mp)->m_dm_ops.xfs_send_mmap)(vma,fl) 118#define XFS_SEND_DESTROY(mp, vp,right) \ 119 (*(mp)->m_dm_ops.xfs_send_destroy)(vp,right) 120#define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \ 121 (*(mp)->m_dm_ops.xfs_send_namesp)(ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) 122#define XFS_SEND_UNMOUNT(mp, vfsp,vp,right,mode,rval,fl) \ 123 (*(mp)->m_dm_ops.xfs_send_unmount)(vfsp,vp,right,mode,rval,fl) 124 125 126/* 127 * Prototypes and functions for the Quota Management subsystem. 128 */ 129 130struct xfs_dquot; 131struct xfs_dqtrxops; 132struct xfs_quotainfo; 133 134typedef int (*xfs_qminit_t)(struct xfs_mount *, uint *, uint *); 135typedef int (*xfs_qmmount_t)(struct xfs_mount *, uint, uint); 136typedef int (*xfs_qmunmount_t)(struct xfs_mount *); 137typedef void (*xfs_qmdone_t)(struct xfs_mount *); 138typedef void (*xfs_dqrele_t)(struct xfs_dquot *); 139typedef int (*xfs_dqattach_t)(struct xfs_inode *, uint); 140typedef void (*xfs_dqdetach_t)(struct xfs_inode *); 141typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint); 142typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *, 143 struct xfs_inode *, uid_t, gid_t, uint, 144 struct xfs_dquot **, struct xfs_dquot **); 145typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *, 146 struct xfs_dquot *, struct xfs_dquot *); 147typedef int (*xfs_dqvoprename_t)(struct xfs_inode **); 148typedef struct xfs_dquot * (*xfs_dqvopchown_t)( 149 struct xfs_trans *, struct xfs_inode *, 150 struct xfs_dquot **, struct xfs_dquot *); 151typedef int (*xfs_dqvopchownresv_t)(struct xfs_trans *, struct xfs_inode *, 152 struct xfs_dquot *, struct xfs_dquot *, uint); 153 154typedef struct xfs_qmops { 155 xfs_qminit_t xfs_qminit; 156 xfs_qmdone_t xfs_qmdone; 157 xfs_qmmount_t xfs_qmmount; 158 xfs_qmunmount_t xfs_qmunmount; 159 xfs_dqrele_t xfs_dqrele; 160 xfs_dqattach_t xfs_dqattach; 161 xfs_dqdetach_t xfs_dqdetach; 162 xfs_dqpurgeall_t xfs_dqpurgeall; 163 xfs_dqvopalloc_t xfs_dqvopalloc; 164 xfs_dqvopcreate_t xfs_dqvopcreate; 165 xfs_dqvoprename_t xfs_dqvoprename; 166 xfs_dqvopchown_t xfs_dqvopchown; 167 xfs_dqvopchownresv_t xfs_dqvopchownresv; 168 struct xfs_dqtrxops *xfs_dqtrxops; 169} xfs_qmops_t; 170 171#define XFS_QM_INIT(mp, mnt, fl) \ 172 (*(mp)->m_qm_ops.xfs_qminit)(mp, mnt, fl) 173#define XFS_QM_MOUNT(mp, mnt, fl) \ 174 (*(mp)->m_qm_ops.xfs_qmmount)(mp, mnt, fl) 175#define XFS_QM_UNMOUNT(mp) \ 176 (*(mp)->m_qm_ops.xfs_qmunmount)(mp) 177#define XFS_QM_DONE(mp) \ 178 (*(mp)->m_qm_ops.xfs_qmdone)(mp) 179#define XFS_QM_DQRELE(mp, dq) \ 180 (*(mp)->m_qm_ops.xfs_dqrele)(dq) 181#define XFS_QM_DQATTACH(mp, ip, fl) \ 182 (*(mp)->m_qm_ops.xfs_dqattach)(ip, fl) 183#define XFS_QM_DQDETACH(mp, ip) \ 184 (*(mp)->m_qm_ops.xfs_dqdetach)(ip) 185#define XFS_QM_DQPURGEALL(mp, fl) \ 186 (*(mp)->m_qm_ops.xfs_dqpurgeall)(mp, fl) 187#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, fl, dq1, dq2) \ 188 (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, fl, dq1, dq2) 189#define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \ 190 (*(mp)->m_qm_ops.xfs_dqvopcreate)(tp, ip, dq1, dq2) 191#define XFS_QM_DQVOPRENAME(mp, ip) \ 192 (*(mp)->m_qm_ops.xfs_dqvoprename)(ip) 193#define XFS_QM_DQVOPCHOWN(mp, tp, ip, dqp, dq) \ 194 (*(mp)->m_qm_ops.xfs_dqvopchown)(tp, ip, dqp, dq) 195#define XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, dq1, dq2, fl) \ 196 (*(mp)->m_qm_ops.xfs_dqvopchownresv)(tp, ip, dq1, dq2, fl) 197 198 199/* 200 * Prototypes and functions for I/O core modularization. 201 */ 202 203typedef int (*xfs_ioinit_t)(struct xfs_vfs *, 204 struct xfs_mount_args *, int); 205typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *, 206 xfs_fileoff_t, xfs_filblks_t, int, 207 xfs_fsblock_t *, xfs_extlen_t, 208 struct xfs_bmbt_irec *, int *, 209 struct xfs_bmap_free *); 210typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *); 211typedef int (*xfs_iomap_write_direct_t)( 212 void *, loff_t, size_t, int, 213 struct xfs_bmbt_irec *, int *, int); 214typedef int (*xfs_iomap_write_delay_t)( 215 void *, loff_t, size_t, int, 216 struct xfs_bmbt_irec *, int *); 217typedef int (*xfs_iomap_write_allocate_t)( 218 void *, struct xfs_bmbt_irec *, int *); 219typedef int (*xfs_iomap_write_unwritten_t)( 220 void *, loff_t, size_t); 221typedef uint (*xfs_lck_map_shared_t)(void *); 222typedef void (*xfs_lock_t)(void *, uint); 223typedef void (*xfs_lock_demote_t)(void *, uint); 224typedef int (*xfs_lock_nowait_t)(void *, uint); 225typedef void (*xfs_unlk_t)(void *, unsigned int); 226typedef xfs_fsize_t (*xfs_size_t)(void *); 227typedef xfs_fsize_t (*xfs_iodone_t)(struct xfs_vfs *); 228 229typedef struct xfs_ioops { 230 xfs_ioinit_t xfs_ioinit; 231 xfs_bmapi_t xfs_bmapi_func; 232 xfs_bmap_eof_t xfs_bmap_eof_func; 233 xfs_iomap_write_direct_t xfs_iomap_write_direct; 234 xfs_iomap_write_delay_t xfs_iomap_write_delay; 235 xfs_iomap_write_allocate_t xfs_iomap_write_allocate; 236 xfs_iomap_write_unwritten_t xfs_iomap_write_unwritten; 237 xfs_lock_t xfs_ilock; 238 xfs_lck_map_shared_t xfs_lck_map_shared; 239 xfs_lock_demote_t xfs_ilock_demote; 240 xfs_lock_nowait_t xfs_ilock_nowait; 241 xfs_unlk_t xfs_unlock; 242 xfs_size_t xfs_size_func; 243 xfs_iodone_t xfs_iodone; 244} xfs_ioops_t; 245 246#define XFS_IOINIT(vfsp, args, flags) \ 247 (*(mp)->m_io_ops.xfs_ioinit)(vfsp, args, flags) 248#define XFS_BMAPI(mp, trans,io,bno,len,f,first,tot,mval,nmap,flist) \ 249 (*(mp)->m_io_ops.xfs_bmapi_func) \ 250 (trans,(io)->io_obj,bno,len,f,first,tot,mval,nmap,flist) 251#define XFS_BMAP_EOF(mp, io, endoff, whichfork, eof) \ 252 (*(mp)->m_io_ops.xfs_bmap_eof_func) \ 253 ((io)->io_obj, endoff, whichfork, eof) 254#define XFS_IOMAP_WRITE_DIRECT(mp, io, offset, count, flags, mval, nmap, found)\ 255 (*(mp)->m_io_ops.xfs_iomap_write_direct) \ 256 ((io)->io_obj, offset, count, flags, mval, nmap, found) 257#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \ 258 (*(mp)->m_io_ops.xfs_iomap_write_delay) \ 259 ((io)->io_obj, offset, count, flags, mval, nmap) 260#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, mval, nmap) \ 261 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \ 262 ((io)->io_obj, mval, nmap) 263#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \ 264 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \ 265 ((io)->io_obj, offset, count) 266#define XFS_LCK_MAP_SHARED(mp, io) \ 267 (*(mp)->m_io_ops.xfs_lck_map_shared)((io)->io_obj) 268#define XFS_ILOCK(mp, io, mode) \ 269 (*(mp)->m_io_ops.xfs_ilock)((io)->io_obj, mode) 270#define XFS_ILOCK_NOWAIT(mp, io, mode) \ 271 (*(mp)->m_io_ops.xfs_ilock_nowait)((io)->io_obj, mode) 272#define XFS_IUNLOCK(mp, io, mode) \ 273 (*(mp)->m_io_ops.xfs_unlock)((io)->io_obj, mode) 274#define XFS_ILOCK_DEMOTE(mp, io, mode) \ 275 (*(mp)->m_io_ops.xfs_ilock_demote)((io)->io_obj, mode) 276#define XFS_SIZE(mp, io) \ 277 (*(mp)->m_io_ops.xfs_size_func)((io)->io_obj) 278#define XFS_IODONE(vfsp) \ 279 (*(mp)->m_io_ops.xfs_iodone)(vfsp) 280 281 282typedef struct xfs_mount { 283 bhv_desc_t m_bhv; /* vfs xfs behavior */ 284 xfs_tid_t m_tid; /* next unused tid for fs */ 285 AIL_LOCK_T m_ail_lock; /* fs AIL mutex */ 286 xfs_ail_entry_t m_ail; /* fs active log item list */ 287 uint m_ail_gen; /* fs AIL generation count */ 288 xfs_sb_t m_sb; /* copy of fs superblock */ 289 lock_t m_sb_lock; /* sb counter mutex */ 290 struct xfs_buf *m_sb_bp; /* buffer for superblock */ 291 char *m_fsname; /* filesystem name */ 292 int m_fsname_len; /* strlen of fs name */ 293 int m_bsize; /* fs logical block size */ 294 xfs_agnumber_t m_agfrotor; /* last ag where space found */ 295 xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ 296 lock_t m_agirotor_lock;/* .. and lock protecting it */ 297 xfs_agnumber_t m_maxagi; /* highest inode alloc group */ 298 int m_ihsize; /* size of next field */ 299 struct xfs_ihash *m_ihash; /* fs private inode hash table*/ 300 struct xfs_inode *m_inodes; /* active inode list */ 301 TAILQ_HEAD(,xfs_inode) m_del_inodes; /* inodes to reclaim */ 302 mutex_t m_ilock; /* inode list mutex */ 303 uint m_ireclaims; /* count of calls to reclaim*/ 304 uint m_readio_log; /* min read size log bytes */ 305 uint m_readio_blocks; /* min read size blocks */ 306 uint m_writeio_log; /* min write size log bytes */ 307 uint m_writeio_blocks; /* min write size blocks */ 308 struct log *m_log; /* log specific stuff */ 309 int m_logbufs; /* number of log buffers */ 310 int m_logbsize; /* size of each log buffer */ 311 uint m_rsumlevels; /* rt summary levels */ 312 uint m_rsumsize; /* size of rt summary, bytes */ 313 struct xfs_inode *m_rbmip; /* pointer to bitmap inode */ 314 struct xfs_inode *m_rsumip; /* pointer to summary inode */ 315 struct xfs_inode *m_rootip; /* pointer to root directory */ 316 struct xfs_quotainfo *m_quotainfo; /* disk quota information */ 317 xfs_buftarg_t *m_ddev_targp; /* saves taking the address */ 318 xfs_buftarg_t *m_logdev_targp;/* ptr to log device */ 319 xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */ 320#define m_dev m_ddev_targp->dev 321 __uint8_t m_dircook_elog; /* log d-cookie entry bits */ 322 __uint8_t m_blkbit_log; /* blocklog + NBBY */ 323 __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ 324 __uint8_t m_agno_log; /* log #ag's */ 325 __uint8_t m_agino_log; /* #bits for agino in inum */ 326 __uint8_t m_nreadaheads; /* #readahead buffers */ 327 __uint16_t m_inode_cluster_size;/* min inode buf size */ 328 uint m_blockmask; /* sb_blocksize-1 */ 329 uint m_blockwsize; /* sb_blocksize in words */ 330 uint m_blockwmask; /* blockwsize-1 */ 331 uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */ 332 uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */ 333 uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */ 334 uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */ 335 uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */ 336 uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */ 337 uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ 338 uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ 339 uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ 340 struct xfs_perag *m_perag; /* per-ag accounting info */ 341 struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */ 342 sema_t m_growlock; /* growfs mutex */ 343 int m_fixedfsid[2]; /* unchanged for life of FS */ 344 uint m_dmevmask; /* DMI events for this FS */ 345 uint m_flags; /* global mount flags */ 346 uint m_attroffset; /* inode attribute offset */ 347 uint m_dir_node_ents; /* #entries in a dir danode */ 348 uint m_attr_node_ents; /* #entries in attr danode */ 349 int m_ialloc_inos; /* inodes in inode allocation */ 350 int m_ialloc_blks; /* blocks in inode allocation */ 351 int m_litino; /* size of inode union area */ 352 int m_inoalign_mask;/* mask sb_inoalignmt if used */ 353 uint m_qflags; /* quota status flags */ 354 xfs_trans_reservations_t m_reservations;/* precomputed res values */ 355 __uint64_t m_maxicount; /* maximum inode count */ 356 __uint64_t m_maxioffset; /* maximum inode offset */ 357 __uint64_t m_resblks; /* total reserved blocks */ 358 __uint64_t m_resblks_avail;/* available reserved blocks */ 359#if XFS_BIG_INUMS 360 xfs_ino_t m_inoadd; /* add value for ino64_offset */ 361#endif 362 int m_dalign; /* stripe unit */ 363 int m_swidth; /* stripe width */ 364 int m_sinoalign; /* stripe unit inode alignmnt */ 365 int m_attr_magicpct;/* 37% of the blocksize */ 366 int m_dir_magicpct; /* 37% of the dir blocksize */ 367 __uint8_t m_mk_sharedro; /* mark shared ro on unmount */ 368 __uint8_t m_inode_quiesce;/* call quiesce on new inodes. 369 field governed by m_ilock */ 370 __uint8_t m_sectbb_log; /* sectlog - BBSHIFT */ 371 __uint8_t m_dirversion; /* 1 or 2 */ 372 xfs_dirops_t m_dirops; /* table of dir funcs */ 373 int m_dirblksize; /* directory block sz--bytes */ 374 int m_dirblkfsbs; /* directory block sz--fsbs */ 375 xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ 376 xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */ 377 xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */ 378 int m_chsize; /* size of next field */ 379 struct xfs_chash *m_chash; /* fs private inode per-cluster 380 * hash table */ 381 struct xfs_dmops m_dm_ops; /* vector of DMI ops */ 382 struct xfs_qmops m_qm_ops; /* vector of XQM ops */ 383 struct xfs_ioops m_io_ops; /* vector of I/O ops */ 384 lock_t m_freeze_lock; /* Lock for m_frozen */ 385 uint m_frozen; /* FS frozen for shutdown or 386 * snapshot */ 387 sv_t m_wait_unfreeze;/* waiting to unfreeze */ 388 atomic_t m_active_trans; /* number trans frozen */ 389} xfs_mount_t; 390 391/* 392 * Flags for m_flags. 393 */ 394#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops 395 must be synchronous except 396 for space allocations */ 397#define XFS_MOUNT_INO64 0x00000002 398 /* 0x00000004 -- currently unused */ 399 /* 0x00000008 -- currently unused */ 400#define XFS_MOUNT_FS_SHUTDOWN 0x00000010 /* atomic stop of all filesystem 401 operations, typically for 402 disk errors in metadata */ 403#define XFS_MOUNT_NOATIME 0x00000020 /* don't modify inode access 404 times on reads */ 405#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to 406 user */ 407#define XFS_MOUNT_NOALIGN 0x00000080 /* turn off stripe alignment 408 allocations */ 409 /* 0x00000100 -- currently unused */ 410 /* 0x00000200 -- currently unused */ 411#define XFS_MOUNT_NORECOVERY 0x00000400 /* no recovery - dirty fs */ 412#define XFS_MOUNT_SHARED 0x00000800 /* shared mount */ 413#define XFS_MOUNT_DFLT_IOSIZE 0x00001000 /* set default i/o size */ 414#define XFS_MOUNT_OSYNCISOSYNC 0x00002000 /* o_sync is REALLY o_sync */ 415 /* osyncisdsync is now default*/ 416#define XFS_MOUNT_32BITINODES 0x00004000 /* do not create inodes above 417 * 32 bits in size */ 418#define XFS_MOUNT_32BITINOOPT 0x00008000 /* saved mount option state */ 419#define XFS_MOUNT_NOUUID 0x00010000 /* ignore uuid during mount */ 420#define XFS_MOUNT_NOLOGFLUSH 0x00020000 421#define XFS_MOUNT_IDELETE 0x00040000 /* delete empty inode clusters*/ 422 423/* 424 * Default minimum read and write sizes. 425 */ 426#define XFS_READIO_LOG_LARGE 16 427#define XFS_WRITEIO_LOG_LARGE 16 428/* 429 * Default allocation size 430 */ 431#define XFS_WRITE_IO_LOG 16 432 433/* 434 * Max and min values for UIO and mount-option defined I/O sizes; 435 * min value can't be less than a page. Currently unused. 436 */ 437#define XFS_MAX_IO_LOG 16 /* 64K */ 438#define XFS_MIN_IO_LOG PAGE_SHIFT 439 440/* 441 * Synchronous read and write sizes. This should be 442 * better for NFSv2 wsync filesystems. 443 */ 444#define XFS_WSYNC_READIO_LOG 15 /* 32K */ 445#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */ 446 447#define XFS_MAXIOFFSET(mp) ((mp)->m_maxioffset) 448 449#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) 450#define xfs_force_shutdown(m,f) \ 451 XVFS_FORCE_SHUTDOWN((XFS_MTOVFS(m)), f, __FILE__, __LINE__) 452 453/* 454 * Flags sent to xfs_force_shutdown. 455 */ 456#define XFS_METADATA_IO_ERROR 0x1 457#define XFS_LOG_IO_ERROR 0x2 458#define XFS_FORCE_UMOUNT 0x4 459#define XFS_CORRUPT_INCORE 0x8 /* Corrupt in-memory data structures */ 460#define XFS_SHUTDOWN_REMOTE_REQ 0x10 /* Shutdown came from remote cell */ 461 462/* 463 * xflags for xfs_syncsub 464 */ 465#define XFS_XSYNC_RELOC 0x01 466 467/* 468 * Flags for xfs_mountfs 469 */ 470#define XFS_MFSI_SECOND 0x01 /* Secondary mount -- skip stuff */ 471#define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */ 472#define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */ 473 /* log recovery */ 474 475/* 476 * Macros for getting from mount to vfs and back. 477 */ 478#if XFS_WANT_FUNCS || XFS_WANT_FUNCS_C || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS) 479xfs_vfs_t *xfs_mtovfs(xfs_mount_t *mp); 480#endif 481 482#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS) 483#define XFS_MTOVFS(mp) xfs_mtovfs(mp) 484#else 485#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv)) 486#endif 487 488#if XFS_WANT_FUNCS || XFS_WANT_FUNCS_C || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM) 489xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp); 490#endif 491 492#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM) 493#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp) 494#else 495#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp)) 496#endif 497 498#if XFS_WANT_FUNCS || XFS_WANT_FUNCS_C || (XFS_WANT_SPACE && XFSSO_XFS_VFSTOM) 499xfs_mount_t *xfs_vfstom(xfs_vfs_t *vfs); 500#endif 501 502#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_VFSTOM) 503#define XFS_VFSTOM(vfs) xfs_vfstom(vfs) 504#else 505#define XFS_VFSTOM(vfs) \ 506 (XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfs), &xfs_vfsops))) 507#endif 508 509 510/* 511 * Moved here from xfs_ag.h to avoid reordering header files 512 */ 513 514#if XFS_WANT_FUNCS || XFS_WANT_FUNCS_C || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO) 515xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d); 516#endif 517 518#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO) 519#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) 520#else 521 522static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d) 523{ 524 d = XFS_BB_TO_FSBT(mp, d); 525 do_div(d, mp->m_sb.sb_agblocks); 526 return (xfs_agnumber_t) d; 527} 528 529#endif 530 531#if XFS_WANT_FUNCS || XFS_WANT_FUNCS_C || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO) 532xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d); 533#endif 534 535#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO) 536#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d) 537#else 538 539static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d) 540{ 541 d = XFS_BB_TO_FSBT(mp, d); 542 return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks); 543} 544 545#endif 546 547/* 548 * This structure is for use by the xfs_mod_incore_sb_batch() routine. 549 */ 550typedef struct xfs_mod_sb { 551 xfs_sb_field_t msb_field; /* Field to modify, see below */ 552 int msb_delta; /* Change to make to specified field */ 553} xfs_mod_sb_t; 554 555#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD) 556#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock)) 557#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock) 558#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s)) 559 560extern xfs_mount_t *xfs_mount_init(void); 561extern void xfs_mod_sb(xfs_trans_t *, __int64_t); 562extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv); 563extern int xfs_mountfs(struct xfs_vfs *, xfs_mount_t *mp, int); 564 565extern int xfs_unmountfs(xfs_mount_t *, struct cred *); 566extern void xfs_unmountfs_close(xfs_mount_t *, struct cred *); 567extern int xfs_unmountfs_writesb(xfs_mount_t *); 568extern int xfs_unmount_flush(xfs_mount_t *, int); 569extern int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int, int); 570extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, 571 uint, int); 572extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); 573extern int xfs_readsb(xfs_mount_t *mp); 574extern void xfs_freesb(xfs_mount_t *); 575extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int); 576extern int xfs_syncsub(xfs_mount_t *, int, int, int *); 577extern void xfs_initialize_perag(xfs_mount_t *, int); 578extern void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, 579 __int64_t); 580 581/* 582 * Flags for freeze operations. 583 */ 584#define XFS_FREEZE_WRITE 1 585#define XFS_FREEZE_TRANS 2 586 587extern void xfs_start_freeze(xfs_mount_t *, int); 588extern void xfs_finish_freeze(xfs_mount_t *); 589extern void xfs_check_frozen(xfs_mount_t *, bhv_desc_t *, int); 590 591extern struct xvfsops xfs_vfsops; 592extern struct xfs_vnodeops xfs_vnodeops; 593 594extern struct xfs_dmops xfs_dmcore_stub; 595extern struct xfs_qmops xfs_qmcore_stub; 596extern struct xfs_ioops xfs_iocore_xfs; 597 598extern int xfs_init(void); 599extern void xfs_cleanup(void); 600 601#endif /* __KERNEL__ */ 602 603#endif /* __XFS_MOUNT_H__ */ 604 605 606