2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * $DragonFly: src/sys/vfs/hammer/hammer_vnops.c,v 1.15 2008/01/01 01:00:03 dillon Exp $
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/kernel.h>
40 #include <sys/fcntl.h>
41 #include <sys/namecache.h>
42 #include <sys/vnode.h>
43 #include <sys/lockf.h>
44 #include <sys/event.h>
46 #include <sys/dirent.h>
47 #include <vm/vm_extern.h>
48 #include <vfs/fifofs/fifo.h>
54 /*static int hammer_vop_vnoperate(struct vop_generic_args *);*/
55 static int hammer_vop_fsync(struct vop_fsync_args *);
56 static int hammer_vop_read(struct vop_read_args *);
57 static int hammer_vop_write(struct vop_write_args *);
58 static int hammer_vop_access(struct vop_access_args *);
59 static int hammer_vop_advlock(struct vop_advlock_args *);
60 static int hammer_vop_close(struct vop_close_args *);
61 static int hammer_vop_ncreate(struct vop_ncreate_args *);
62 static int hammer_vop_getattr(struct vop_getattr_args *);
63 static int hammer_vop_nresolve(struct vop_nresolve_args *);
64 static int hammer_vop_nlookupdotdot(struct vop_nlookupdotdot_args *);
65 static int hammer_vop_nlink(struct vop_nlink_args *);
66 static int hammer_vop_nmkdir(struct vop_nmkdir_args *);
67 static int hammer_vop_nmknod(struct vop_nmknod_args *);
68 static int hammer_vop_open(struct vop_open_args *);
69 static int hammer_vop_pathconf(struct vop_pathconf_args *);
70 static int hammer_vop_print(struct vop_print_args *);
71 static int hammer_vop_readdir(struct vop_readdir_args *);
72 static int hammer_vop_readlink(struct vop_readlink_args *);
73 static int hammer_vop_nremove(struct vop_nremove_args *);
74 static int hammer_vop_nrename(struct vop_nrename_args *);
75 static int hammer_vop_nrmdir(struct vop_nrmdir_args *);
76 static int hammer_vop_setattr(struct vop_setattr_args *);
77 static int hammer_vop_strategy(struct vop_strategy_args *);
78 static int hammer_vop_nsymlink(struct vop_nsymlink_args *);
79 static int hammer_vop_nwhiteout(struct vop_nwhiteout_args *);
81 static int hammer_vop_fifoclose (struct vop_close_args *);
82 static int hammer_vop_fiforead (struct vop_read_args *);
83 static int hammer_vop_fifowrite (struct vop_write_args *);
85 static int hammer_vop_specclose (struct vop_close_args *);
86 static int hammer_vop_specread (struct vop_read_args *);
87 static int hammer_vop_specwrite (struct vop_write_args *);
89 struct vop_ops hammer_vnode_vops = {
90 .vop_default = vop_defaultop,
91 .vop_fsync = hammer_vop_fsync,
92 .vop_getpages = vop_stdgetpages,
93 .vop_putpages = vop_stdputpages,
94 .vop_read = hammer_vop_read,
95 .vop_write = hammer_vop_write,
96 .vop_access = hammer_vop_access,
97 .vop_advlock = hammer_vop_advlock,
98 .vop_close = hammer_vop_close,
99 .vop_ncreate = hammer_vop_ncreate,
100 .vop_getattr = hammer_vop_getattr,
101 .vop_inactive = hammer_vop_inactive,
102 .vop_reclaim = hammer_vop_reclaim,
103 .vop_nresolve = hammer_vop_nresolve,
104 .vop_nlookupdotdot = hammer_vop_nlookupdotdot,
105 .vop_nlink = hammer_vop_nlink,
106 .vop_nmkdir = hammer_vop_nmkdir,
107 .vop_nmknod = hammer_vop_nmknod,
108 .vop_open = hammer_vop_open,
109 .vop_pathconf = hammer_vop_pathconf,
110 .vop_print = hammer_vop_print,
111 .vop_readdir = hammer_vop_readdir,
112 .vop_readlink = hammer_vop_readlink,
113 .vop_nremove = hammer_vop_nremove,
114 .vop_nrename = hammer_vop_nrename,
115 .vop_nrmdir = hammer_vop_nrmdir,
116 .vop_setattr = hammer_vop_setattr,
117 .vop_strategy = hammer_vop_strategy,
118 .vop_nsymlink = hammer_vop_nsymlink,
119 .vop_nwhiteout = hammer_vop_nwhiteout
122 struct vop_ops hammer_spec_vops = {
123 .vop_default = spec_vnoperate,
124 .vop_fsync = hammer_vop_fsync,
125 .vop_read = hammer_vop_specread,
126 .vop_write = hammer_vop_specwrite,
127 .vop_access = hammer_vop_access,
128 .vop_close = hammer_vop_specclose,
129 .vop_getattr = hammer_vop_getattr,
130 .vop_inactive = hammer_vop_inactive,
131 .vop_reclaim = hammer_vop_reclaim,
132 .vop_setattr = hammer_vop_setattr
135 struct vop_ops hammer_fifo_vops = {
136 .vop_default = fifo_vnoperate,
137 .vop_fsync = hammer_vop_fsync,
138 .vop_read = hammer_vop_fiforead,
139 .vop_write = hammer_vop_fifowrite,
140 .vop_access = hammer_vop_access,
141 .vop_close = hammer_vop_fifoclose,
142 .vop_getattr = hammer_vop_getattr,
143 .vop_inactive = hammer_vop_inactive,
144 .vop_reclaim = hammer_vop_reclaim,
145 .vop_setattr = hammer_vop_setattr
148 static int hammer_dounlink(struct nchandle *nch, struct vnode *dvp,
149 struct ucred *cred, int flags);
150 static int hammer_vop_strategy_read(struct vop_strategy_args *ap);
151 static int hammer_vop_strategy_write(struct vop_strategy_args *ap);
156 hammer_vop_vnoperate(struct vop_generic_args *)
158 return (VOCALL(&hammer_vnode_vops, ap));
163 * hammer_vop_fsync { vp, waitfor }
167 hammer_vop_fsync(struct vop_fsync_args *ap)
173 error = hammer_sync_inode(ip, ap->a_waitfor, 0);
178 * hammer_vop_read { vp, uio, ioflag, cred }
182 hammer_vop_read(struct vop_read_args *ap)
184 struct hammer_transaction trans;
193 if (ap->a_vp->v_type != VREG)
197 seqcount = ap->a_ioflag >> 16;
199 hammer_start_transaction(&trans, ip->hmp);
202 * Access the data in HAMMER_BUFSIZE blocks via the buffer cache.
205 while (uio->uio_resid > 0 && uio->uio_offset < ip->ino_rec.ino_size) {
206 offset = uio->uio_offset & HAMMER_BUFMASK;
208 error = cluster_read(ap->a_vp, ip->ino_rec.ino_size,
209 uio->uio_offset - offset, HAMMER_BUFSIZE,
210 MAXBSIZE, seqcount, &bp);
212 error = bread(ap->a_vp, uio->uio_offset - offset,
213 HAMMER_BUFSIZE, &bp);
218 /* bp->b_flags |= B_CLUSTEROK; temporarily disabled */
219 n = HAMMER_BUFSIZE - offset;
220 if (n > uio->uio_resid)
222 if (n > ip->ino_rec.ino_size - uio->uio_offset)
223 n = (int)(ip->ino_rec.ino_size - uio->uio_offset);
224 error = uiomove((char *)bp->b_data + offset, n, uio);
229 if ((ip->flags & HAMMER_INODE_RO) == 0) {
230 ip->ino_rec.ino_atime = trans.tid;
231 hammer_modify_inode(&trans, ip, HAMMER_INODE_ITIMES);
235 hammer_commit_transaction(&trans);
240 * hammer_vop_write { vp, uio, ioflag, cred }
244 hammer_vop_write(struct vop_write_args *ap)
246 struct hammer_transaction trans;
247 struct hammer_inode *ip;
255 if (ap->a_vp->v_type != VREG)
260 if (ip->flags & HAMMER_INODE_RO)
264 * Create a transaction to cover the operations we perform.
266 hammer_start_transaction(&trans, ip->hmp);
272 if (ap->a_ioflag & IO_APPEND)
273 uio->uio_offset = ip->ino_rec.ino_size;
276 * Check for illegal write offsets. Valid range is 0...2^63-1
278 if (uio->uio_offset < 0 || uio->uio_offset + uio->uio_resid <= 0) {
279 hammer_commit_transaction(&trans);
284 * Access the data in HAMMER_BUFSIZE blocks via the buffer cache.
286 while (uio->uio_resid > 0) {
287 offset = uio->uio_offset & HAMMER_BUFMASK;
288 if (uio->uio_segflg == UIO_NOCOPY) {
290 * Issuing a write with the same data backing the
291 * buffer. Instantiate the buffer to collect the
292 * backing vm pages, then read-in any missing bits.
294 * This case is used by vop_stdputpages().
296 bp = getblk(ap->a_vp, uio->uio_offset, HAMMER_BUFSIZE,
298 if ((bp->b_flags & B_CACHE) == 0) {
300 error = bread(ap->a_vp,
301 uio->uio_offset - offset,
302 HAMMER_BUFSIZE, &bp);
308 } else if (offset == 0 && uio->uio_resid >= HAMMER_BUFSIZE) {
310 * entirely overwrite the buffer
312 bp = getblk(ap->a_vp, uio->uio_offset, HAMMER_BUFSIZE,
314 } else if (offset == 0 && uio->uio_offset >= ip->ino_rec.ino_size) {
318 bp = getblk(ap->a_vp, uio->uio_offset, HAMMER_BUFSIZE,
323 * Partial overwrite, read in any missing bits then
324 * replace the portion being written.
326 error = bread(ap->a_vp, uio->uio_offset - offset,
327 HAMMER_BUFSIZE, &bp);
333 n = HAMMER_BUFSIZE - offset;
334 if (n > uio->uio_resid)
336 error = uiomove((char *)bp->b_data + offset, n, uio);
341 /* bp->b_flags |= B_CLUSTEROK; temporarily disabled */
342 if (ip->ino_rec.ino_size < uio->uio_offset) {
343 ip->ino_rec.ino_size = uio->uio_offset;
344 flags = HAMMER_INODE_RDIRTY;
345 vnode_pager_setsize(ap->a_vp, ip->ino_rec.ino_size);
349 ip->ino_rec.ino_mtime = trans.tid;
350 flags |= HAMMER_INODE_ITIMES;
351 hammer_modify_inode(&trans, ip, flags);
352 if (ap->a_ioflag & IO_SYNC) {
354 } else if (ap->a_ioflag & IO_DIRECT) {
361 hammer_abort_transaction(&trans);
363 hammer_commit_transaction(&trans);
368 * hammer_vop_access { vp, mode, cred }
372 hammer_vop_access(struct vop_access_args *ap)
374 struct hammer_inode *ip = VTOI(ap->a_vp);
379 uid = hammer_to_unix_xid(&ip->ino_data.uid);
380 gid = hammer_to_unix_xid(&ip->ino_data.gid);
382 error = vop_helper_access(ap, uid, gid, ip->ino_data.mode,
383 ip->ino_data.uflags);
388 * hammer_vop_advlock { vp, id, op, fl, flags }
392 hammer_vop_advlock(struct vop_advlock_args *ap)
394 struct hammer_inode *ip = VTOI(ap->a_vp);
396 return (lf_advlock(ap, &ip->advlock, ip->ino_rec.ino_size));
400 * hammer_vop_close { vp, fflag }
404 hammer_vop_close(struct vop_close_args *ap)
406 return (vop_stdclose(ap));
410 * hammer_vop_ncreate { nch, dvp, vpp, cred, vap }
412 * The operating system has already ensured that the directory entry
413 * does not exist and done all appropriate namespace locking.
417 hammer_vop_ncreate(struct vop_ncreate_args *ap)
419 struct hammer_transaction trans;
420 struct hammer_inode *dip;
421 struct hammer_inode *nip;
422 struct nchandle *nch;
426 dip = VTOI(ap->a_dvp);
428 if (dip->flags & HAMMER_INODE_RO)
432 * Create a transaction to cover the operations we perform.
434 hammer_start_transaction(&trans, dip->hmp);
437 * Create a new filesystem object of the requested type. The
438 * returned inode will be referenced but not locked.
441 error = hammer_create_inode(&trans, ap->a_vap, ap->a_cred, dip, &nip);
443 kprintf("hammer_create_inode error %d\n", error);
445 hammer_abort_transaction(&trans);
451 * Add the new filesystem object to the directory. This will also
452 * bump the inode's link count.
454 error = hammer_ip_add_directory(&trans, dip, nch->ncp, nip);
456 kprintf("hammer_ip_add_directory error %d\n", error);
462 hammer_rel_inode(nip, 0);
463 hammer_abort_transaction(&trans);
466 hammer_commit_transaction(&trans);
467 error = hammer_get_vnode(nip, LK_EXCLUSIVE, ap->a_vpp);
468 hammer_rel_inode(nip, 0);
470 cache_setunresolved(ap->a_nch);
471 cache_setvp(ap->a_nch, *ap->a_vpp);
478 * hammer_vop_getattr { vp, vap }
482 hammer_vop_getattr(struct vop_getattr_args *ap)
484 struct hammer_inode *ip = VTOI(ap->a_vp);
485 struct vattr *vap = ap->a_vap;
488 if (cache_check_fsmid_vp(ap->a_vp, &ip->fsmid) &&
489 (vp->v_mount->mnt_flag & MNT_RDONLY) == 0 &&
494 hammer_itimes(ap->a_vp);
497 vap->va_fsid = ip->hmp->fsid_udev;
498 vap->va_fileid = ip->ino_rec.base.base.obj_id;
499 vap->va_mode = ip->ino_data.mode;
500 vap->va_nlink = ip->ino_rec.ino_nlinks;
501 vap->va_uid = hammer_to_unix_xid(&ip->ino_data.uid);
502 vap->va_gid = hammer_to_unix_xid(&ip->ino_data.gid);
505 vap->va_size = ip->ino_rec.ino_size;
506 hammer_to_timespec(ip->ino_rec.ino_atime, &vap->va_atime);
507 hammer_to_timespec(ip->ino_rec.ino_mtime, &vap->va_mtime);
508 hammer_to_timespec(ip->ino_data.ctime, &vap->va_ctime);
509 vap->va_flags = ip->ino_data.uflags;
510 vap->va_gen = 1; /* hammer inums are unique for all time */
511 vap->va_blocksize = 32768; /* XXX - extract from root volume */
512 vap->va_bytes = ip->ino_rec.ino_size;
513 vap->va_type = hammer_get_vnode_type(ip->ino_rec.base.base.obj_type);
514 vap->va_filerev = 0; /* XXX */
515 /* mtime uniquely identifies any adjustments made to the file */
516 vap->va_fsmid = ip->ino_rec.ino_mtime;
517 vap->va_uid_uuid = ip->ino_data.uid;
518 vap->va_gid_uuid = ip->ino_data.gid;
519 vap->va_fsid_uuid = ip->hmp->fsid;
520 vap->va_vaflags = VA_UID_UUID_VALID | VA_GID_UUID_VALID |
523 switch (ip->ino_rec.base.base.obj_type) {
524 case HAMMER_OBJTYPE_CDEV:
525 case HAMMER_OBJTYPE_BDEV:
526 vap->va_rmajor = ip->ino_data.rmajor;
527 vap->va_rminor = ip->ino_data.rminor;
537 * hammer_vop_nresolve { nch, dvp, cred }
539 * Locate the requested directory entry.
543 hammer_vop_nresolve(struct vop_nresolve_args *ap)
545 struct namecache *ncp;
549 struct hammer_cursor cursor;
550 union hammer_record_ondisk *rec;
559 * Misc initialization, plus handle as-of name extensions. Look for
560 * the '@@' extension. Note that as-of files and directories cannot
563 dip = VTOI(ap->a_dvp);
564 ncp = ap->a_nch->ncp;
565 asof = dip->obj_asof;
569 for (i = 0; i < nlen; ++i) {
570 if (ncp->nc_name[i] == '@' && ncp->nc_name[i+1] == '@') {
571 asof = hammer_str_to_tid(ncp->nc_name + i + 2);
572 kprintf("ASOF %016llx\n", asof);
573 flags |= HAMMER_INODE_RO;
580 * If there is no path component the time extension is relative to
584 ip = hammer_get_inode(dip->hmp, dip->obj_id, asof,
587 error = hammer_get_vnode(ip, LK_EXCLUSIVE, &vp);
588 hammer_rel_inode(ip, 0);
594 cache_setvp(ap->a_nch, vp);
601 * Calculate the namekey and setup the key range for the scan. This
602 * works kinda like a chained hash table where the lower 32 bits
603 * of the namekey synthesize the chain.
605 * The key range is inclusive of both key_beg and key_end.
607 namekey = hammer_directory_namekey(ncp->nc_name, nlen);
609 hammer_init_cursor_ip(&cursor, dip);
610 cursor.key_beg.obj_id = dip->obj_id;
611 cursor.key_beg.key = namekey;
612 cursor.key_beg.create_tid = asof;
613 cursor.key_beg.delete_tid = 0;
614 cursor.key_beg.rec_type = HAMMER_RECTYPE_DIRENTRY;
615 cursor.key_beg.obj_type = 0;
617 cursor.key_end = cursor.key_beg;
618 cursor.key_end.key |= 0xFFFFFFFFULL;
619 cursor.flags |= HAMMER_CURSOR_END_INCLUSIVE;
622 * Scan all matching records (the chain), locate the one matching
623 * the requested path component.
625 * The hammer_ip_*() functions merge in-memory records with on-disk
626 * records for the purposes of the search.
628 error = hammer_ip_first(&cursor, dip);
631 error = hammer_ip_resolve_data(&cursor);
635 if (nlen == rec->entry.base.data_len &&
636 bcmp(ncp->nc_name, cursor.data, nlen) == 0) {
639 error = hammer_ip_next(&cursor);
642 ip = hammer_get_inode(dip->hmp, rec->entry.obj_id, asof,
645 error = hammer_get_vnode(ip, LK_EXCLUSIVE, &vp);
646 hammer_rel_inode(ip, 0);
652 cache_setvp(ap->a_nch, vp);
655 } else if (error == ENOENT) {
656 cache_setvp(ap->a_nch, NULL);
658 hammer_done_cursor(&cursor);
663 * hammer_vop_nlookupdotdot { dvp, vpp, cred }
665 * Locate the parent directory of a directory vnode.
667 * dvp is referenced but not locked. *vpp must be returned referenced and
668 * locked. A parent_obj_id of 0 does not necessarily indicate that we are
669 * at the root, instead it could indicate that the directory we were in was
674 hammer_vop_nlookupdotdot(struct vop_nlookupdotdot_args *ap)
676 struct hammer_inode *dip;
677 struct hammer_inode *ip;
678 u_int64_t parent_obj_id;
681 dip = VTOI(ap->a_dvp);
682 if ((parent_obj_id = dip->ino_data.parent_obj_id) == 0) {
687 ip = hammer_get_inode(dip->hmp, parent_obj_id, dip->obj_asof,
693 error = hammer_get_vnode(ip, LK_EXCLUSIVE, ap->a_vpp);
694 hammer_rel_inode(ip, 0);
699 * hammer_vop_nlink { nch, dvp, vp, cred }
703 hammer_vop_nlink(struct vop_nlink_args *ap)
705 struct hammer_transaction trans;
706 struct hammer_inode *dip;
707 struct hammer_inode *ip;
708 struct nchandle *nch;
712 dip = VTOI(ap->a_dvp);
715 if (dip->flags & HAMMER_INODE_RO)
717 if (ip->flags & HAMMER_INODE_RO)
721 * Create a transaction to cover the operations we perform.
723 hammer_start_transaction(&trans, dip->hmp);
726 * Add the filesystem object to the directory. Note that neither
727 * dip nor ip are referenced or locked, but their vnodes are
728 * referenced. This function will bump the inode's link count.
730 error = hammer_ip_add_directory(&trans, dip, nch->ncp, ip);
736 hammer_abort_transaction(&trans);
738 cache_setunresolved(nch);
739 cache_setvp(nch, ap->a_vp);
740 hammer_commit_transaction(&trans);
746 * hammer_vop_nmkdir { nch, dvp, vpp, cred, vap }
748 * The operating system has already ensured that the directory entry
749 * does not exist and done all appropriate namespace locking.
753 hammer_vop_nmkdir(struct vop_nmkdir_args *ap)
755 struct hammer_transaction trans;
756 struct hammer_inode *dip;
757 struct hammer_inode *nip;
758 struct nchandle *nch;
762 dip = VTOI(ap->a_dvp);
764 if (dip->flags & HAMMER_INODE_RO)
768 * Create a transaction to cover the operations we perform.
770 hammer_start_transaction(&trans, dip->hmp);
773 * Create a new filesystem object of the requested type. The
774 * returned inode will be referenced but not locked.
776 error = hammer_create_inode(&trans, ap->a_vap, ap->a_cred, dip, &nip);
778 kprintf("hammer_mkdir error %d\n", error);
780 hammer_abort_transaction(&trans);
786 * Add the new filesystem object to the directory. This will also
787 * bump the inode's link count.
789 error = hammer_ip_add_directory(&trans, dip, nch->ncp, nip);
791 kprintf("hammer_mkdir (add) error %d\n", error);
797 hammer_rel_inode(nip, 0);
798 hammer_abort_transaction(&trans);
801 hammer_commit_transaction(&trans);
802 error = hammer_get_vnode(nip, LK_EXCLUSIVE, ap->a_vpp);
803 hammer_rel_inode(nip, 0);
805 cache_setunresolved(ap->a_nch);
806 cache_setvp(ap->a_nch, *ap->a_vpp);
813 * hammer_vop_nmknod { nch, dvp, vpp, cred, vap }
815 * The operating system has already ensured that the directory entry
816 * does not exist and done all appropriate namespace locking.
820 hammer_vop_nmknod(struct vop_nmknod_args *ap)
822 struct hammer_transaction trans;
823 struct hammer_inode *dip;
824 struct hammer_inode *nip;
825 struct nchandle *nch;
829 dip = VTOI(ap->a_dvp);
831 if (dip->flags & HAMMER_INODE_RO)
835 * Create a transaction to cover the operations we perform.
837 hammer_start_transaction(&trans, dip->hmp);
840 * Create a new filesystem object of the requested type. The
841 * returned inode will be referenced but not locked.
843 error = hammer_create_inode(&trans, ap->a_vap, ap->a_cred, dip, &nip);
845 hammer_abort_transaction(&trans);
851 * Add the new filesystem object to the directory. This will also
852 * bump the inode's link count.
854 error = hammer_ip_add_directory(&trans, dip, nch->ncp, nip);
860 hammer_rel_inode(nip, 0);
861 hammer_abort_transaction(&trans);
864 hammer_commit_transaction(&trans);
865 error = hammer_get_vnode(nip, LK_EXCLUSIVE, ap->a_vpp);
866 hammer_rel_inode(nip, 0);
868 cache_setunresolved(ap->a_nch);
869 cache_setvp(ap->a_nch, *ap->a_vpp);
876 * hammer_vop_open { vp, mode, cred, fp }
880 hammer_vop_open(struct vop_open_args *ap)
882 if ((ap->a_mode & FWRITE) && (VTOI(ap->a_vp)->flags & HAMMER_INODE_RO))
885 return(vop_stdopen(ap));
889 * hammer_vop_pathconf { vp, name, retval }
893 hammer_vop_pathconf(struct vop_pathconf_args *ap)
899 * hammer_vop_print { vp }
903 hammer_vop_print(struct vop_print_args *ap)
909 * hammer_vop_readdir { vp, uio, cred, *eofflag, *ncookies, off_t **cookies }
913 hammer_vop_readdir(struct vop_readdir_args *ap)
915 struct hammer_cursor cursor;
916 struct hammer_inode *ip;
918 hammer_record_ondisk_t rec;
919 hammer_base_elm_t base;
929 saveoff = uio->uio_offset;
931 if (ap->a_ncookies) {
932 ncookies = uio->uio_resid / 16 + 1;
935 cookies = kmalloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK);
944 * Handle artificial entries
948 r = vop_write_dirent(&error, uio, ip->obj_id, DT_DIR, 1, ".");
952 cookies[cookie_index] = saveoff;
955 if (cookie_index == ncookies)
959 if (ip->ino_data.parent_obj_id) {
960 r = vop_write_dirent(&error, uio,
961 ip->ino_data.parent_obj_id,
964 r = vop_write_dirent(&error, uio,
965 ip->obj_id, DT_DIR, 2, "..");
970 cookies[cookie_index] = saveoff;
973 if (cookie_index == ncookies)
978 * Key range (begin and end inclusive) to scan. Directory keys
979 * directly translate to a 64 bit 'seek' position.
981 hammer_init_cursor_ip(&cursor, ip);
982 cursor.key_beg.obj_id = ip->obj_id;
983 cursor.key_beg.create_tid = ip->obj_asof;
984 cursor.key_beg.delete_tid = 0;
985 cursor.key_beg.rec_type = HAMMER_RECTYPE_DIRENTRY;
986 cursor.key_beg.obj_type = 0;
987 cursor.key_beg.key = saveoff;
989 cursor.key_end = cursor.key_beg;
990 cursor.key_end.key = HAMMER_MAX_KEY;
991 cursor.flags |= HAMMER_CURSOR_END_INCLUSIVE;
993 error = hammer_ip_first(&cursor, ip);
996 error = hammer_ip_resolve_data(&cursor);
1000 base = &rec->base.base;
1001 saveoff = base->key;
1003 if (base->obj_id != ip->obj_id)
1004 panic("readdir: bad record at %p", cursor.node);
1006 r = vop_write_dirent(
1007 &error, uio, rec->entry.obj_id,
1008 hammer_get_dtype(rec->entry.base.base.obj_type),
1009 rec->entry.base.data_len,
1010 (void *)cursor.data);
1015 cookies[cookie_index] = base->key;
1017 if (cookie_index == ncookies)
1019 error = hammer_ip_next(&cursor);
1021 hammer_done_cursor(&cursor);
1025 *ap->a_eofflag = (error == ENOENT);
1026 uio->uio_offset = saveoff;
1027 if (error && cookie_index == 0) {
1028 if (error == ENOENT)
1031 kfree(cookies, M_TEMP);
1032 *ap->a_ncookies = 0;
1033 *ap->a_cookies = NULL;
1036 if (error == ENOENT)
1039 *ap->a_ncookies = cookie_index;
1040 *ap->a_cookies = cookies;
1047 * hammer_vop_readlink { vp, uio, cred }
1051 hammer_vop_readlink(struct vop_readlink_args *ap)
1053 struct hammer_cursor cursor;
1054 struct hammer_inode *ip;
1057 ip = VTOI(ap->a_vp);
1058 hammer_init_cursor_ip(&cursor, ip);
1061 * Key range (begin and end inclusive) to scan. Directory keys
1062 * directly translate to a 64 bit 'seek' position.
1064 cursor.key_beg.obj_id = ip->obj_id;
1065 cursor.key_beg.create_tid = ip->obj_asof;
1066 cursor.key_beg.delete_tid = 0;
1067 cursor.key_beg.rec_type = HAMMER_RECTYPE_FIX;
1068 cursor.key_beg.obj_type = 0;
1069 cursor.key_beg.key = HAMMER_FIXKEY_SYMLINK;
1071 error = hammer_ip_lookup(&cursor, ip);
1073 error = hammer_ip_resolve_data(&cursor);
1075 error = uiomove((char *)cursor.data,
1076 cursor.record->generic.base.data_len,
1080 hammer_done_cursor(&cursor);
1085 * hammer_vop_nremove { nch, dvp, cred }
1089 hammer_vop_nremove(struct vop_nremove_args *ap)
1091 return(hammer_dounlink(ap->a_nch, ap->a_dvp, ap->a_cred, 0));
1095 * hammer_vop_nrename { fnch, tnch, fdvp, tdvp, cred }
1099 hammer_vop_nrename(struct vop_nrename_args *ap)
1101 struct hammer_transaction trans;
1102 struct namecache *fncp;
1103 struct namecache *tncp;
1104 struct hammer_inode *fdip;
1105 struct hammer_inode *tdip;
1106 struct hammer_inode *ip;
1107 struct hammer_cursor cursor;
1108 union hammer_record_ondisk *rec;
1112 fdip = VTOI(ap->a_fdvp);
1113 tdip = VTOI(ap->a_tdvp);
1114 fncp = ap->a_fnch->ncp;
1115 tncp = ap->a_tnch->ncp;
1116 ip = VTOI(fncp->nc_vp);
1117 KKASSERT(ip != NULL);
1119 if (fdip->flags & HAMMER_INODE_RO)
1121 if (tdip->flags & HAMMER_INODE_RO)
1123 if (ip->flags & HAMMER_INODE_RO)
1126 hammer_start_transaction(&trans, fdip->hmp);
1129 * Remove tncp from the target directory and then link ip as
1130 * tncp. XXX pass trans to dounlink
1132 error = hammer_dounlink(ap->a_tnch, ap->a_tdvp, ap->a_cred, 0);
1133 if (error == 0 || error == ENOENT)
1134 error = hammer_ip_add_directory(&trans, tdip, tncp, ip);
1136 goto failed; /* XXX */
1139 * Locate the record in the originating directory and remove it.
1141 * Calculate the namekey and setup the key range for the scan. This
1142 * works kinda like a chained hash table where the lower 32 bits
1143 * of the namekey synthesize the chain.
1145 * The key range is inclusive of both key_beg and key_end.
1147 namekey = hammer_directory_namekey(fncp->nc_name, fncp->nc_nlen);
1149 hammer_init_cursor_ip(&cursor, fdip);
1150 cursor.key_beg.obj_id = fdip->obj_id;
1151 cursor.key_beg.key = namekey;
1152 cursor.key_beg.create_tid = fdip->obj_asof;
1153 cursor.key_beg.delete_tid = 0;
1154 cursor.key_beg.rec_type = HAMMER_RECTYPE_DIRENTRY;
1155 cursor.key_beg.obj_type = 0;
1157 cursor.key_end = cursor.key_beg;
1158 cursor.key_end.key |= 0xFFFFFFFFULL;
1159 cursor.flags |= HAMMER_CURSOR_END_INCLUSIVE;
1162 * Scan all matching records (the chain), locate the one matching
1163 * the requested path component.
1165 * The hammer_ip_*() functions merge in-memory records with on-disk
1166 * records for the purposes of the search.
1168 error = hammer_ip_first(&cursor, fdip);
1169 while (error == 0) {
1170 if (hammer_ip_resolve_data(&cursor) != 0)
1172 rec = cursor.record;
1173 if (fncp->nc_nlen == rec->entry.base.data_len &&
1174 bcmp(fncp->nc_name, cursor.data, fncp->nc_nlen) == 0) {
1177 error = hammer_ip_next(&cursor);
1181 * If all is ok we have to get the inode so we can adjust nlinks.
1185 error = hammer_ip_del_directory(&trans, &cursor, fdip, ip);
1188 cache_rename(ap->a_fnch, ap->a_tnch);
1189 cache_setvp(ap->a_tnch, ip->vp);
1192 hammer_done_cursor(&cursor);
1195 hammer_commit_transaction(&trans);
1197 hammer_abort_transaction(&trans);
1203 * hammer_vop_nrmdir { nch, dvp, cred }
1207 hammer_vop_nrmdir(struct vop_nrmdir_args *ap)
1209 return(hammer_dounlink(ap->a_nch, ap->a_dvp, ap->a_cred, 0));
1213 * hammer_vop_setattr { vp, vap, cred }
1217 hammer_vop_setattr(struct vop_setattr_args *ap)
1219 struct hammer_transaction trans;
1220 struct hammer_cursor *spike = NULL;
1222 struct hammer_inode *ip;
1225 int64_t aligned_size;
1230 ip = ap->a_vp->v_data;
1233 if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
1235 if (ip->flags & HAMMER_INODE_RO)
1238 hammer_start_transaction(&trans, ip->hmp);
1241 if (vap->va_flags != VNOVAL) {
1242 flags = ip->ino_data.uflags;
1243 error = vop_helper_setattr_flags(&flags, vap->va_flags,
1244 hammer_to_unix_xid(&ip->ino_data.uid),
1247 if (ip->ino_data.uflags != flags) {
1248 ip->ino_data.uflags = flags;
1249 modflags |= HAMMER_INODE_DDIRTY;
1251 if (ip->ino_data.uflags & (IMMUTABLE | APPEND)) {
1258 if (ip->ino_data.uflags & (IMMUTABLE | APPEND)) {
1262 if (vap->va_uid != (uid_t)VNOVAL) {
1263 hammer_guid_to_uuid(&uuid, vap->va_uid);
1264 if (bcmp(&uuid, &ip->ino_data.uid, sizeof(uuid)) != 0) {
1265 ip->ino_data.uid = uuid;
1266 modflags |= HAMMER_INODE_DDIRTY;
1269 if (vap->va_gid != (uid_t)VNOVAL) {
1270 hammer_guid_to_uuid(&uuid, vap->va_gid);
1271 if (bcmp(&uuid, &ip->ino_data.gid, sizeof(uuid)) != 0) {
1272 ip->ino_data.gid = uuid;
1273 modflags |= HAMMER_INODE_DDIRTY;
1276 while (vap->va_size != VNOVAL && ip->ino_rec.ino_size != vap->va_size) {
1277 switch(ap->a_vp->v_type) {
1279 if (vap->va_size < ip->ino_rec.ino_size) {
1280 vtruncbuf(ap->a_vp, vap->va_size,
1282 } else if (vap->va_size > ip->ino_rec.ino_size) {
1283 vnode_pager_setsize(ap->a_vp, vap->va_size);
1285 aligned_size = (vap->va_size + HAMMER_BUFMASK) &
1286 ~(int64_t)HAMMER_BUFMASK;
1287 error = hammer_ip_delete_range(&trans, ip,
1289 0x7FFFFFFFFFFFFFFFLL,
1291 ip->ino_rec.ino_size = vap->va_size;
1292 modflags |= HAMMER_INODE_RDIRTY;
1295 error = hammer_ip_delete_range(&trans, ip,
1297 0x7FFFFFFFFFFFFFFFLL,
1299 ip->ino_rec.ino_size = vap->va_size;
1300 modflags |= HAMMER_INODE_RDIRTY;
1306 if (error == ENOSPC) {
1307 error = hammer_spike(&spike);
1311 KKASSERT(spike == NULL);
1314 if (vap->va_atime.tv_sec != VNOVAL) {
1315 ip->ino_rec.ino_atime =
1316 hammer_timespec_to_transid(&vap->va_atime);
1317 modflags |= HAMMER_INODE_ITIMES;
1319 if (vap->va_mtime.tv_sec != VNOVAL) {
1320 ip->ino_rec.ino_mtime =
1321 hammer_timespec_to_transid(&vap->va_mtime);
1322 modflags |= HAMMER_INODE_ITIMES;
1324 if (vap->va_mode != (mode_t)VNOVAL) {
1325 if (ip->ino_data.mode != vap->va_mode) {
1326 ip->ino_data.mode = vap->va_mode;
1327 modflags |= HAMMER_INODE_DDIRTY;
1332 hammer_abort_transaction(&trans);
1334 hammer_modify_inode(&trans, ip, modflags);
1335 hammer_commit_transaction(&trans);
1341 * hammer_vop_nsymlink { nch, dvp, vpp, cred, vap, target }
1345 hammer_vop_nsymlink(struct vop_nsymlink_args *ap)
1347 struct hammer_transaction trans;
1348 struct hammer_inode *dip;
1349 struct hammer_inode *nip;
1350 struct nchandle *nch;
1351 hammer_record_t record;
1355 ap->a_vap->va_type = VLNK;
1358 dip = VTOI(ap->a_dvp);
1360 if (dip->flags & HAMMER_INODE_RO)
1364 * Create a transaction to cover the operations we perform.
1366 hammer_start_transaction(&trans, dip->hmp);
1369 * Create a new filesystem object of the requested type. The
1370 * returned inode will be referenced but not locked.
1373 error = hammer_create_inode(&trans, ap->a_vap, ap->a_cred, dip, &nip);
1375 hammer_abort_transaction(&trans);
1381 * Add the new filesystem object to the directory. This will also
1382 * bump the inode's link count.
1384 error = hammer_ip_add_directory(&trans, dip, nch->ncp, nip);
1387 * Add a record representing the symlink. symlink stores the link
1388 * as pure data, not a string, and is no \0 terminated.
1391 record = hammer_alloc_mem_record(nip);
1392 bytes = strlen(ap->a_target);
1394 record->rec.generic.base.base.key = HAMMER_FIXKEY_SYMLINK;
1395 record->rec.generic.base.base.rec_type = HAMMER_RECTYPE_FIX;
1396 record->rec.generic.base.data_len = bytes;
1397 if (bytes <= sizeof(record->rec.generic.filler)) {
1398 record->data = (void *)record->rec.generic.filler;
1399 bcopy(ap->a_target, record->data, bytes);
1401 record->data = (void *)ap->a_target;
1402 /* will be reallocated by routine below */
1404 error = hammer_ip_add_record(&trans, record);
1411 hammer_rel_inode(nip, 0);
1412 hammer_abort_transaction(&trans);
1415 hammer_commit_transaction(&trans);
1416 error = hammer_get_vnode(nip, LK_EXCLUSIVE, ap->a_vpp);
1417 hammer_rel_inode(nip, 0);
1419 cache_setunresolved(ap->a_nch);
1420 cache_setvp(ap->a_nch, *ap->a_vpp);
1427 * hammer_vop_nwhiteout { nch, dvp, cred, flags }
1431 hammer_vop_nwhiteout(struct vop_nwhiteout_args *ap)
1433 return(hammer_dounlink(ap->a_nch, ap->a_dvp, ap->a_cred, ap->a_flags));
1437 * hammer_vop_strategy { vp, bio }
1439 * Strategy call, used for regular file read & write only. Note that the
1440 * bp may represent a cluster.
1442 * To simplify operation and allow better optimizations in the future,
1443 * this code does not make any assumptions with regards to buffer alignment
1448 hammer_vop_strategy(struct vop_strategy_args *ap)
1453 bp = ap->a_bio->bio_buf;
1457 error = hammer_vop_strategy_read(ap);
1460 error = hammer_vop_strategy_write(ap);
1466 bp->b_error = error;
1468 bp->b_flags |= B_ERROR;
1474 * Read from a regular file. Iterate the related records and fill in the
1475 * BIO/BUF. Gaps are zero-filled.
1477 * The support code in hammer_object.c should be used to deal with mixed
1478 * in-memory and on-disk records.
1484 hammer_vop_strategy_read(struct vop_strategy_args *ap)
1486 struct hammer_inode *ip = ap->a_vp->v_data;
1487 struct hammer_cursor cursor;
1488 hammer_record_ondisk_t rec;
1489 hammer_base_elm_t base;
1503 hammer_init_cursor_ip(&cursor, ip);
1506 * Key range (begin and end inclusive) to scan. Note that the key's
1507 * stored in the actual records represent BASE+LEN, not BASE. The
1508 * first record containing bio_offset will have a key > bio_offset.
1510 cursor.key_beg.obj_id = ip->obj_id;
1511 cursor.key_beg.create_tid = ip->obj_asof;
1512 cursor.key_beg.delete_tid = 0;
1513 cursor.key_beg.obj_type = 0;
1514 cursor.key_beg.key = bio->bio_offset + 1;
1516 cursor.key_end = cursor.key_beg;
1517 if (ip->ino_rec.base.base.obj_type == HAMMER_OBJTYPE_DBFILE) {
1518 cursor.key_beg.rec_type = HAMMER_RECTYPE_DB;
1519 cursor.key_end.rec_type = HAMMER_RECTYPE_DB;
1520 cursor.key_end.key = 0x7FFFFFFFFFFFFFFFLL;
1522 ran_end = bio->bio_offset + bp->b_bufsize;
1523 cursor.key_beg.rec_type = HAMMER_RECTYPE_DATA;
1524 cursor.key_end.rec_type = HAMMER_RECTYPE_DATA;
1525 tmp64 = ran_end + MAXPHYS + 1; /* work-around GCC-4 bug */
1526 if (tmp64 < ran_end)
1527 cursor.key_end.key = 0x7FFFFFFFFFFFFFFFLL;
1529 cursor.key_end.key = ran_end + MAXPHYS + 1;
1531 cursor.flags |= HAMMER_CURSOR_END_INCLUSIVE;
1533 error = hammer_ip_first(&cursor, ip);
1536 while (error == 0) {
1537 error = hammer_ip_resolve_data(&cursor);
1540 rec = cursor.record;
1541 base = &rec->base.base;
1543 rec_offset = base->key - rec->data.base.data_len;
1546 * Calculate the gap, if any, and zero-fill it.
1548 n = (int)(rec_offset - (bio->bio_offset + boff));
1550 if (n > bp->b_bufsize - boff)
1551 n = bp->b_bufsize - boff;
1552 kprintf("zfill %d bytes\n", n);
1553 bzero((char *)bp->b_data + boff, n);
1559 * Calculate the data offset in the record and the number
1560 * of bytes we can copy.
1562 * Note there is a degenerate case here where boff may
1563 * already be at bp->b_bufsize.
1566 n = rec->data.base.data_len - roff;
1568 if (n > bp->b_bufsize - boff)
1569 n = bp->b_bufsize - boff;
1570 bcopy((char *)cursor.data + roff, (char *)bp->b_data + boff, n);
1572 if (boff == bp->b_bufsize)
1574 error = hammer_ip_next(&cursor);
1576 hammer_done_cursor(&cursor);
1579 * There may have been a gap after the last record
1581 if (error == ENOENT)
1583 if (error == 0 && boff != bp->b_bufsize) {
1584 KKASSERT(boff < bp->b_bufsize);
1585 bzero((char *)bp->b_data + boff, bp->b_bufsize - boff);
1586 /* boff = bp->b_bufsize; */
1593 * Write to a regular file. Iterate the related records and mark for
1594 * deletion. If existing edge records (left and right side) overlap our
1595 * write they have to be marked deleted and new records created, usually
1596 * referencing a portion of the original data. Then add a record to
1597 * represent the buffer.
1599 * The support code in hammer_object.c should be used to deal with mixed
1600 * in-memory and on-disk records.
1604 hammer_vop_strategy_write(struct vop_strategy_args *ap)
1606 struct hammer_transaction trans;
1607 struct hammer_cursor *spike = NULL;
1615 ip = ap->a_vp->v_data;
1617 if (ip->flags & HAMMER_INODE_RO)
1620 hammer_start_transaction(&trans, ip->hmp);
1624 * Delete any records overlapping our range. This function will
1625 * (eventually) properly truncate partial overlaps.
1627 if (ip->ino_rec.base.base.obj_type == HAMMER_OBJTYPE_DBFILE) {
1628 error = hammer_ip_delete_range(&trans, ip, bio->bio_offset,
1629 bio->bio_offset, &spike);
1631 error = hammer_ip_delete_range(&trans, ip, bio->bio_offset,
1638 * Add a single record to cover the write
1641 error = hammer_ip_sync_data(&trans, ip, bio->bio_offset,
1642 bp->b_data, bp->b_bufsize,
1647 * If we ran out of space the spike structure will be filled in
1648 * and we must call hammer_spike with it, then retry.
1650 if (error == ENOSPC) {
1651 error = hammer_spike(&spike);
1655 KKASSERT(spike == NULL);
1658 * If an error occured abort the transaction
1661 /* XXX undo deletion */
1662 hammer_abort_transaction(&trans);
1663 bp->b_resid = bp->b_bufsize;
1665 hammer_commit_transaction(&trans);
1672 * dounlink - disconnect a directory entry
1674 * XXX whiteout support not really in yet
1677 hammer_dounlink(struct nchandle *nch, struct vnode *dvp, struct ucred *cred,
1680 struct hammer_transaction trans;
1681 struct namecache *ncp;
1684 hammer_record_ondisk_t rec;
1685 struct hammer_cursor cursor;
1690 * Calculate the namekey and setup the key range for the scan. This
1691 * works kinda like a chained hash table where the lower 32 bits
1692 * of the namekey synthesize the chain.
1694 * The key range is inclusive of both key_beg and key_end.
1699 if (dip->flags & HAMMER_INODE_RO)
1702 namekey = hammer_directory_namekey(ncp->nc_name, ncp->nc_nlen);
1704 hammer_init_cursor_ip(&cursor, dip);
1705 cursor.key_beg.obj_id = dip->obj_id;
1706 cursor.key_beg.key = namekey;
1707 cursor.key_beg.create_tid = dip->obj_asof;
1708 cursor.key_beg.delete_tid = 0;
1709 cursor.key_beg.rec_type = HAMMER_RECTYPE_DIRENTRY;
1710 cursor.key_beg.obj_type = 0;
1712 cursor.key_end = cursor.key_beg;
1713 cursor.key_end.key |= 0xFFFFFFFFULL;
1714 cursor.flags |= HAMMER_CURSOR_END_INCLUSIVE;
1716 hammer_start_transaction(&trans, dip->hmp);
1719 * Scan all matching records (the chain), locate the one matching
1720 * the requested path component. info->last_error contains the
1721 * error code on search termination and could be 0, ENOENT, or
1724 * The hammer_ip_*() functions merge in-memory records with on-disk
1725 * records for the purposes of the search.
1727 error = hammer_ip_first(&cursor, dip);
1728 while (error == 0) {
1729 error = hammer_ip_resolve_data(&cursor);
1732 rec = cursor.record;
1733 if (ncp->nc_nlen == rec->entry.base.data_len &&
1734 bcmp(ncp->nc_name, cursor.data, ncp->nc_nlen) == 0) {
1737 error = hammer_ip_next(&cursor);
1741 * If all is ok we have to get the inode so we can adjust nlinks.
1743 * If the target is a directory, it must be empty.
1746 ip = hammer_get_inode(dip->hmp, rec->entry.obj_id,
1747 dip->hmp->asof, 0, &error);
1748 if (error == 0 && ip->ino_rec.base.base.obj_type ==
1749 HAMMER_OBJTYPE_DIRECTORY) {
1750 error = hammer_ip_check_directory_empty(&trans, ip);
1753 error = hammer_ip_del_directory(&trans, &cursor, dip, ip);
1755 cache_setunresolved(nch);
1756 cache_setvp(nch, NULL);
1759 cache_inval_vp(ip->vp, CINV_DESTROY);
1761 hammer_rel_inode(ip, 0);
1765 hammer_commit_transaction(&trans);
1767 hammer_abort_transaction(&trans);
1768 hammer_done_cursor(&cursor);
1772 /************************************************************************
1773 * FIFO AND SPECFS OPS *
1774 ************************************************************************
1779 hammer_vop_fifoclose (struct vop_close_args *ap)
1781 /* XXX update itimes */
1782 return (VOCALL(&fifo_vnode_vops, &ap->a_head));
1786 hammer_vop_fiforead (struct vop_read_args *ap)
1790 error = VOCALL(&fifo_vnode_vops, &ap->a_head);
1791 /* XXX update access time */
1796 hammer_vop_fifowrite (struct vop_write_args *ap)
1800 error = VOCALL(&fifo_vnode_vops, &ap->a_head);
1801 /* XXX update access time */
1806 hammer_vop_specclose (struct vop_close_args *ap)
1808 /* XXX update itimes */
1809 return (VOCALL(&spec_vnode_vops, &ap->a_head));
1813 hammer_vop_specread (struct vop_read_args *ap)
1815 /* XXX update access time */
1816 return (VOCALL(&spec_vnode_vops, &ap->a_head));
1820 hammer_vop_specwrite (struct vop_write_args *ap)
1822 /* XXX update last change time */
1823 return (VOCALL(&spec_vnode_vops, &ap->a_head));