X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e:/bsd/nfs/nfs_vnops.c diff --git a/bsd/nfs/nfs_vnops.c b/bsd/nfs/nfs_vnops.c index 5ed8d569b..052b5e439 100644 --- a/bsd/nfs/nfs_vnops.c +++ b/bsd/nfs/nfs_vnops.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * + * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code @@ -1039,8 +1039,10 @@ nfs_setattr(ap) { vnode_t vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); + struct nfsmount *nmp; struct vnode_attr *vap = ap->a_vap; int error = 0; + int biosize; u_quad_t tsize; kauth_cred_t cred; proc_t p; @@ -1048,6 +1050,10 @@ nfs_setattr(ap) #ifndef nolint tsize = (u_quad_t)0; #endif + nmp = VFSTONFS(vnode_mount(vp)); + if (!nmp) + return (ENXIO); + biosize = nmp->nm_biosize; /* Setting of flags is not supported. */ if (VATTR_IS_ACTIVE(vap, va_flags)) @@ -1109,10 +1115,9 @@ nfs_setattr(ap) } } else if (np->n_size > vap->va_data_size) { /* shrinking? */ daddr64_t obn, bn; - int biosize, neweofoff, mustwrite; + int neweofoff, mustwrite; struct nfsbuf *bp; - biosize = vfs_statfs(vnode_mount(vp))->f_iosize; obn = (np->n_size - 1) / biosize; bn = vap->va_data_size / biosize; for ( ; obn >= bn; obn--) { @@ -4752,9 +4757,9 @@ nfs_pagein(ap) UPL_ABORT_ERROR | UPL_ABORT_FREE_ON_EMPTY); return (ENXIO); } + biosize = nmp->nm_biosize; if ((nmp->nm_flag & NFSMNT_NFSV3) && !(nmp->nm_state & NFSSTA_GOTFSINFO)) - (void)nfs_fsinfo(nmp, vp, cred, p); - biosize = vfs_statfs(vnode_mount(vp))->f_iosize; + nfs_fsinfo(nmp, vp, cred, p); plinfo = ubc_upl_pageinfo(pl); ubc_upl_map(pl, &ioaddr); @@ -4891,7 +4896,7 @@ nfs_pageout(ap) ubc_upl_abort(pl, UPL_ABORT_DUMP_PAGES|UPL_ABORT_FREE_ON_EMPTY); return (ENXIO); } - biosize = vfs_statfs(vnode_mount(vp))->f_iosize; + biosize = nmp->nm_biosize; /* * Check to see whether the buffer is incore. @@ -5148,12 +5153,11 @@ nfs_blktooff(ap) { int biosize; vnode_t vp = ap->a_vp; - mount_t mp = vnode_mount(vp); + struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); - if (!mp) + if (!nmp) return (ENXIO); - - biosize = vfs_statfs(mp)->f_iosize; + biosize = nmp->nm_biosize; *ap->a_offset = (off_t)(ap->a_lblkno * biosize); @@ -5171,12 +5175,11 @@ nfs_offtoblk(ap) { int biosize; vnode_t vp = ap->a_vp; - mount_t mp = vnode_mount(vp); + struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); - if (!mp) + if (!nmp) return (ENXIO); - - biosize = vfs_statfs(mp)->f_iosize; + biosize = nmp->nm_biosize; *ap->a_lblkno = (daddr64_t)(ap->a_offset / biosize);