This allows me to split off more functionality into helper routines. I have an 9 patch series that eventually makes:
vm_fault_lookup(), vm_fault_relookup(), vm_fault_allocate(), vm_fault_getpages(), vm_fault_cow(), etc. This allows me to eliminate gotos and make the control flow more clear. It reduces vm_fault() from ~900loc to ~200loc. I have an idea for sendfile on zfs that will require a custom object fault function and moving these parameters into the fault state makes it easier to override later.
The one downside to this approach is that we have to be very careful about what changes to the state persist across restarts. In particular I notice that retry_prot was modifying fault_type permanently. If a restart happened after this it may be incorrect and we could immediately re-trigger the same fault. I have changed this so that fault_type is reloaded on retry but I would like some confirmation that this is the correct thing to do.
vm_fault_soft_fast also modifies vaddr so I make a local copy.