/* Some shared mappigns will want the pages marked read-only to track write events. If so, we'll downgrade vm_page_prot to the private version (using protection_map without the VM_SHARED bit).  */
int vma_wants_writenotify(struct vm_area_struct *vma)
/* Some shared mappigns will want the pages marked read-only to track write events. If so, we'll downgrade vm_page_prot to the private version (using protection_map without the VM_SHARED bit).  */
int vma_wants_writenotify(struct vm_area_struct *vma)
{
	unsigned int vm_flags = vma->vm_flags;
	if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
		return 0;
	if (vma->vm_ops && vma->vm_ops->page_mkwrite)
		return 1;
	if (pgprot_val(vma->vm_page_prot) !=
	    pgprot_val(vm_get_page_prot(vm_flags)))
		return 0;
	if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
		return 0;
	return vma->vm_file && vma->vm_file->f_mapping &&
		mapping_cap_account_dirty(vma->vm_file->f_mapping);
}