Remove some redundant assignments and computations.
Reported by: alc Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25400
This commit is contained in:
parent
40276ff30e
commit
3507b8d467
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362739
@ -199,7 +199,7 @@ linux_get_user_pages_internal(vm_map_t map, unsigned long start, int nr_pages,
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ;
|
prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ;
|
||||||
len = ((size_t)nr_pages) << PAGE_SHIFT;
|
len = ptoa((vm_offset_t)nr_pages);
|
||||||
count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages);
|
count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages);
|
||||||
return (count == -1 ? -EFAULT : nr_pages);
|
return (count == -1 ? -EFAULT : nr_pages);
|
||||||
}
|
}
|
||||||
@ -219,9 +219,8 @@ __get_user_pages_fast(unsigned long start, int nr_pages, int write,
|
|||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
MPASS(pages != NULL);
|
MPASS(pages != NULL);
|
||||||
va = start;
|
|
||||||
map = &curthread->td_proc->p_vmspace->vm_map;
|
map = &curthread->td_proc->p_vmspace->vm_map;
|
||||||
end = start + (((size_t)nr_pages) << PAGE_SHIFT);
|
end = start + ptoa((vm_offset_t)nr_pages);
|
||||||
if (!vm_map_range_valid(map, start, end))
|
if (!vm_map_range_valid(map, start, end))
|
||||||
return (-EINVAL);
|
return (-EINVAL);
|
||||||
prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ;
|
prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ;
|
||||||
|
@ -1561,8 +1561,8 @@ mdresize(struct md_s *sc, struct md_req *mdr)
|
|||||||
if (mdr->md_mediasize <= 0 ||
|
if (mdr->md_mediasize <= 0 ||
|
||||||
(mdr->md_mediasize % PAGE_SIZE) != 0)
|
(mdr->md_mediasize % PAGE_SIZE) != 0)
|
||||||
return (EDOM);
|
return (EDOM);
|
||||||
oldpages = OFF_TO_IDX(round_page(sc->mediasize));
|
oldpages = OFF_TO_IDX(sc->mediasize);
|
||||||
newpages = OFF_TO_IDX(round_page(mdr->md_mediasize));
|
newpages = OFF_TO_IDX(mdr->md_mediasize);
|
||||||
if (newpages < oldpages) {
|
if (newpages < oldpages) {
|
||||||
VM_OBJECT_WLOCK(sc->object);
|
VM_OBJECT_WLOCK(sc->object);
|
||||||
vm_object_page_remove(sc->object, newpages, 0, 0);
|
vm_object_page_remove(sc->object, newpages, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user