blob: 6bdd0dcbe39855d9de33e1ab1eb3e757f0863222 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include "xfs.h"
Nathan Scotta844f452005-11-02 14:38:42 +110033#include "xfs_fs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include "xfs_types.h"
Nathan Scotta844f452005-11-02 14:38:42 +110035#include "xfs_bit.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include "xfs_log.h"
Nathan Scotta844f452005-11-02 14:38:42 +110037#include "xfs_inum.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include "xfs_trans.h"
39#include "xfs_sb.h"
40#include "xfs_ag.h"
41#include "xfs_dir.h"
42#include "xfs_dir2.h"
43#include "xfs_dmapi.h"
44#include "xfs_mount.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include "xfs_bmap_btree.h"
Nathan Scotta844f452005-11-02 14:38:42 +110046#include "xfs_alloc_btree.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#include "xfs_ialloc_btree.h"
Nathan Scotta844f452005-11-02 14:38:42 +110048#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#include "xfs_itable.h"
55#include "xfs_btree.h"
56#include "xfs_alloc.h"
57#include "xfs_ialloc.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#include "xfs_bmap.h"
59#include "xfs_error.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070060#include "xfs_rw.h"
61#include "xfs_quota.h"
62#include "xfs_trans_space.h"
63#include "xfs_iomap.h"
64
65
66STATIC xfs_fsize_t
67xfs_size_fn(
68 xfs_inode_t *ip)
69{
70 return (ip->i_d.di_size);
71}
72
73STATIC int
74xfs_ioinit(
75 struct vfs *vfsp,
76 struct xfs_mount_args *mntargs,
77 int flags)
78{
79 return xfs_mountfs(vfsp, XFS_VFSTOM(vfsp), flags);
80}
81
82xfs_ioops_t xfs_iocore_xfs = {
83 .xfs_ioinit = (xfs_ioinit_t) xfs_ioinit,
84 .xfs_bmapi_func = (xfs_bmapi_t) xfs_bmapi,
85 .xfs_bmap_eof_func = (xfs_bmap_eof_t) xfs_bmap_eof,
86 .xfs_iomap_write_direct =
87 (xfs_iomap_write_direct_t) xfs_iomap_write_direct,
88 .xfs_iomap_write_delay =
89 (xfs_iomap_write_delay_t) xfs_iomap_write_delay,
90 .xfs_iomap_write_allocate =
91 (xfs_iomap_write_allocate_t) xfs_iomap_write_allocate,
92 .xfs_iomap_write_unwritten =
93 (xfs_iomap_write_unwritten_t) xfs_iomap_write_unwritten,
94 .xfs_ilock = (xfs_lock_t) xfs_ilock,
95 .xfs_lck_map_shared = (xfs_lck_map_shared_t) xfs_ilock_map_shared,
96 .xfs_ilock_demote = (xfs_lock_demote_t) xfs_ilock_demote,
97 .xfs_ilock_nowait = (xfs_lock_nowait_t) xfs_ilock_nowait,
98 .xfs_unlock = (xfs_unlk_t) xfs_iunlock,
99 .xfs_size_func = (xfs_size_t) xfs_size_fn,
100 .xfs_iodone = (xfs_iodone_t) fs_noerr,
101};
102
103void
104xfs_iocore_inode_reinit(
105 xfs_inode_t *ip)
106{
107 xfs_iocore_t *io = &ip->i_iocore;
108
109 io->io_flags = 0;
110 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
111 io->io_flags |= XFS_IOCORE_RT;
112 io->io_dmevmask = ip->i_d.di_dmevmask;
113 io->io_dmstate = ip->i_d.di_dmstate;
114}
115
116void
117xfs_iocore_inode_init(
118 xfs_inode_t *ip)
119{
120 xfs_iocore_t *io = &ip->i_iocore;
121 xfs_mount_t *mp = ip->i_mount;
122
123 io->io_mount = mp;
124#ifdef DEBUG
125 io->io_lock = &ip->i_lock;
126 io->io_iolock = &ip->i_iolock;
127#endif
128
129 io->io_obj = (void *)ip;
130
131 xfs_iocore_inode_reinit(ip);
132}