From: François Tigeot Date: Mon, 7 Jan 2019 19:44:57 +0000 (+0100) Subject: drm/linux: Add invalidate_mapping_pages() X-Git-Tag: v5.7.0~623 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/c15ebf28e86db3c020927a6bd5b85e99113447ba drm/linux: Add invalidate_mapping_pages() Inspired-by: FreeBSD --- diff --git a/sys/dev/drm/include/linux/fs.h b/sys/dev/drm/include/linux/fs.h index a454f4d781..cf88372506 100644 --- a/sys/dev/drm/include/linux/fs.h +++ b/sys/dev/drm/include/linux/fs.h @@ -63,4 +63,18 @@ struct file_operations { extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); +static inline unsigned long +invalidate_mapping_pages(struct vm_object *obj, pgoff_t start, pgoff_t end) +{ + int start_count, end_count, clean_only = 1; + + VM_OBJECT_LOCK(obj); + start_count = obj->resident_page_count; + /* Only non-dirty pages must be freed or invalidated */ + vm_object_page_remove(obj, start, end, clean_only); + end_count = obj->resident_page_count; + VM_OBJECT_UNLOCK(obj); + return (start_count - end_count); +} + #endif /* _LINUX_FS_H_ */ diff --git a/sys/dev/drm/include/linux/types.h b/sys/dev/drm/include/linux/types.h index 5b93f7b9d6..036dea763b 100644 --- a/sys/dev/drm/include/linux/types.h +++ b/sys/dev/drm/include/linux/types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 François Tigeot + * Copyright (c) 2015-2019 François Tigeot * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,6 @@ typedef _Bool bool; typedef unsigned short umode_t; +typedef unsigned long pgoff_t; + #endif /* _LINUX_TYPES_H_ */