Re: [RFC][PATCH 1/3] radix priority search tree - objrmap complexity fix

Rajesh Venkatasubramanian
2004-03-29T17:50:20Z

> #define VN_MAPPED(vp) \
> - (!list_empty(&(LINVFS_GET_IP(vp)->i_mapping->i_mmap)) || \
> - (!list_empty(&(LINVFS_GET_IP(vp)->i_mapping->i_mmap_shared))))
> + (!prio_tree_empty(&(LINVFS_GET_IP(vp)->i_mapping->i_mmap)) || \
> + (!prio_tree_empty(&(LINVFS_GET_IP(vp)->i_mapping->i_mmap_shared))))

I think we will need the following too:
(!list_empty(&(LINVFS_GET_IP(vp)->i_mmaping->i_mmap_nonlinear)

> down(&mapping->i_shared_sem);
> - list_for_each_entry(vma, &mapping->i_mmap_shared, shared) {
> + vma = __vma_prio_tree_first(&mapping->i_mmap_shared, &iter, 0, ULONG_MAX);
> + while (vma) {
> if (!(vma->vm_flags & VM_DENYWRITE)) {
> prohibited |= (1 << DM_EVENT_WRITE);
> break;
> }
> +
> + vma = __vma_prio_tree_next(vma, &mapping->i_mmap_shared, &iter, 0, ULONG_MAX);
> }

This part looks fine. But, I am not sure whether you have to handle
nonlinear maps here.

list_for_each_entry(vma, &mapping->i_mmap_nonlinear, shared) {
...
}

> up(&mapping->i_shared_sem);
> #else

Hope that helps.

Rajesh