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"
58 #include <geom/geom.h>
59 #include <geom/geom_vfs.h>
61 extern struct vop_vector xfs_fifoops;
62 extern struct xfs_vnodeops xfs_vnodeops;
66 unsigned int blockshift)
76 bhv_desc_t *inode_bhv,
79 xfs_inode_t *ip = XFS_BHVTOI(inode_bhv);
81 if (!inode_bhv->bd_vobj) {
82 xvp->v_vfsp = bhvtovfs(bdp);
83 bhv_desc_init(inode_bhv, ip, xvp, &xfs_vnodeops);
84 bhv_insert(VN_BHV_HEAD(xvp), inode_bhv);
88 * XXX: Use VNON as an indication of freshly allocated vnode
89 * which need to be initialized and unlocked.
90 * This is _not_ like the same place in Linux version of
94 if (xvp->v_vnode->v_type != VNON)
97 xvp->v_vnode->v_type = IFTOVT(ip->i_d.di_mode);
99 if (xvp->v_vnode->v_type == VFIFO)
100 xvp->v_vnode->v_op = &xfs_fifoops;
102 ASSERT_VOP_LOCKED(xvp->v_vnode, "xfs_initialize_vnode");
104 /* For new inodes we need to set the ops vectors,
105 * and unlock the inode.
107 if (ip->i_d.di_mode != 0 && unlock)
108 VOP_UNLOCK(xvp->v_vnode, 0, curthread);
127 struct vnode **bdevp)
130 struct nameidata *ndp = &nd;
134 struct g_consumer *cp;
135 struct g_provider *pp;
140 NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, name, td);
141 if ((error = namei(ndp)) != 0)
143 NDFREE(ndp, NDF_ONLY_PNBUF);
146 if (!vn_isdisk(devvp, &error)) {
151 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
153 ronly = ((XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) != 0);
156 accessmode |= VWRITE;
157 error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td);
159 error = priv_check(td, PRIV_VFS_MOUNT_PERM);
169 * XXX: Do not allow more than one consumer to open a device
170 * associated with a particular GEOM provider.
171 * This disables multiple read-only mounts of a device,
172 * but it gets rid of panics in bmemfree() when you try to
173 * mount the same device more than once.
174 * During mounting, XFS does a bread() of the superblock, but does
175 * not brelse() it. A subsequent mount of the same device
176 * will try to bread() the superblock, resulting in a panic in
177 * bremfree(), "buffer not on queue".
179 pp = g_dev_getprovider(devvp->v_rdev);
180 if ((pp != NULL) && ((pp->acr | pp->acw | pp->ace ) != 0))
183 error = g_vfs_open(devvp, &cp, "xfs", ronly ? 0 : 1);
192 VOP_UNLOCK(devvp, 0, td);
194 devvp->v_bufobj.bo_private = cp;
195 devvp->v_bufobj.bo_ops = &xfs_bo_ops;
205 struct g_consumer *cp;
210 vinvalbuf(devvp, V_SAVE, curthread, 0, 0);
212 cp = devvp->v_bufobj.bo_private;
215 g_wither_geom_close(cp->geom, ENXIO);
223 xfs_mountfs_check_barriers(xfs_mount_t *mp)
225 printf("xfs_mountfs_check_barriers NI\n");
232 printf("xfs_flush_inode NI\n");
239 printf("xfs_flush_device NI\n");
240 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
245 xfs_blkdev_issue_flush(
246 xfs_buftarg_t *buftarg)
248 printf("xfs_blkdev_issue_flush NI\n");
254 static char message[] =
255 XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";