1153323Srodrigc/* 2159451Srodrigc * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3159451Srodrigc * All Rights Reserved. 4153323Srodrigc * 5159451Srodrigc * This program is free software; you can redistribute it and/or 6159451Srodrigc * modify it under the terms of the GNU General Public License as 7153323Srodrigc * published by the Free Software Foundation. 8153323Srodrigc * 9159451Srodrigc * This program is distributed in the hope that it would be useful, 10159451Srodrigc * but WITHOUT ANY WARRANTY; without even the implied warranty of 11159451Srodrigc * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12159451Srodrigc * GNU General Public License for more details. 13153323Srodrigc * 14159451Srodrigc * You should have received a copy of the GNU General Public License 15159451Srodrigc * along with this program; if not, write the Free Software Foundation, 16159451Srodrigc * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17153323Srodrigc */ 18153323Srodrigc#include "xfs.h" 19159451Srodrigc#include "xfs_fs.h" 20153323Srodrigc#include "xfs_types.h" 21159451Srodrigc#include "xfs_bit.h" 22159451Srodrigc#include "xfs_log.h" 23153323Srodrigc#include "xfs_inum.h" 24153323Srodrigc#include "xfs_trans.h" 25153323Srodrigc#include "xfs_sb.h" 26153323Srodrigc#include "xfs_ag.h" 27153323Srodrigc#include "xfs_dir.h" 28153323Srodrigc#include "xfs_dir2.h" 29159451Srodrigc#include "xfs_dfrag.h" 30153323Srodrigc#include "xfs_dmapi.h" 31153323Srodrigc#include "xfs_mount.h" 32159451Srodrigc#include "xfs_bmap_btree.h" 33153323Srodrigc#include "xfs_alloc_btree.h" 34153323Srodrigc#include "xfs_ialloc_btree.h" 35159451Srodrigc#include "xfs_dir_sf.h" 36159451Srodrigc#include "xfs_dir2_sf.h" 37159451Srodrigc#include "xfs_attr_sf.h" 38159451Srodrigc#include "xfs_dinode.h" 39159451Srodrigc#include "xfs_inode.h" 40159451Srodrigc#include "xfs_inode_item.h" 41153323Srodrigc#include "xfs_itable.h" 42153323Srodrigc#include "xfs_btree.h" 43153323Srodrigc#include "xfs_alloc.h" 44153323Srodrigc#include "xfs_ialloc.h" 45153323Srodrigc#include "xfs_bmap.h" 46153323Srodrigc#include "xfs_error.h" 47153323Srodrigc#include "xfs_rw.h" 48153323Srodrigc#include "xfs_quota.h" 49153323Srodrigc#include "xfs_trans_space.h" 50153323Srodrigc#include "xfs_iomap.h" 51153323Srodrigc 52153323Srodrigc 53153323Srodrigc 54153323SrodrigcSTATIC xfs_fsize_t 55153323Srodrigcxfs_size_fn( 56153323Srodrigc xfs_inode_t *ip) 57153323Srodrigc{ 58153323Srodrigc return (ip->i_d.di_size); 59153323Srodrigc} 60153323Srodrigc 61153323SrodrigcSTATIC int 62153323Srodrigcxfs_ioinit( 63153323Srodrigc struct xfs_vfs *vfsp, 64153323Srodrigc struct xfs_mount_args *mntargs, 65153323Srodrigc int flags) 66153323Srodrigc{ 67153323Srodrigc return xfs_mountfs(vfsp, XFS_VFSTOM(vfsp), flags); 68153323Srodrigc} 69153323Srodrigc 70153323Srodrigcxfs_ioops_t xfs_iocore_xfs = { 71153323Srodrigc .xfs_ioinit = (xfs_ioinit_t) xfs_ioinit, 72153323Srodrigc .xfs_bmapi_func = (xfs_bmapi_t) xfs_bmapi, 73159451Srodrigc .xfs_bunmapi_func = (xfs_bunmapi_t) xfs_bunmapi, 74153323Srodrigc .xfs_bmap_eof_func = (xfs_bmap_eof_t) xfs_bmap_eof, 75153323Srodrigc .xfs_iomap_write_direct = 76153323Srodrigc (xfs_iomap_write_direct_t) xfs_iomap_write_direct, 77153323Srodrigc .xfs_iomap_write_delay = 78153323Srodrigc (xfs_iomap_write_delay_t) xfs_iomap_write_delay, 79153323Srodrigc .xfs_iomap_write_allocate = 80153323Srodrigc (xfs_iomap_write_allocate_t) xfs_iomap_write_allocate, 81153323Srodrigc .xfs_iomap_write_unwritten = 82153323Srodrigc (xfs_iomap_write_unwritten_t) xfs_iomap_write_unwritten, 83153323Srodrigc .xfs_ilock = (xfs_lock_t) xfs_ilock, 84153323Srodrigc .xfs_lck_map_shared = (xfs_lck_map_shared_t) xfs_ilock_map_shared, 85153323Srodrigc .xfs_ilock_demote = (xfs_lock_demote_t) xfs_ilock_demote, 86153323Srodrigc .xfs_ilock_nowait = (xfs_lock_nowait_t) xfs_ilock_nowait, 87153323Srodrigc .xfs_unlock = (xfs_unlk_t) xfs_iunlock, 88153323Srodrigc .xfs_size_func = (xfs_size_t) xfs_size_fn, 89153323Srodrigc .xfs_iodone = (xfs_iodone_t) fs_noerr, 90159451Srodrigc .xfs_swap_extents_func = (xfs_swap_extents_t) xfs_swap_extents, 91153323Srodrigc}; 92153323Srodrigc 93153323Srodrigcvoid 94153323Srodrigcxfs_iocore_inode_reinit( 95153323Srodrigc xfs_inode_t *ip) 96153323Srodrigc{ 97153323Srodrigc xfs_iocore_t *io = &ip->i_iocore; 98153323Srodrigc 99153323Srodrigc io->io_flags = 0; 100153323Srodrigc if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) 101153323Srodrigc io->io_flags |= XFS_IOCORE_RT; 102153323Srodrigc io->io_dmevmask = ip->i_d.di_dmevmask; 103153323Srodrigc io->io_dmstate = ip->i_d.di_dmstate; 104153323Srodrigc} 105153323Srodrigc 106153323Srodrigcvoid 107153323Srodrigcxfs_iocore_inode_init( 108153323Srodrigc xfs_inode_t *ip) 109153323Srodrigc{ 110153323Srodrigc xfs_iocore_t *io = &ip->i_iocore; 111153323Srodrigc xfs_mount_t *mp = ip->i_mount; 112153323Srodrigc 113153323Srodrigc io->io_mount = mp; 114153323Srodrigc#ifdef DEBUG 115153323Srodrigc io->io_lock = &ip->i_lock; 116153323Srodrigc io->io_iolock = &ip->i_iolock; 117153323Srodrigc#endif 118153323Srodrigc 119153323Srodrigc io->io_obj = (void *)ip; 120153323Srodrigc 121153323Srodrigc xfs_iocore_inode_reinit(ip); 122153323Srodrigc} 123153323Srodrigc 124