mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-29 17:21:24 +00:00
Fix some nits in zfs_getpages()
- If we don't want dmu_read_pages() to perform extra readahead/behind, pass a pointer to 0 instead of a null pointer, as dum_read_pages() expects rahead and rbehind to be non-null. - Avoid unneeded iterations in a loop. Sponsored-by: Klara, Inc. Reported-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Mark Johnston <markj@FreeBSD.org> Closes #16758
This commit is contained in:
parent
46c4f2ce0b
commit
8dc452d907
@ -4005,7 +4005,7 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int count, int *rbehind,
|
|||||||
* allocated block.
|
* allocated block.
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
int count1, j, last_size;
|
int dummypgsin, count1, j, last_size;
|
||||||
|
|
||||||
if (vm_page_any_valid(ma[i])) {
|
if (vm_page_any_valid(ma[i])) {
|
||||||
ASSERT(vm_page_all_valid(ma[i]));
|
ASSERT(vm_page_all_valid(ma[i]));
|
||||||
@ -4018,13 +4018,16 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int count, int *rbehind,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
count1 = j - i;
|
count1 = j - i;
|
||||||
|
dummypgsin = 0;
|
||||||
last_size = j == count ?
|
last_size = j == count ?
|
||||||
MIN(end, obj_size) - (end - PAGE_SIZE) : PAGE_SIZE;
|
MIN(end, obj_size) - (end - PAGE_SIZE) : PAGE_SIZE;
|
||||||
error = dmu_read_pages(zfsvfs->z_os, zp->z_id, &ma[i], count1,
|
error = dmu_read_pages(zfsvfs->z_os, zp->z_id, &ma[i], count1,
|
||||||
i == 0 ? &pgsin_b : NULL, j == count ? &pgsin_a : NULL,
|
i == 0 ? &pgsin_b : &dummypgsin,
|
||||||
|
j == count ? &pgsin_a : &dummypgsin,
|
||||||
last_size);
|
last_size);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
break;
|
break;
|
||||||
|
i += count1 - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
zfs_rangelock_exit(lr);
|
zfs_rangelock_exit(lr);
|
||||||
|
Loading…
Reference in New Issue
Block a user