+#ifndef HAVE_VM_OP_FAULT
+static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
+{
+ cfs_page_t *vmpage;
+
+ vmpage = filemap_nopage(cfio->ft_vma, cfio->nopage.ft_address,
+ cfio->nopage.ft_type);
+
+ if (vmpage == NOPAGE_SIGBUS) {
+ CDEBUG(D_PAGE, "got addr %lu type %lx - SIGBUS\n",
+ cfio->nopage.ft_address,(long)cfio->nopage.ft_type);
+ return -EFAULT;
+ } else if (vmpage == NOPAGE_OOM) {
+ CDEBUG(D_PAGE, "got addr %lu type %lx - OOM\n",
+ cfio->nopage.ft_address, (long)cfio->nopage.ft_type);
+ return -ENOMEM;
+ }
+
+ LL_CDEBUG_PAGE(D_PAGE, vmpage, "got addr %lu type %lx\n",
+ cfio->nopage.ft_address, (long)cfio->nopage.ft_type);
+
+ cfio->ft_vmpage = vmpage;
+
+ return 0;
+}
+#else
+static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
+{
+ cfio->fault.ft_flags = filemap_fault(cfio->ft_vma, cfio->fault.ft_vmf);
+
+ if (cfio->fault.ft_vmf->page) {
+ LL_CDEBUG_PAGE(D_PAGE, cfio->fault.ft_vmf->page,
+ "got addr %p type NOPAGE\n",
+ cfio->fault.ft_vmf->virtual_address);
+ /*XXX workaround to bug in CLIO - he deadlocked with
+ lock cancel if page locked */
+ if (likely(cfio->fault.ft_flags & VM_FAULT_LOCKED)) {
+ unlock_page(cfio->fault.ft_vmf->page);
+ cfio->fault.ft_flags &= ~VM_FAULT_LOCKED;
+ }
+
+ cfio->ft_vmpage = cfio->fault.ft_vmf->page;
+ return 0;
+ }
+
+ if (unlikely (cfio->fault.ft_flags & VM_FAULT_ERROR)) {
+ CDEBUG(D_PAGE, "got addr %p - SIGBUS\n",
+ cfio->fault.ft_vmf->virtual_address);
+ return -EFAULT;
+ }
+
+ if (unlikely (cfio->fault.ft_flags & VM_FAULT_NOPAGE)) {
+ CDEBUG(D_PAGE, "got addr %p - OOM\n",
+ cfio->fault.ft_vmf->virtual_address);
+ return -ENOMEM;
+ }
+
+ CERROR("unknow error in page fault!\n");
+ return -EINVAL;
+}
+
+#endif
+