Do not acquire Giant unconditionally around the calls to the cdevsw
d_mmap methods. prep_cdevsw() already installs the shims that acquire/drop Giant for the methods of a driver that specified the D_NEEDGIANT flag. Reviewed by: alc Approved by: re (kensmith)
This commit is contained in:
parent
dd04013007
commit
c6199d59e3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171725
@ -126,7 +126,6 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo
|
||||
csw = dev_refthread(dev);
|
||||
if (csw == NULL)
|
||||
return (NULL);
|
||||
mtx_lock(&Giant);
|
||||
|
||||
/*
|
||||
* Check that the specified range of the device allows the desired
|
||||
@ -137,7 +136,6 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo
|
||||
npages = OFF_TO_IDX(size);
|
||||
for (off = foff; npages--; off += PAGE_SIZE)
|
||||
if ((*csw->d_mmap)(dev, off, &paddr, (int)prot) != 0) {
|
||||
mtx_unlock(&Giant);
|
||||
dev_relthread(dev);
|
||||
return (NULL);
|
||||
}
|
||||
@ -171,7 +169,6 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo
|
||||
}
|
||||
|
||||
sx_xunlock(&dev_pager_sx);
|
||||
mtx_unlock(&Giant);
|
||||
dev_relthread(dev);
|
||||
return (object);
|
||||
}
|
||||
@ -216,12 +213,10 @@ dev_pager_getpages(object, m, count, reqpage)
|
||||
csw = dev_refthread(dev);
|
||||
if (csw == NULL)
|
||||
panic("dev_pager_getpage: no cdevsw");
|
||||
mtx_lock(&Giant);
|
||||
prot = PROT_READ; /* XXX should pass in? */
|
||||
|
||||
ret = (*csw->d_mmap)(dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr, prot);
|
||||
KASSERT(ret == 0, ("dev_pager_getpage: map function returns error"));
|
||||
mtx_unlock(&Giant);
|
||||
dev_relthread(dev);
|
||||
|
||||
if ((m[reqpage]->flags & PG_FICTITIOUS) != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user