Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/md/md.c
| Show First 20 Lines • Show All 959 Lines • ▼ Show 20 Lines | if ((bp->bio_flags & BIO_VLIST) != 0) { | ||||
| piov = auio.uio_iov; | piov = auio.uio_iov; | ||||
| } else if ((bp->bio_flags & BIO_UNMAPPED) != 0) { | } else if ((bp->bio_flags & BIO_UNMAPPED) != 0) { | ||||
| bp->bio_resid = len; | bp->bio_resid = len; | ||||
| unmapped_step: | unmapped_step: | ||||
| npages = atop(min(maxphys, round_page(len + (ma_offs & | npages = atop(min(maxphys, round_page(len + (ma_offs & | ||||
| PAGE_MASK)))); | PAGE_MASK)))); | ||||
| iolen = min(ptoa(npages) - (ma_offs & PAGE_MASK), len); | iolen = min(ptoa(npages) - (ma_offs & PAGE_MASK), len); | ||||
| KASSERT(iolen > 0, ("zero iolen")); | KASSERT(iolen > 0, ("zero iolen")); | ||||
| KASSERT(npages <= atop(MAXPHYS + PAGE_SIZE), | KASSERT(npages <= atop(maxphys + PAGE_SIZE), | ||||
| ("npages %d too large", npages)); | ("npages %d too large", npages)); | ||||
| pmap_qenter(sc->kva, &bp->bio_ma[atop(ma_offs)], npages); | pmap_qenter(sc->kva, &bp->bio_ma[atop(ma_offs)], npages); | ||||
| aiov.iov_base = (void *)(sc->kva + (ma_offs & PAGE_MASK)); | aiov.iov_base = (void *)(sc->kva + (ma_offs & PAGE_MASK)); | ||||
| aiov.iov_len = iolen; | aiov.iov_len = iolen; | ||||
| auio.uio_iov = &aiov; | auio.uio_iov = &aiov; | ||||
| auio.uio_iovcnt = 1; | auio.uio_iovcnt = 1; | ||||
| auio.uio_resid = iolen; | auio.uio_resid = iolen; | ||||
| mapped = true; | mapped = true; | ||||
| ▲ Show 20 Lines • Show All 505 Lines • ▼ Show 20 Lines | mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) | ||||
| error = mdsetcred(sc, td->td_ucred); | error = mdsetcred(sc, td->td_ucred); | ||||
| if (error != 0) { | if (error != 0) { | ||||
| sc->vnode = NULL; | sc->vnode = NULL; | ||||
| vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY); | vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY); | ||||
| nd.ni_vp->v_vflag &= ~VV_MD; | nd.ni_vp->v_vflag &= ~VV_MD; | ||||
| goto bad; | goto bad; | ||||
| } | } | ||||
| sc->kva = kva_alloc(MAXPHYS + PAGE_SIZE); | sc->kva = kva_alloc(maxphys + PAGE_SIZE); | ||||
| return (0); | return (0); | ||||
| bad: | bad: | ||||
| VOP_UNLOCK(nd.ni_vp); | VOP_UNLOCK(nd.ni_vp); | ||||
| (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); | (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); | ||||
| return (error); | return (error); | ||||
| } | } | ||||
| static void | static void | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if (sc->cred != NULL) | ||||
| crfree(sc->cred); | crfree(sc->cred); | ||||
| if (sc->object != NULL) | if (sc->object != NULL) | ||||
| vm_object_deallocate(sc->object); | vm_object_deallocate(sc->object); | ||||
| if (sc->indir) | if (sc->indir) | ||||
| destroy_indir(sc, sc->indir); | destroy_indir(sc, sc->indir); | ||||
| if (sc->uma) | if (sc->uma) | ||||
| uma_zdestroy(sc->uma); | uma_zdestroy(sc->uma); | ||||
| if (sc->kva) | if (sc->kva) | ||||
| kva_free(sc->kva, MAXPHYS + PAGE_SIZE); | kva_free(sc->kva, maxphys + PAGE_SIZE); | ||||
| LIST_REMOVE(sc, list); | LIST_REMOVE(sc, list); | ||||
| free_unr(md_uh, sc->unit); | free_unr(md_uh, sc->unit); | ||||
| free(sc, M_MD); | free(sc, M_MD); | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| static int | static int | ||||
| ▲ Show 20 Lines • Show All 623 Lines • Show Last 20 Lines | |||||