Print this page
fsh webrev (August 24th)


  48 #include <sys/vfs.h>
  49 #include <sys/vfs_opreg.h>
  50 #include <sys/vnode.h>
  51 #include <sys/rwstlock.h>
  52 #include <sys/fem.h>
  53 #include <sys/stat.h>
  54 #include <sys/mode.h>
  55 #include <sys/conf.h>
  56 #include <sys/sysmacros.h>
  57 #include <sys/cmn_err.h>
  58 #include <sys/systm.h>
  59 #include <sys/kmem.h>
  60 #include <sys/debug.h>
  61 #include <c2/audit.h>
  62 #include <sys/acl.h>
  63 #include <sys/nbmlock.h>
  64 #include <sys/fcntl.h>
  65 #include <fs/fs_subr.h>
  66 #include <sys/taskq.h>
  67 #include <fs/fs_reparse.h>

  68 
  69 /* Determine if this vnode is a file that is read-only */
  70 #define ISROFILE(vp)    \
  71         ((vp)->v_type != VCHR && (vp)->v_type != VBLK && \
  72             (vp)->v_type != VFIFO && vn_is_readonly(vp))
  73 
  74 /* Tunable via /etc/system; used only by admin/install */
  75 int nfs_global_client_only;
  76 
  77 /*
  78  * Array of vopstats_t for per-FS-type vopstats.  This array has the same
  79  * number of entries as and parallel to the vfssw table.  (Arguably, it could
  80  * be part of the vfssw table.)  Once it's initialized, it's accessed using
  81  * the same fstype index that is used to index into the vfssw table.
  82  */
  83 vopstats_t **vopstats_fstype;
  84 
  85 /* vopstats initialization template used for fast initialization via bcopy() */
  86 static vopstats_t *vs_templatep;
  87 


3208                         ASSERT(vp->v_wrcnt > 0);
3209                         atomic_add_32(&(vp->v_wrcnt), -1);
3210                 }
3211         }
3212         return (err);
3213 }
3214 
3215 int
3216 fop_read(
3217         vnode_t *vp,
3218         uio_t *uiop,
3219         int ioflag,
3220         cred_t *cr,
3221         caller_context_t *ct)
3222 {
3223         int     err;
3224         ssize_t resid_start = uiop->uio_resid;
3225 
3226         VOPXID_MAP_CR(vp, cr);
3227 
3228         err = (*(vp)->v_op->vop_read)(vp, uiop, ioflag, cr, ct);
3229         VOPSTATS_UPDATE_IO(vp, read,
3230             read_bytes, (resid_start - uiop->uio_resid));
3231         return (err);
3232 }
3233 
3234 int
3235 fop_write(
3236         vnode_t *vp,
3237         uio_t *uiop,
3238         int ioflag,
3239         cred_t *cr,
3240         caller_context_t *ct)
3241 {
3242         int     err;
3243         ssize_t resid_start = uiop->uio_resid;
3244 
3245         VOPXID_MAP_CR(vp, cr);
3246 
3247         err = (*(vp)->v_op->vop_write)(vp, uiop, ioflag, cr, ct);
3248         VOPSTATS_UPDATE_IO(vp, write,
3249             write_bytes, (resid_start - uiop->uio_resid));
3250         return (err);
3251 }
3252 
3253 int
3254 fop_ioctl(
3255         vnode_t *vp,
3256         int cmd,
3257         intptr_t arg,
3258         int flag,
3259         cred_t *cr,
3260         int *rvalp,
3261         caller_context_t *ct)
3262 {
3263         int     err;
3264 
3265         VOPXID_MAP_CR(vp, cr);
3266 
3267         err = (*(vp)->v_op->vop_ioctl)(vp, cmd, arg, flag, cr, rvalp, ct);




  48 #include <sys/vfs.h>
  49 #include <sys/vfs_opreg.h>
  50 #include <sys/vnode.h>
  51 #include <sys/rwstlock.h>
  52 #include <sys/fem.h>
  53 #include <sys/stat.h>
  54 #include <sys/mode.h>
  55 #include <sys/conf.h>
  56 #include <sys/sysmacros.h>
  57 #include <sys/cmn_err.h>
  58 #include <sys/systm.h>
  59 #include <sys/kmem.h>
  60 #include <sys/debug.h>
  61 #include <c2/audit.h>
  62 #include <sys/acl.h>
  63 #include <sys/nbmlock.h>
  64 #include <sys/fcntl.h>
  65 #include <fs/fs_subr.h>
  66 #include <sys/taskq.h>
  67 #include <fs/fs_reparse.h>
  68 #include <sys/fsh_impl.h>
  69 
  70 /* Determine if this vnode is a file that is read-only */
  71 #define ISROFILE(vp)    \
  72         ((vp)->v_type != VCHR && (vp)->v_type != VBLK && \
  73             (vp)->v_type != VFIFO && vn_is_readonly(vp))
  74 
  75 /* Tunable via /etc/system; used only by admin/install */
  76 int nfs_global_client_only;
  77 
  78 /*
  79  * Array of vopstats_t for per-FS-type vopstats.  This array has the same
  80  * number of entries as and parallel to the vfssw table.  (Arguably, it could
  81  * be part of the vfssw table.)  Once it's initialized, it's accessed using
  82  * the same fstype index that is used to index into the vfssw table.
  83  */
  84 vopstats_t **vopstats_fstype;
  85 
  86 /* vopstats initialization template used for fast initialization via bcopy() */
  87 static vopstats_t *vs_templatep;
  88 


3209                         ASSERT(vp->v_wrcnt > 0);
3210                         atomic_add_32(&(vp->v_wrcnt), -1);
3211                 }
3212         }
3213         return (err);
3214 }
3215 
3216 int
3217 fop_read(
3218         vnode_t *vp,
3219         uio_t *uiop,
3220         int ioflag,
3221         cred_t *cr,
3222         caller_context_t *ct)
3223 {
3224         int     err;
3225         ssize_t resid_start = uiop->uio_resid;
3226 
3227         VOPXID_MAP_CR(vp, cr);
3228 
3229         err = fsh_read(vp, uiop, ioflag, cr, ct);
3230         VOPSTATS_UPDATE_IO(vp, read,
3231             read_bytes, (resid_start - uiop->uio_resid));
3232         return (err);
3233 }
3234 
3235 int
3236 fop_write(
3237         vnode_t *vp,
3238         uio_t *uiop,
3239         int ioflag,
3240         cred_t *cr,
3241         caller_context_t *ct)
3242 {
3243         int     err;
3244         ssize_t resid_start = uiop->uio_resid;
3245 
3246         VOPXID_MAP_CR(vp, cr);
3247 
3248         err = fsh_write(vp, uiop, ioflag, cr, ct);
3249         VOPSTATS_UPDATE_IO(vp, write,
3250             write_bytes, (resid_start - uiop->uio_resid));
3251         return (err);
3252 }
3253 
3254 int
3255 fop_ioctl(
3256         vnode_t *vp,
3257         int cmd,
3258         intptr_t arg,
3259         int flag,
3260         cred_t *cr,
3261         int *rvalp,
3262         caller_context_t *ct)
3263 {
3264         int     err;
3265 
3266         VOPXID_MAP_CR(vp, cr);
3267 
3268         err = (*(vp)->v_op->vop_ioctl)(vp, cmd, arg, flag, cr, rvalp, ct);