+long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
unsigned int gup_flags, struct page **pages,struct vm_area_struct **vmas)+{
- struct vm_area_struct **__vmas = vmas;
How about calling the vma argument vma_arg, and the one used vma to make thigns a little more readable?
- struct vm_area_struct *vma_prev = NULL;
- long rc, i;
- if (!pages)
return -EINVAL;- if (!vmas && IS_ENABLED(CONFIG_FS_DAX)) {
__vmas = kzalloc(sizeof(struct vm_area_struct *) * nr_pages,GFP_KERNEL);if (!__vmas)return -ENOMEM;- }
- rc = get_user_pages(start, nr_pages, gup_flags, pages, __vmas);
- /* skip scan for fs-dax vmas if they are compile time disabled */
- if (!IS_ENABLED(CONFIG_FS_DAX))
goto out;
Instead of all this IS_ENABLED magic I'd recomment to just conditionally compile this function and define it to get_user_pages in the header if FS_DAX is disabled.
Else this looks fine to me.