ffs_vnops.c revision 1.117 1 1.117 hannken /* $NetBSD: ffs_vnops.c,v 1.117 2011/04/15 15:54:11 hannken Exp $ */
2 1.100 simonb
3 1.100 simonb /*-
4 1.109 ad * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
5 1.100 simonb * All rights reserved.
6 1.100 simonb *
7 1.100 simonb * This code is derived from software contributed to The NetBSD Foundation
8 1.109 ad * by Wasabi Systems, Inc, and by Andrew Doran.
9 1.100 simonb *
10 1.100 simonb * Redistribution and use in source and binary forms, with or without
11 1.100 simonb * modification, are permitted provided that the following conditions
12 1.100 simonb * are met:
13 1.100 simonb * 1. Redistributions of source code must retain the above copyright
14 1.100 simonb * notice, this list of conditions and the following disclaimer.
15 1.100 simonb * 2. Redistributions in binary form must reproduce the above copyright
16 1.100 simonb * notice, this list of conditions and the following disclaimer in the
17 1.100 simonb * documentation and/or other materials provided with the distribution.
18 1.100 simonb *
19 1.100 simonb * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.100 simonb * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.100 simonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.100 simonb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.100 simonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.100 simonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.100 simonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.100 simonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.100 simonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.100 simonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.100 simonb * POSSIBILITY OF SUCH DAMAGE.
30 1.100 simonb */
31 1.3 cgd
32 1.1 mycroft /*
33 1.1 mycroft * Copyright (c) 1982, 1986, 1989, 1993
34 1.1 mycroft * The Regents of the University of California. All rights reserved.
35 1.1 mycroft *
36 1.1 mycroft * Redistribution and use in source and binary forms, with or without
37 1.1 mycroft * modification, are permitted provided that the following conditions
38 1.1 mycroft * are met:
39 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
40 1.1 mycroft * notice, this list of conditions and the following disclaimer.
41 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
42 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
43 1.1 mycroft * documentation and/or other materials provided with the distribution.
44 1.60 agc * 3. Neither the name of the University nor the names of its contributors
45 1.1 mycroft * may be used to endorse or promote products derived from this software
46 1.1 mycroft * without specific prior written permission.
47 1.1 mycroft *
48 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 1.1 mycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 1.1 mycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 1.1 mycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 1.1 mycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 1.1 mycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 1.1 mycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 1.1 mycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 1.1 mycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 1.1 mycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 1.1 mycroft * SUCH DAMAGE.
59 1.1 mycroft *
60 1.12 fvdl * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95
61 1.1 mycroft */
62 1.44 lukem
63 1.44 lukem #include <sys/cdefs.h>
64 1.117 hannken __KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.117 2011/04/15 15:54:11 hannken Exp $");
65 1.100 simonb
66 1.100 simonb #if defined(_KERNEL_OPT)
67 1.100 simonb #include "opt_ffs.h"
68 1.100 simonb #include "opt_wapbl.h"
69 1.100 simonb #endif
70 1.11 mrg
71 1.1 mycroft #include <sys/param.h>
72 1.1 mycroft #include <sys/systm.h>
73 1.1 mycroft #include <sys/resourcevar.h>
74 1.1 mycroft #include <sys/kernel.h>
75 1.1 mycroft #include <sys/file.h>
76 1.1 mycroft #include <sys/stat.h>
77 1.1 mycroft #include <sys/buf.h>
78 1.50 jdolecek #include <sys/event.h>
79 1.1 mycroft #include <sys/proc.h>
80 1.1 mycroft #include <sys/mount.h>
81 1.1 mycroft #include <sys/vnode.h>
82 1.16 thorpej #include <sys/pool.h>
83 1.6 christos #include <sys/signalvar.h>
84 1.80 elad #include <sys/kauth.h>
85 1.100 simonb #include <sys/wapbl.h>
86 1.84 hannken #include <sys/fstrans.h>
87 1.1 mycroft
88 1.8 mycroft #include <miscfs/fifofs/fifo.h>
89 1.8 mycroft #include <miscfs/genfs/genfs.h>
90 1.1 mycroft #include <miscfs/specfs/specdev.h>
91 1.1 mycroft
92 1.1 mycroft #include <ufs/ufs/inode.h>
93 1.1 mycroft #include <ufs/ufs/dir.h>
94 1.1 mycroft #include <ufs/ufs/ufs_extern.h>
95 1.2 mycroft #include <ufs/ufs/ufsmount.h>
96 1.100 simonb #include <ufs/ufs/ufs_wapbl.h>
97 1.1 mycroft
98 1.1 mycroft #include <ufs/ffs/fs.h>
99 1.1 mycroft #include <ufs/ffs/ffs_extern.h>
100 1.1 mycroft
101 1.49 chs #include <uvm/uvm.h>
102 1.49 chs
103 1.1 mycroft /* Global vfs data structures for ufs. */
104 1.74 xtraeme int (**ffs_vnodeop_p)(void *);
105 1.37 jdolecek const struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
106 1.1 mycroft { &vop_default_desc, vn_default_error },
107 1.1 mycroft { &vop_lookup_desc, ufs_lookup }, /* lookup */
108 1.1 mycroft { &vop_create_desc, ufs_create }, /* create */
109 1.5 mycroft { &vop_whiteout_desc, ufs_whiteout }, /* whiteout */
110 1.1 mycroft { &vop_mknod_desc, ufs_mknod }, /* mknod */
111 1.1 mycroft { &vop_open_desc, ufs_open }, /* open */
112 1.1 mycroft { &vop_close_desc, ufs_close }, /* close */
113 1.1 mycroft { &vop_access_desc, ufs_access }, /* access */
114 1.1 mycroft { &vop_getattr_desc, ufs_getattr }, /* getattr */
115 1.1 mycroft { &vop_setattr_desc, ufs_setattr }, /* setattr */
116 1.1 mycroft { &vop_read_desc, ffs_read }, /* read */
117 1.1 mycroft { &vop_write_desc, ffs_write }, /* write */
118 1.1 mycroft { &vop_ioctl_desc, ufs_ioctl }, /* ioctl */
119 1.19 wrstuden { &vop_fcntl_desc, ufs_fcntl }, /* fcntl */
120 1.9 mycroft { &vop_poll_desc, ufs_poll }, /* poll */
121 1.50 jdolecek { &vop_kqfilter_desc, genfs_kqfilter }, /* kqfilter */
122 1.12 fvdl { &vop_revoke_desc, ufs_revoke }, /* revoke */
123 1.1 mycroft { &vop_mmap_desc, ufs_mmap }, /* mmap */
124 1.1 mycroft { &vop_fsync_desc, ffs_fsync }, /* fsync */
125 1.1 mycroft { &vop_seek_desc, ufs_seek }, /* seek */
126 1.1 mycroft { &vop_remove_desc, ufs_remove }, /* remove */
127 1.1 mycroft { &vop_link_desc, ufs_link }, /* link */
128 1.1 mycroft { &vop_rename_desc, ufs_rename }, /* rename */
129 1.1 mycroft { &vop_mkdir_desc, ufs_mkdir }, /* mkdir */
130 1.1 mycroft { &vop_rmdir_desc, ufs_rmdir }, /* rmdir */
131 1.1 mycroft { &vop_symlink_desc, ufs_symlink }, /* symlink */
132 1.1 mycroft { &vop_readdir_desc, ufs_readdir }, /* readdir */
133 1.1 mycroft { &vop_readlink_desc, ufs_readlink }, /* readlink */
134 1.1 mycroft { &vop_abortop_desc, ufs_abortop }, /* abortop */
135 1.1 mycroft { &vop_inactive_desc, ufs_inactive }, /* inactive */
136 1.1 mycroft { &vop_reclaim_desc, ffs_reclaim }, /* reclaim */
137 1.113 hannken { &vop_lock_desc, ufs_lock }, /* lock */
138 1.113 hannken { &vop_unlock_desc, ufs_unlock }, /* unlock */
139 1.1 mycroft { &vop_bmap_desc, ufs_bmap }, /* bmap */
140 1.1 mycroft { &vop_strategy_desc, ufs_strategy }, /* strategy */
141 1.1 mycroft { &vop_print_desc, ufs_print }, /* print */
142 1.113 hannken { &vop_islocked_desc, ufs_islocked }, /* islocked */
143 1.1 mycroft { &vop_pathconf_desc, ufs_pathconf }, /* pathconf */
144 1.1 mycroft { &vop_advlock_desc, ufs_advlock }, /* advlock */
145 1.8 mycroft { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
146 1.88 yamt { &vop_getpages_desc, genfs_getpages }, /* getpages */
147 1.75 yamt { &vop_putpages_desc, genfs_putpages }, /* putpages */
148 1.73 thorpej { &vop_openextattr_desc, ffs_openextattr }, /* openextattr */
149 1.73 thorpej { &vop_closeextattr_desc, ffs_closeextattr }, /* closeextattr */
150 1.73 thorpej { &vop_getextattr_desc, ffs_getextattr }, /* getextattr */
151 1.73 thorpej { &vop_setextattr_desc, ffs_setextattr }, /* setextattr */
152 1.73 thorpej { &vop_listextattr_desc, ffs_listextattr }, /* listextattr */
153 1.73 thorpej { &vop_deleteextattr_desc, ffs_deleteextattr }, /* deleteextattr */
154 1.35 chs { NULL, NULL }
155 1.1 mycroft };
156 1.37 jdolecek const struct vnodeopv_desc ffs_vnodeop_opv_desc =
157 1.1 mycroft { &ffs_vnodeop_p, ffs_vnodeop_entries };
158 1.1 mycroft
159 1.74 xtraeme int (**ffs_specop_p)(void *);
160 1.37 jdolecek const struct vnodeopv_entry_desc ffs_specop_entries[] = {
161 1.1 mycroft { &vop_default_desc, vn_default_error },
162 1.1 mycroft { &vop_lookup_desc, spec_lookup }, /* lookup */
163 1.1 mycroft { &vop_create_desc, spec_create }, /* create */
164 1.1 mycroft { &vop_mknod_desc, spec_mknod }, /* mknod */
165 1.1 mycroft { &vop_open_desc, spec_open }, /* open */
166 1.1 mycroft { &vop_close_desc, ufsspec_close }, /* close */
167 1.1 mycroft { &vop_access_desc, ufs_access }, /* access */
168 1.1 mycroft { &vop_getattr_desc, ufs_getattr }, /* getattr */
169 1.1 mycroft { &vop_setattr_desc, ufs_setattr }, /* setattr */
170 1.1 mycroft { &vop_read_desc, ufsspec_read }, /* read */
171 1.1 mycroft { &vop_write_desc, ufsspec_write }, /* write */
172 1.1 mycroft { &vop_ioctl_desc, spec_ioctl }, /* ioctl */
173 1.19 wrstuden { &vop_fcntl_desc, ufs_fcntl }, /* fcntl */
174 1.9 mycroft { &vop_poll_desc, spec_poll }, /* poll */
175 1.50 jdolecek { &vop_kqfilter_desc, spec_kqfilter }, /* kqfilter */
176 1.12 fvdl { &vop_revoke_desc, spec_revoke }, /* revoke */
177 1.1 mycroft { &vop_mmap_desc, spec_mmap }, /* mmap */
178 1.1 mycroft { &vop_fsync_desc, ffs_fsync }, /* fsync */
179 1.1 mycroft { &vop_seek_desc, spec_seek }, /* seek */
180 1.1 mycroft { &vop_remove_desc, spec_remove }, /* remove */
181 1.1 mycroft { &vop_link_desc, spec_link }, /* link */
182 1.1 mycroft { &vop_rename_desc, spec_rename }, /* rename */
183 1.1 mycroft { &vop_mkdir_desc, spec_mkdir }, /* mkdir */
184 1.1 mycroft { &vop_rmdir_desc, spec_rmdir }, /* rmdir */
185 1.1 mycroft { &vop_symlink_desc, spec_symlink }, /* symlink */
186 1.1 mycroft { &vop_readdir_desc, spec_readdir }, /* readdir */
187 1.1 mycroft { &vop_readlink_desc, spec_readlink }, /* readlink */
188 1.1 mycroft { &vop_abortop_desc, spec_abortop }, /* abortop */
189 1.1 mycroft { &vop_inactive_desc, ufs_inactive }, /* inactive */
190 1.1 mycroft { &vop_reclaim_desc, ffs_reclaim }, /* reclaim */
191 1.113 hannken { &vop_lock_desc, ufs_lock }, /* lock */
192 1.113 hannken { &vop_unlock_desc, ufs_unlock }, /* unlock */
193 1.1 mycroft { &vop_bmap_desc, spec_bmap }, /* bmap */
194 1.1 mycroft { &vop_strategy_desc, spec_strategy }, /* strategy */
195 1.1 mycroft { &vop_print_desc, ufs_print }, /* print */
196 1.113 hannken { &vop_islocked_desc, ufs_islocked }, /* islocked */
197 1.1 mycroft { &vop_pathconf_desc, spec_pathconf }, /* pathconf */
198 1.1 mycroft { &vop_advlock_desc, spec_advlock }, /* advlock */
199 1.8 mycroft { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
200 1.38 chs { &vop_getpages_desc, spec_getpages }, /* getpages */
201 1.38 chs { &vop_putpages_desc, spec_putpages }, /* putpages */
202 1.73 thorpej { &vop_openextattr_desc, ffs_openextattr }, /* openextattr */
203 1.73 thorpej { &vop_closeextattr_desc, ffs_closeextattr }, /* closeextattr */
204 1.73 thorpej { &vop_getextattr_desc, ffs_getextattr }, /* getextattr */
205 1.73 thorpej { &vop_setextattr_desc, ffs_setextattr }, /* setextattr */
206 1.73 thorpej { &vop_listextattr_desc, ffs_listextattr }, /* listextattr */
207 1.73 thorpej { &vop_deleteextattr_desc, ffs_deleteextattr }, /* deleteextattr */
208 1.35 chs { NULL, NULL }
209 1.1 mycroft };
210 1.37 jdolecek const struct vnodeopv_desc ffs_specop_opv_desc =
211 1.1 mycroft { &ffs_specop_p, ffs_specop_entries };
212 1.1 mycroft
213 1.74 xtraeme int (**ffs_fifoop_p)(void *);
214 1.37 jdolecek const struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
215 1.1 mycroft { &vop_default_desc, vn_default_error },
216 1.114 pooka { &vop_lookup_desc, vn_fifo_bypass }, /* lookup */
217 1.114 pooka { &vop_create_desc, vn_fifo_bypass }, /* create */
218 1.114 pooka { &vop_mknod_desc, vn_fifo_bypass }, /* mknod */
219 1.114 pooka { &vop_open_desc, vn_fifo_bypass }, /* open */
220 1.1 mycroft { &vop_close_desc, ufsfifo_close }, /* close */
221 1.1 mycroft { &vop_access_desc, ufs_access }, /* access */
222 1.1 mycroft { &vop_getattr_desc, ufs_getattr }, /* getattr */
223 1.1 mycroft { &vop_setattr_desc, ufs_setattr }, /* setattr */
224 1.1 mycroft { &vop_read_desc, ufsfifo_read }, /* read */
225 1.1 mycroft { &vop_write_desc, ufsfifo_write }, /* write */
226 1.114 pooka { &vop_ioctl_desc, vn_fifo_bypass }, /* ioctl */
227 1.19 wrstuden { &vop_fcntl_desc, ufs_fcntl }, /* fcntl */
228 1.114 pooka { &vop_poll_desc, vn_fifo_bypass }, /* poll */
229 1.114 pooka { &vop_kqfilter_desc, vn_fifo_bypass }, /* kqfilter */
230 1.114 pooka { &vop_revoke_desc, vn_fifo_bypass }, /* revoke */
231 1.114 pooka { &vop_mmap_desc, vn_fifo_bypass }, /* mmap */
232 1.1 mycroft { &vop_fsync_desc, ffs_fsync }, /* fsync */
233 1.114 pooka { &vop_seek_desc, vn_fifo_bypass }, /* seek */
234 1.114 pooka { &vop_remove_desc, vn_fifo_bypass }, /* remove */
235 1.114 pooka { &vop_link_desc, vn_fifo_bypass }, /* link */
236 1.114 pooka { &vop_rename_desc, vn_fifo_bypass }, /* rename */
237 1.114 pooka { &vop_mkdir_desc, vn_fifo_bypass }, /* mkdir */
238 1.114 pooka { &vop_rmdir_desc, vn_fifo_bypass }, /* rmdir */
239 1.114 pooka { &vop_symlink_desc, vn_fifo_bypass }, /* symlink */
240 1.114 pooka { &vop_readdir_desc, vn_fifo_bypass }, /* readdir */
241 1.114 pooka { &vop_readlink_desc, vn_fifo_bypass }, /* readlink */
242 1.114 pooka { &vop_abortop_desc, vn_fifo_bypass }, /* abortop */
243 1.1 mycroft { &vop_inactive_desc, ufs_inactive }, /* inactive */
244 1.1 mycroft { &vop_reclaim_desc, ffs_reclaim }, /* reclaim */
245 1.113 hannken { &vop_lock_desc, ufs_lock }, /* lock */
246 1.113 hannken { &vop_unlock_desc, ufs_unlock }, /* unlock */
247 1.114 pooka { &vop_bmap_desc, vn_fifo_bypass }, /* bmap */
248 1.114 pooka { &vop_strategy_desc, vn_fifo_bypass }, /* strategy */
249 1.1 mycroft { &vop_print_desc, ufs_print }, /* print */
250 1.113 hannken { &vop_islocked_desc, ufs_islocked }, /* islocked */
251 1.114 pooka { &vop_pathconf_desc, vn_fifo_bypass }, /* pathconf */
252 1.114 pooka { &vop_advlock_desc, vn_fifo_bypass }, /* advlock */
253 1.8 mycroft { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
254 1.114 pooka { &vop_putpages_desc, vn_fifo_bypass }, /* putpages */
255 1.73 thorpej { &vop_openextattr_desc, ffs_openextattr }, /* openextattr */
256 1.73 thorpej { &vop_closeextattr_desc, ffs_closeextattr }, /* closeextattr */
257 1.73 thorpej { &vop_getextattr_desc, ffs_getextattr }, /* getextattr */
258 1.73 thorpej { &vop_setextattr_desc, ffs_setextattr }, /* setextattr */
259 1.73 thorpej { &vop_listextattr_desc, ffs_listextattr }, /* listextattr */
260 1.73 thorpej { &vop_deleteextattr_desc, ffs_deleteextattr }, /* deleteextattr */
261 1.35 chs { NULL, NULL }
262 1.1 mycroft };
263 1.37 jdolecek const struct vnodeopv_desc ffs_fifoop_opv_desc =
264 1.1 mycroft { &ffs_fifoop_p, ffs_fifoop_entries };
265 1.1 mycroft
266 1.1 mycroft #include <ufs/ufs/ufs_readwrite.c>
267 1.20 fvdl
268 1.33 fvdl int
269 1.70 thorpej ffs_fsync(void *v)
270 1.33 fvdl {
271 1.33 fvdl struct vop_fsync_args /* {
272 1.33 fvdl struct vnode *a_vp;
273 1.80 elad kauth_cred_t a_cred;
274 1.33 fvdl int a_flags;
275 1.46 chs off_t a_offlo;
276 1.46 chs off_t a_offhi;
277 1.77 christos struct lwp *a_l;
278 1.33 fvdl } */ *ap = v;
279 1.35 chs struct buf *bp;
280 1.94 ad int num, error, i;
281 1.33 fvdl struct indir ia[NIADDR + 1];
282 1.33 fvdl int bsize;
283 1.45 simonb daddr_t blk_high;
284 1.33 fvdl struct vnode *vp;
285 1.100 simonb struct mount *mp;
286 1.33 fvdl
287 1.84 hannken vp = ap->a_vp;
288 1.117 hannken mp = vp->v_mount;
289 1.84 hannken
290 1.117 hannken fstrans_start(mp, FSTRANS_LAZY);
291 1.111 ad if ((ap->a_offlo == 0 && ap->a_offhi == 0) || (vp->v_type != VREG)) {
292 1.111 ad error = ffs_full_fsync(vp, ap->a_flags);
293 1.84 hannken goto out;
294 1.84 hannken }
295 1.33 fvdl
296 1.117 hannken bsize = mp->mnt_stat.f_iosize;
297 1.33 fvdl blk_high = ap->a_offhi / bsize;
298 1.33 fvdl if (ap->a_offhi % bsize != 0)
299 1.33 fvdl blk_high++;
300 1.33 fvdl
301 1.33 fvdl /*
302 1.35 chs * First, flush all pages in range.
303 1.33 fvdl */
304 1.35 chs
305 1.94 ad mutex_enter(&vp->v_interlock);
306 1.64 dbj error = VOP_PUTPAGES(vp, trunc_page(ap->a_offlo),
307 1.64 dbj round_page(ap->a_offhi), PGO_CLEANIT |
308 1.64 dbj ((ap->a_flags & FSYNC_WAIT) ? PGO_SYNCIO : 0));
309 1.64 dbj if (error) {
310 1.84 hannken goto out;
311 1.39 chs }
312 1.33 fvdl
313 1.100 simonb #ifdef WAPBL
314 1.117 hannken KASSERT(vp->v_type == VREG);
315 1.100 simonb if (mp->mnt_wapbl) {
316 1.110 ad /*
317 1.110 ad * Don't bother writing out metadata if the syncer is
318 1.110 ad * making the request. We will let the sync vnode
319 1.110 ad * write it out in a single burst through a call to
320 1.110 ad * VFS_SYNC().
321 1.110 ad */
322 1.110 ad if ((ap->a_flags & (FSYNC_DATAONLY | FSYNC_LAZY)) != 0) {
323 1.117 hannken fstrans_done(mp);
324 1.100 simonb return 0;
325 1.100 simonb }
326 1.100 simonb error = 0;
327 1.100 simonb if (vp->v_tag == VT_UFS && VTOI(vp)->i_flag &
328 1.100 simonb (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY |
329 1.100 simonb IN_MODIFIED | IN_ACCESSED)) {
330 1.100 simonb error = UFS_WAPBL_BEGIN(mp);
331 1.100 simonb if (error) {
332 1.117 hannken fstrans_done(mp);
333 1.100 simonb return error;
334 1.100 simonb }
335 1.112 ad error = ffs_update(vp, NULL, NULL, UPDATE_CLOSE |
336 1.112 ad ((ap->a_flags & FSYNC_WAIT) ? UPDATE_WAIT : 0));
337 1.100 simonb UFS_WAPBL_END(mp);
338 1.100 simonb }
339 1.110 ad if (error || (ap->a_flags & FSYNC_NOLOG) != 0) {
340 1.117 hannken fstrans_done(mp);
341 1.100 simonb return error;
342 1.100 simonb }
343 1.100 simonb error = wapbl_flush(mp->mnt_wapbl, 0);
344 1.117 hannken fstrans_done(mp);
345 1.100 simonb return error;
346 1.100 simonb }
347 1.100 simonb #endif /* WAPBL */
348 1.100 simonb
349 1.33 fvdl /*
350 1.35 chs * Then, flush indirect blocks.
351 1.33 fvdl */
352 1.35 chs
353 1.61 kleink if (blk_high >= NDADDR) {
354 1.33 fvdl error = ufs_getlbns(vp, blk_high, ia, &num);
355 1.94 ad if (error)
356 1.84 hannken goto out;
357 1.94 ad
358 1.94 ad mutex_enter(&bufcache_lock);
359 1.33 fvdl for (i = 0; i < num; i++) {
360 1.94 ad if ((bp = incore(vp, ia[i].in_lbn)) == NULL)
361 1.94 ad continue;
362 1.94 ad if ((bp->b_cflags & BC_BUSY) != 0 ||
363 1.94 ad (bp->b_oflags & BO_DELWRI) == 0)
364 1.94 ad continue;
365 1.94 ad bp->b_cflags |= BC_BUSY | BC_VFLUSH;
366 1.94 ad mutex_exit(&bufcache_lock);
367 1.94 ad bawrite(bp);
368 1.94 ad mutex_enter(&bufcache_lock);
369 1.33 fvdl }
370 1.94 ad mutex_exit(&bufcache_lock);
371 1.33 fvdl }
372 1.33 fvdl
373 1.33 fvdl if (ap->a_flags & FSYNC_WAIT) {
374 1.94 ad mutex_enter(&vp->v_interlock);
375 1.94 ad while (vp->v_numoutput > 0)
376 1.94 ad cv_wait(&vp->v_cv, &vp->v_interlock);
377 1.94 ad mutex_exit(&vp->v_interlock);
378 1.33 fvdl }
379 1.33 fvdl
380 1.112 ad error = ffs_update(vp, NULL, NULL, UPDATE_CLOSE |
381 1.112 ad (((ap->a_flags & (FSYNC_WAIT | FSYNC_DATAONLY)) == FSYNC_WAIT)
382 1.112 ad ? UPDATE_WAIT : 0));
383 1.67 wrstuden
384 1.67 wrstuden if (error == 0 && ap->a_flags & FSYNC_CACHE) {
385 1.67 wrstuden int l = 0;
386 1.67 wrstuden VOP_IOCTL(VTOI(vp)->i_devvp, DIOCCACHESYNC, &l, FWRITE,
387 1.93 pooka curlwp->l_cred);
388 1.67 wrstuden }
389 1.67 wrstuden
390 1.84 hannken out:
391 1.117 hannken fstrans_done(mp);
392 1.67 wrstuden return error;
393 1.33 fvdl }
394 1.33 fvdl
395 1.20 fvdl /*
396 1.110 ad * Synch an open file. Called for VOP_FSYNC().
397 1.20 fvdl */
398 1.20 fvdl /* ARGSUSED */
399 1.94 ad int
400 1.94 ad ffs_full_fsync(struct vnode *vp, int flags)
401 1.20 fvdl {
402 1.20 fvdl struct buf *bp, *nbp;
403 1.111 ad int error, passes, skipmeta, waitfor, i;
404 1.99 ad struct mount *mp;
405 1.99 ad
406 1.110 ad KASSERT(VTOI(vp) != NULL);
407 1.110 ad KASSERT(vp->v_tag == VT_UFS);
408 1.110 ad
409 1.99 ad error = 0;
410 1.24 fvdl
411 1.110 ad mp = vp->v_mount;
412 1.110 ad if (vp->v_type == VBLK && vp->v_specmountpoint != NULL) {
413 1.105 ad mp = vp->v_specmountpoint;
414 1.105 ad } else {
415 1.105 ad mp = vp->v_mount;
416 1.105 ad }
417 1.105 ad
418 1.35 chs /*
419 1.110 ad * Flush all dirty data associated with the vnode.
420 1.20 fvdl */
421 1.72 yamt if (vp->v_type == VREG || vp->v_type == VBLK) {
422 1.101 oster int pflags = PGO_ALLPAGES | PGO_CLEANIT;
423 1.101 oster
424 1.101 oster if ((flags & FSYNC_WAIT))
425 1.101 oster pflags |= PGO_SYNCIO;
426 1.101 oster if (vp->v_type == VREG &&
427 1.101 oster fstrans_getstate(mp) == FSTRANS_SUSPENDING)
428 1.101 oster pflags |= PGO_FREE;
429 1.111 ad mutex_enter(&vp->v_interlock);
430 1.101 oster error = VOP_PUTPAGES(vp, 0, 0, pflags);
431 1.99 ad if (error)
432 1.39 chs return error;
433 1.100 simonb }
434 1.100 simonb
435 1.100 simonb #ifdef WAPBL
436 1.111 ad mp = wapbl_vptomp(vp);
437 1.100 simonb if (mp && mp->mnt_wapbl) {
438 1.110 ad /*
439 1.110 ad * Don't bother writing out metadata if the syncer is
440 1.110 ad * making the request. We will let the sync vnode
441 1.110 ad * write it out in a single burst through a call to
442 1.110 ad * VFS_SYNC().
443 1.110 ad */
444 1.110 ad if ((flags & (FSYNC_DATAONLY | FSYNC_LAZY)) != 0)
445 1.110 ad return 0;
446 1.100 simonb
447 1.110 ad if ((VTOI(vp)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE
448 1.109 ad | IN_MODIFY | IN_MODIFIED | IN_ACCESSED)) != 0) {
449 1.100 simonb error = UFS_WAPBL_BEGIN(mp);
450 1.100 simonb if (error)
451 1.100 simonb return error;
452 1.112 ad error = ffs_update(vp, NULL, NULL, UPDATE_CLOSE |
453 1.112 ad ((flags & FSYNC_WAIT) ? UPDATE_WAIT : 0));
454 1.100 simonb UFS_WAPBL_END(mp);
455 1.100 simonb }
456 1.110 ad if (error || (flags & FSYNC_NOLOG) != 0)
457 1.100 simonb return error;
458 1.106 ad
459 1.100 simonb /*
460 1.100 simonb * Don't flush the log if the vnode being flushed
461 1.100 simonb * contains no dirty buffers that could be in the log.
462 1.100 simonb */
463 1.109 ad if (!LIST_EMPTY(&vp->v_dirtyblkhd)) {
464 1.100 simonb error = wapbl_flush(mp->mnt_wapbl, 0);
465 1.100 simonb if (error)
466 1.100 simonb return error;
467 1.100 simonb }
468 1.100 simonb
469 1.109 ad if ((flags & FSYNC_WAIT) != 0) {
470 1.100 simonb mutex_enter(&vp->v_interlock);
471 1.110 ad while (vp->v_numoutput != 0)
472 1.100 simonb cv_wait(&vp->v_cv, &vp->v_interlock);
473 1.100 simonb mutex_exit(&vp->v_interlock);
474 1.100 simonb }
475 1.100 simonb
476 1.100 simonb return error;
477 1.100 simonb }
478 1.100 simonb #endif /* WAPBL */
479 1.35 chs
480 1.110 ad /*
481 1.111 ad * Write out metadata for non-logging file systems. XXX This block
482 1.111 ad * should be simplified now that softdep is gone.
483 1.110 ad */
484 1.20 fvdl passes = NIADDR + 1;
485 1.20 fvdl skipmeta = 0;
486 1.94 ad if (flags & FSYNC_WAIT)
487 1.20 fvdl skipmeta = 1;
488 1.35 chs
489 1.20 fvdl loop:
490 1.94 ad mutex_enter(&bufcache_lock);
491 1.94 ad LIST_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) {
492 1.94 ad bp->b_cflags &= ~BC_SCANNED;
493 1.94 ad }
494 1.29 mycroft for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
495 1.29 mycroft nbp = LIST_NEXT(bp, b_vnbufs);
496 1.94 ad if (bp->b_cflags & (BC_BUSY | BC_SCANNED))
497 1.20 fvdl continue;
498 1.94 ad if ((bp->b_oflags & BO_DELWRI) == 0)
499 1.20 fvdl panic("ffs_fsync: not dirty");
500 1.94 ad if (skipmeta && bp->b_lblkno < 0)
501 1.20 fvdl continue;
502 1.94 ad bp->b_cflags |= BC_BUSY | BC_VFLUSH | BC_SCANNED;
503 1.94 ad mutex_exit(&bufcache_lock);
504 1.20 fvdl /*
505 1.20 fvdl * On our final pass through, do all I/O synchronously
506 1.20 fvdl * so that we can find out if our flush is failing
507 1.20 fvdl * because of write errors.
508 1.20 fvdl */
509 1.94 ad if (passes > 0 || !(flags & FSYNC_WAIT))
510 1.20 fvdl (void) bawrite(bp);
511 1.20 fvdl else if ((error = bwrite(bp)) != 0)
512 1.20 fvdl return (error);
513 1.20 fvdl /*
514 1.94 ad * Since we unlocked during the I/O, we need
515 1.20 fvdl * to start from a known point.
516 1.20 fvdl */
517 1.94 ad mutex_enter(&bufcache_lock);
518 1.29 mycroft nbp = LIST_FIRST(&vp->v_dirtyblkhd);
519 1.20 fvdl }
520 1.94 ad mutex_exit(&bufcache_lock);
521 1.61 kleink if (skipmeta) {
522 1.20 fvdl skipmeta = 0;
523 1.20 fvdl goto loop;
524 1.20 fvdl }
525 1.94 ad
526 1.109 ad if ((flags & FSYNC_WAIT) != 0) {
527 1.94 ad mutex_enter(&vp->v_interlock);
528 1.20 fvdl while (vp->v_numoutput) {
529 1.94 ad cv_wait(&vp->v_cv, &vp->v_interlock);
530 1.20 fvdl }
531 1.94 ad mutex_exit(&vp->v_interlock);
532 1.20 fvdl
533 1.69 perry /*
534 1.20 fvdl * Ensure that any filesystem metadata associated
535 1.20 fvdl * with the vnode has been written.
536 1.20 fvdl */
537 1.29 mycroft if (!LIST_EMPTY(&vp->v_dirtyblkhd)) {
538 1.29 mycroft /*
539 1.29 mycroft * Block devices associated with filesystems may
540 1.29 mycroft * have new I/O requests posted for them even if
541 1.29 mycroft * the vnode is locked, so no amount of trying will
542 1.29 mycroft * get them clean. Thus we give block devices a
543 1.29 mycroft * good effort, then just give up. For all other file
544 1.29 mycroft * types, go around and try again until it is clean.
545 1.29 mycroft */
546 1.29 mycroft if (passes > 0) {
547 1.29 mycroft passes--;
548 1.29 mycroft goto loop;
549 1.29 mycroft }
550 1.20 fvdl #ifdef DIAGNOSTIC
551 1.29 mycroft if (vp->v_type != VBLK)
552 1.29 mycroft vprint("ffs_fsync: dirty", vp);
553 1.20 fvdl #endif
554 1.29 mycroft }
555 1.29 mycroft }
556 1.47 fvdl
557 1.111 ad waitfor = (flags & FSYNC_WAIT) ? UPDATE_WAIT : 0;
558 1.112 ad error = ffs_update(vp, NULL, NULL, UPDATE_CLOSE | waitfor);
559 1.67 wrstuden
560 1.109 ad if (error == 0 && (flags & FSYNC_CACHE) != 0) {
561 1.110 ad (void)VOP_IOCTL(VTOI(vp)->i_devvp, DIOCCACHESYNC, &i, FWRITE,
562 1.110 ad kauth_cred_get());
563 1.67 wrstuden }
564 1.67 wrstuden
565 1.67 wrstuden return error;
566 1.20 fvdl }
567 1.1 mycroft
568 1.1 mycroft /*
569 1.1 mycroft * Reclaim an inode so that it can be used for other purposes.
570 1.1 mycroft */
571 1.1 mycroft int
572 1.70 thorpej ffs_reclaim(void *v)
573 1.6 christos {
574 1.1 mycroft struct vop_reclaim_args /* {
575 1.1 mycroft struct vnode *a_vp;
576 1.77 christos struct lwp *a_l;
577 1.6 christos } */ *ap = v;
578 1.26 augustss struct vnode *vp = ap->a_vp;
579 1.56 fvdl struct inode *ip = VTOI(vp);
580 1.84 hannken struct mount *mp = vp->v_mount;
581 1.56 fvdl struct ufsmount *ump = ip->i_ump;
582 1.94 ad void *data;
583 1.1 mycroft int error;
584 1.1 mycroft
585 1.87 hannken fstrans_start(mp, FSTRANS_LAZY);
586 1.115 hannken /*
587 1.115 hannken * The inode must be freed and updated before being removed
588 1.115 hannken * from its hash chain. Other threads trying to gain a hold
589 1.115 hannken * on the inode will be stalled because it is locked (VI_XLOCK).
590 1.115 hannken */
591 1.115 hannken error = UFS_WAPBL_BEGIN(mp);
592 1.115 hannken if (error) {
593 1.115 hannken fstrans_done(mp);
594 1.115 hannken return error;
595 1.115 hannken }
596 1.116 hannken if (ip->i_nlink <= 0 && ip->i_omode != 0 &&
597 1.116 hannken (vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
598 1.115 hannken ffs_vfree(vp, ip->i_number, ip->i_omode);
599 1.115 hannken UFS_WAPBL_END(mp);
600 1.93 pooka if ((error = ufs_reclaim(vp)) != 0) {
601 1.84 hannken fstrans_done(mp);
602 1.1 mycroft return (error);
603 1.84 hannken }
604 1.57 fvdl if (ip->i_din.ffs1_din != NULL) {
605 1.57 fvdl if (ump->um_fstype == UFS1)
606 1.95 ad pool_cache_put(ffs_dinode1_cache, ip->i_din.ffs1_din);
607 1.57 fvdl else
608 1.95 ad pool_cache_put(ffs_dinode2_cache, ip->i_din.ffs2_din);
609 1.57 fvdl }
610 1.16 thorpej /*
611 1.94 ad * To interlock with ffs_sync().
612 1.94 ad */
613 1.94 ad genfs_node_destroy(vp);
614 1.94 ad mutex_enter(&vp->v_interlock);
615 1.94 ad data = vp->v_data;
616 1.94 ad vp->v_data = NULL;
617 1.94 ad mutex_exit(&vp->v_interlock);
618 1.94 ad
619 1.94 ad /*
620 1.16 thorpej * XXX MFS ends up here, too, to free an inode. Should we create
621 1.16 thorpej * XXX a separate pool for MFS inodes?
622 1.16 thorpej */
623 1.95 ad pool_cache_put(ffs_inode_cache, data);
624 1.84 hannken fstrans_done(mp);
625 1.1 mycroft return (0);
626 1.35 chs }
627 1.35 chs
628 1.35 chs /*
629 1.35 chs * Return the last logical file offset that should be written for this file
630 1.35 chs * if we're doing a write that ends at "size".
631 1.35 chs */
632 1.39 chs
633 1.39 chs void
634 1.83 christos ffs_gop_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
635 1.35 chs {
636 1.39 chs struct inode *ip = VTOI(vp);
637 1.35 chs struct fs *fs = ip->i_fs;
638 1.52 fvdl daddr_t olbn, nlbn;
639 1.55 perseant
640 1.56 fvdl olbn = lblkno(fs, ip->i_size);
641 1.39 chs nlbn = lblkno(fs, size);
642 1.35 chs if (nlbn < NDADDR && olbn <= nlbn) {
643 1.39 chs *eobp = fragroundup(fs, size);
644 1.35 chs } else {
645 1.39 chs *eobp = blkroundup(fs, size);
646 1.35 chs }
647 1.1 mycroft }
648 1.73 thorpej
649 1.73 thorpej int
650 1.73 thorpej ffs_openextattr(void *v)
651 1.73 thorpej {
652 1.73 thorpej struct vop_openextattr_args /* {
653 1.73 thorpej struct vnode *a_vp;
654 1.80 elad kauth_cred_t a_cred;
655 1.73 thorpej struct proc *a_p;
656 1.73 thorpej } */ *ap = v;
657 1.73 thorpej struct inode *ip = VTOI(ap->a_vp);
658 1.73 thorpej struct fs *fs = ip->i_fs;
659 1.73 thorpej
660 1.73 thorpej /* Not supported for UFS1 file systems. */
661 1.73 thorpej if (fs->fs_magic == FS_UFS1_MAGIC)
662 1.73 thorpej return (EOPNOTSUPP);
663 1.73 thorpej
664 1.73 thorpej /* XXX Not implemented for UFS2 file systems. */
665 1.73 thorpej return (EOPNOTSUPP);
666 1.73 thorpej }
667 1.73 thorpej
668 1.73 thorpej int
669 1.73 thorpej ffs_closeextattr(void *v)
670 1.73 thorpej {
671 1.73 thorpej struct vop_closeextattr_args /* {
672 1.73 thorpej struct vnode *a_vp;
673 1.73 thorpej int a_commit;
674 1.80 elad kauth_cred_t a_cred;
675 1.73 thorpej struct proc *a_p;
676 1.73 thorpej } */ *ap = v;
677 1.73 thorpej struct inode *ip = VTOI(ap->a_vp);
678 1.73 thorpej struct fs *fs = ip->i_fs;
679 1.73 thorpej
680 1.73 thorpej /* Not supported for UFS1 file systems. */
681 1.73 thorpej if (fs->fs_magic == FS_UFS1_MAGIC)
682 1.73 thorpej return (EOPNOTSUPP);
683 1.73 thorpej
684 1.73 thorpej /* XXX Not implemented for UFS2 file systems. */
685 1.73 thorpej return (EOPNOTSUPP);
686 1.73 thorpej }
687 1.73 thorpej
688 1.73 thorpej int
689 1.73 thorpej ffs_getextattr(void *v)
690 1.73 thorpej {
691 1.73 thorpej struct vop_getextattr_args /* {
692 1.73 thorpej struct vnode *a_vp;
693 1.73 thorpej int a_attrnamespace;
694 1.73 thorpej const char *a_name;
695 1.73 thorpej struct uio *a_uio;
696 1.73 thorpej size_t *a_size;
697 1.80 elad kauth_cred_t a_cred;
698 1.73 thorpej struct proc *a_p;
699 1.73 thorpej } */ *ap = v;
700 1.84 hannken struct vnode *vp = ap->a_vp;
701 1.84 hannken struct inode *ip = VTOI(vp);
702 1.73 thorpej struct fs *fs = ip->i_fs;
703 1.73 thorpej
704 1.73 thorpej if (fs->fs_magic == FS_UFS1_MAGIC) {
705 1.73 thorpej #ifdef UFS_EXTATTR
706 1.84 hannken int error;
707 1.84 hannken
708 1.87 hannken fstrans_start(vp->v_mount, FSTRANS_SHARED);
709 1.84 hannken error = ufs_getextattr(ap);
710 1.84 hannken fstrans_done(vp->v_mount);
711 1.84 hannken return error;
712 1.73 thorpej #else
713 1.73 thorpej return (EOPNOTSUPP);
714 1.73 thorpej #endif
715 1.73 thorpej }
716 1.73 thorpej
717 1.73 thorpej /* XXX Not implemented for UFS2 file systems. */
718 1.73 thorpej return (EOPNOTSUPP);
719 1.73 thorpej }
720 1.73 thorpej
721 1.73 thorpej int
722 1.73 thorpej ffs_setextattr(void *v)
723 1.73 thorpej {
724 1.73 thorpej struct vop_setextattr_args /* {
725 1.73 thorpej struct vnode *a_vp;
726 1.73 thorpej int a_attrnamespace;
727 1.73 thorpej const char *a_name;
728 1.73 thorpej struct uio *a_uio;
729 1.80 elad kauth_cred_t a_cred;
730 1.73 thorpej struct proc *a_p;
731 1.73 thorpej } */ *ap = v;
732 1.84 hannken struct vnode *vp = ap->a_vp;
733 1.84 hannken struct inode *ip = VTOI(vp);
734 1.73 thorpej struct fs *fs = ip->i_fs;
735 1.73 thorpej
736 1.73 thorpej if (fs->fs_magic == FS_UFS1_MAGIC) {
737 1.73 thorpej #ifdef UFS_EXTATTR
738 1.84 hannken int error;
739 1.84 hannken
740 1.87 hannken fstrans_start(vp->v_mount, FSTRANS_SHARED);
741 1.84 hannken error = ufs_setextattr(ap);
742 1.84 hannken fstrans_done(vp->v_mount);
743 1.84 hannken return error;
744 1.73 thorpej #else
745 1.73 thorpej return (EOPNOTSUPP);
746 1.73 thorpej #endif
747 1.73 thorpej }
748 1.73 thorpej
749 1.73 thorpej /* XXX Not implemented for UFS2 file systems. */
750 1.73 thorpej return (EOPNOTSUPP);
751 1.73 thorpej }
752 1.73 thorpej
753 1.73 thorpej int
754 1.73 thorpej ffs_listextattr(void *v)
755 1.73 thorpej {
756 1.73 thorpej struct vop_listextattr_args /* {
757 1.73 thorpej struct vnode *a_vp;
758 1.73 thorpej int a_attrnamespace;
759 1.73 thorpej struct uio *a_uio;
760 1.73 thorpej size_t *a_size;
761 1.80 elad kauth_cred_t a_cred;
762 1.73 thorpej struct proc *a_p;
763 1.73 thorpej } */ *ap = v;
764 1.73 thorpej struct inode *ip = VTOI(ap->a_vp);
765 1.73 thorpej struct fs *fs = ip->i_fs;
766 1.73 thorpej
767 1.73 thorpej /* Not supported for UFS1 file systems. */
768 1.73 thorpej if (fs->fs_magic == FS_UFS1_MAGIC)
769 1.73 thorpej return (EOPNOTSUPP);
770 1.73 thorpej
771 1.73 thorpej /* XXX Not implemented for UFS2 file systems. */
772 1.73 thorpej return (EOPNOTSUPP);
773 1.73 thorpej }
774 1.73 thorpej
775 1.73 thorpej int
776 1.73 thorpej ffs_deleteextattr(void *v)
777 1.73 thorpej {
778 1.73 thorpej struct vop_deleteextattr_args /* {
779 1.73 thorpej struct vnode *a_vp;
780 1.73 thorpej int a_attrnamespace;
781 1.80 elad kauth_cred_t a_cred;
782 1.73 thorpej struct proc *a_p;
783 1.73 thorpej } */ *ap = v;
784 1.84 hannken struct vnode *vp = ap->a_vp;
785 1.84 hannken struct inode *ip = VTOI(vp);
786 1.73 thorpej struct fs *fs = ip->i_fs;
787 1.73 thorpej
788 1.73 thorpej if (fs->fs_magic == FS_UFS1_MAGIC) {
789 1.73 thorpej #ifdef UFS_EXTATTR
790 1.84 hannken int error;
791 1.84 hannken
792 1.87 hannken fstrans_start(vp->v_mount, FSTRANS_SHARED);
793 1.84 hannken error = ufs_deleteextattr(ap);
794 1.84 hannken fstrans_done(vp->v_mount);
795 1.84 hannken return error;
796 1.73 thorpej #else
797 1.73 thorpej return (EOPNOTSUPP);
798 1.73 thorpej #endif
799 1.73 thorpej }
800 1.73 thorpej
801 1.73 thorpej /* XXX Not implemented for UFS2 file systems. */
802 1.73 thorpej return (EOPNOTSUPP);
803 1.73 thorpej }
804