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

Christoph Hellwig
2004-03-29T18:38:16Z

On Mon, Mar 29, 2004 at 08:20:51PM +0200, Andrea Arcangeli wrote:
> > > --- sles/fs/xfs/dmapi/dmapi_xfs.c.~1~ 2004-03-29 18:33:03.781501328 +0200
> > > +++ sles/fs/xfs/dmapi/dmapi_xfs.c 2004-03-29 18:58:57.754261560 +0200
> > > @@ -228,17 +228,21 @@ prohibited_mr_events(
> > > struct address_space *mapping = LINVFS_GET_IP(vp)->i_mapping;
> > > int prohibited = (1 << DM_EVENT_READ);
> > > struct vm_area_struct *vma;
> > > + struct prio_tree_iter iter;
> > >
> > > if (!VN_MAPPED(vp))
> > > return 0;
> > >
> > > #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> > > 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);
> > > }
> > > up(&mapping->i_shared_sem);
> > > #else
> >
> > This looks horrid (not your change, the original), and would need to look
> > at nonlinears too; but I thought this was what i_writecount < 0 is for?
>
> no idea what's the point of this stuff, Christoph maybe wants to
> elaborate.

That's dmapi, a standard for Hierachial Storage Management. The code is not
in mainline for a reason, no idea where you got it from.

AFAIK the code tries to detect whether there could be anyone writing to the
vma, but ask Dean for the details