2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
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
7 * published by the Free Software Foundation.
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.
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
23 #include "xfs_trans.h"
28 #include "xfs_alloc.h"
29 #include "xfs_dmapi.h"
30 #include "xfs_quota.h"
31 #include "xfs_mount.h"
32 #include "xfs_bmap_btree.h"
33 #include "xfs_alloc_btree.h"
34 #include "xfs_ialloc_btree.h"
35 #include "xfs_dir_sf.h"
36 #include "xfs_dir2_sf.h"
37 #include "xfs_attr_sf.h"
38 #include "xfs_dinode.h"
39 #include "xfs_inode.h"
40 #include "xfs_btree.h"
41 #include "xfs_ialloc.h"
43 #include "xfs_rtalloc.h"
44 #include "xfs_error.h"
45 #include "xfs_itable.h"
51 #include "xfs_buf_item.h"
52 #include "xfs_utils.h"
53 #include "xfs_version.h"
56 #include <geom/geom.h>
57 #include <geom/geom_vfs.h>
59 extern struct vop_vector xfs_fifoops;
60 extern struct xfs_vnodeops xfs_vnodeops;
64 unsigned int blockshift)
74 bhv_desc_t *inode_bhv,
77 xfs_inode_t *ip = XFS_BHVTOI(inode_bhv);
79 if (!inode_bhv->bd_vobj) {
80 xvp->v_vfsp = bhvtovfs(bdp);
81 bhv_desc_init(inode_bhv, ip, xvp, &xfs_vnodeops);
82 bhv_insert(VN_BHV_HEAD(xvp), inode_bhv);
86 * XXX: Use VNON as an indication of freshly allocated vnode
87 * which need to be initialized and unlocked.
88 * This is _not_ like the same place in Linux version of
92 if (xvp->v_vnode->v_type != VNON)
95 xvp->v_vnode->v_type = IFTOVT(ip->i_d.di_mode);
97 if (xvp->v_vnode->v_type == VFIFO)
98 xvp->v_vnode->v_op = &xfs_fifoops;
100 ASSERT_VOP_LOCKED(xvp->v_vnode, "xfs_initialize_vnode");
102 /* For new inodes we need to set the ops vectors,
103 * and unlock the inode.
105 if (ip->i_d.di_mode != 0 && unlock)
106 VOP_UNLOCK(xvp->v_vnode, 0, curthread);
125 struct vnode **bdevp)
128 struct nameidata *ndp = &nd;
132 struct g_consumer *cp;
133 struct g_provider *pp;
138 NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, name, td);
139 if ((error = namei(ndp)) != 0)
141 NDFREE(ndp, NDF_ONLY_PNBUF);
144 if (!vn_isdisk(devvp, &error)) {
149 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
151 ronly = ((XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) != 0);
155 accessmode |= VWRITE;
156 if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td))!= 0){
166 * XXX: Do not allow more than one consumer to open a device
167 * associated with a particular GEOM provider.
168 * This disables multiple read-only mounts of a device,
169 * but it gets rid of panics in bmemfree() when you try to
170 * mount the same device more than once.
171 * During mounting, XFS does a bread() of the superblock, but does
172 * not brelse() it. A subsequent mount of the same device
173 * will try to bread() the superblock, resulting in a panic in
174 * bremfree(), "buffer not on queue".
176 pp = g_dev_getprovider(devvp->v_rdev);
177 if ((pp != NULL) && ((pp->acr | pp->acw | pp->ace ) != 0))
180 error = g_vfs_open(devvp, &cp, "xfs", ronly ? 0 : 1);
189 VOP_UNLOCK(devvp, 0, td);
191 devvp->v_bufobj.bo_private = cp;
192 devvp->v_bufobj.bo_ops = &xfs_bo_ops;
202 struct g_consumer *cp;
207 vinvalbuf(devvp, V_SAVE, curthread, 0, 0);
209 cp = devvp->v_bufobj.bo_private;
212 g_wither_geom_close(cp->geom, ENXIO);
220 xfs_mountfs_check_barriers(xfs_mount_t *mp)
222 printf("xfs_mountfs_check_barriers NI\n");
229 printf("xfs_flush_inode NI\n");
236 printf("xfs_flush_device NI\n");
237 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
242 xfs_blkdev_issue_flush(
243 xfs_buftarg_t *buftarg)
245 printf("xfs_blkdev_issue_flush NI\n");
251 static char message[] =
252 XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";