Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write the Free Software Foundation, |
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include "xfs.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 19 | #include "xfs_fs.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include "xfs_types.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 21 | #include "xfs_bit.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include "xfs_log.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 23 | #include "xfs_inum.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include "xfs_trans.h" |
| 25 | #include "xfs_sb.h" |
| 26 | #include "xfs_ag.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include "xfs_dir2.h" |
Olaf Weber | 3e57ecf | 2006-06-09 14:48:12 +1000 | [diff] [blame] | 28 | #include "xfs_dfrag.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include "xfs_dmapi.h" |
| 30 | #include "xfs_mount.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include "xfs_bmap_btree.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 32 | #include "xfs_alloc_btree.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #include "xfs_ialloc_btree.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 34 | #include "xfs_dir2_sf.h" |
| 35 | #include "xfs_attr_sf.h" |
| 36 | #include "xfs_dinode.h" |
| 37 | #include "xfs_inode.h" |
| 38 | #include "xfs_inode_item.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include "xfs_itable.h" |
| 40 | #include "xfs_btree.h" |
| 41 | #include "xfs_alloc.h" |
| 42 | #include "xfs_ialloc.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #include "xfs_bmap.h" |
| 44 | #include "xfs_error.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include "xfs_rw.h" |
| 46 | #include "xfs_quota.h" |
| 47 | #include "xfs_trans_space.h" |
| 48 | #include "xfs_iomap.h" |
| 49 | |
| 50 | |
| 51 | STATIC xfs_fsize_t |
| 52 | xfs_size_fn( |
| 53 | xfs_inode_t *ip) |
| 54 | { |
Lachlan McIlroy | ba87ea6 | 2007-05-08 13:49:46 +1000 | [diff] [blame] | 55 | return XFS_ISIZE(ip); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | STATIC int |
| 59 | xfs_ioinit( |
Christoph Hellwig | b267ce9 | 2007-08-30 17:21:30 +1000 | [diff] [blame^] | 60 | struct xfs_mount *mp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | struct xfs_mount_args *mntargs, |
| 62 | int flags) |
| 63 | { |
Christoph Hellwig | b267ce9 | 2007-08-30 17:21:30 +1000 | [diff] [blame^] | 64 | return xfs_mountfs(mp, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | xfs_ioops_t xfs_iocore_xfs = { |
| 68 | .xfs_ioinit = (xfs_ioinit_t) xfs_ioinit, |
| 69 | .xfs_bmapi_func = (xfs_bmapi_t) xfs_bmapi, |
Olaf Weber | 3e57ecf | 2006-06-09 14:48:12 +1000 | [diff] [blame] | 70 | .xfs_bunmapi_func = (xfs_bunmapi_t) xfs_bunmapi, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | .xfs_bmap_eof_func = (xfs_bmap_eof_t) xfs_bmap_eof, |
| 72 | .xfs_iomap_write_direct = |
| 73 | (xfs_iomap_write_direct_t) xfs_iomap_write_direct, |
| 74 | .xfs_iomap_write_delay = |
| 75 | (xfs_iomap_write_delay_t) xfs_iomap_write_delay, |
| 76 | .xfs_iomap_write_allocate = |
| 77 | (xfs_iomap_write_allocate_t) xfs_iomap_write_allocate, |
| 78 | .xfs_iomap_write_unwritten = |
| 79 | (xfs_iomap_write_unwritten_t) xfs_iomap_write_unwritten, |
| 80 | .xfs_ilock = (xfs_lock_t) xfs_ilock, |
| 81 | .xfs_lck_map_shared = (xfs_lck_map_shared_t) xfs_ilock_map_shared, |
| 82 | .xfs_ilock_demote = (xfs_lock_demote_t) xfs_ilock_demote, |
| 83 | .xfs_ilock_nowait = (xfs_lock_nowait_t) xfs_ilock_nowait, |
| 84 | .xfs_unlock = (xfs_unlk_t) xfs_iunlock, |
| 85 | .xfs_size_func = (xfs_size_t) xfs_size_fn, |
| 86 | .xfs_iodone = (xfs_iodone_t) fs_noerr, |
Olaf Weber | 3e57ecf | 2006-06-09 14:48:12 +1000 | [diff] [blame] | 87 | .xfs_swap_extents_func = (xfs_swap_extents_t) xfs_swap_extents, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | void |
| 91 | xfs_iocore_inode_reinit( |
| 92 | xfs_inode_t *ip) |
| 93 | { |
| 94 | xfs_iocore_t *io = &ip->i_iocore; |
| 95 | |
| 96 | io->io_flags = 0; |
| 97 | if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) |
| 98 | io->io_flags |= XFS_IOCORE_RT; |
| 99 | io->io_dmevmask = ip->i_d.di_dmevmask; |
| 100 | io->io_dmstate = ip->i_d.di_dmstate; |
| 101 | } |
| 102 | |
| 103 | void |
| 104 | xfs_iocore_inode_init( |
| 105 | xfs_inode_t *ip) |
| 106 | { |
| 107 | xfs_iocore_t *io = &ip->i_iocore; |
| 108 | xfs_mount_t *mp = ip->i_mount; |
| 109 | |
| 110 | io->io_mount = mp; |
| 111 | #ifdef DEBUG |
| 112 | io->io_lock = &ip->i_lock; |
| 113 | io->io_iolock = &ip->i_iolock; |
| 114 | #endif |
| 115 | |
| 116 | io->io_obj = (void *)ip; |
| 117 | |
| 118 | xfs_iocore_inode_reinit(ip); |
| 119 | } |