Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: WAPBL patch for testing



On Fri, Oct 31, 2008 at 07:03:59PM +0100, Joerg Sonnenberger wrote:
> Hi all,
> the attached patch is supposed to fix both hangs (wchan tstile) and
> performance issues with WAPBL. Please test it and report any issues.
> I'd like to see some review for this too. I can't find a reason why the
> WAPBL lock should be hold in that places nor can I find a code path from
> UFS itself to getpages with lock already being hold, but I could be
> wrong.
> 
> Joerg

The reason for these wapbl locks is ffs snapshots.  VOP_PUTPAGES() may
need to copy-on-write which needs to run inside a wapbl transaction
as we allocate blocks here.

The code path for PGO_JOURNALLOCKED is for example
ffs_write() aka. WRITE() (ufs/ufs_readwrite.c) -> VOP_PUTPAGES().

-- 
Juergen Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)

> Index: genfs_io.c
> ===================================================================
> RCS file: /home/joerg/repo/netbsd/src/sys/miscfs/genfs/genfs_io.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 genfs_io.c
> --- genfs_io.c        19 Oct 2008 18:17:13 -0000      1.13
> +++ genfs_io.c        31 Oct 2008 01:53:36 -0000
> @@ -779,7 +779,6 @@ genfs_do_putpages(struct vnode *vp, off_
>       int flags;
>       int dirtygen;
>       bool modified;
> -     bool need_wapbl;
>       bool has_trans;
>       bool cleanall;
>       bool onworklst;
> @@ -794,8 +793,6 @@ genfs_do_putpages(struct vnode *vp, off_
>           vp, uobj->uo_npages, startoff, endoff - startoff);
>  
>       has_trans = false;
> -     need_wapbl = (!pagedaemon && vp->v_mount && vp->v_mount->mnt_wapbl &&
> -         (origflags & PGO_JOURNALLOCKED) == 0);
>  
>  retry:
>       modified = false;
> @@ -809,8 +806,6 @@ retry:
>                               vn_syncer_remove_from_worklist(vp);
>               }
>               if (has_trans) {
> -                     if (need_wapbl)
> -                             WAPBL_END(vp->v_mount);
>                       fstrans_done(vp->v_mount);
>               }
>               mutex_exit(slock);
> @@ -829,13 +824,6 @@ retry:
>                               return error;
>               } else
>                       fstrans_start(vp->v_mount, FSTRANS_LAZY);
> -             if (need_wapbl) {
> -                     error = WAPBL_BEGIN(vp->v_mount);
> -                     if (error) {
> -                             fstrans_done(vp->v_mount);
> -                             return error;
> -                     }
> -             }
>               has_trans = true;
>               mutex_enter(slock);
>               goto retry;
> @@ -958,6 +946,7 @@ retry:
>                               mutex_enter(slock);
>                       } else {
>                               pg->flags |= PG_WANTED;
> +                             printf(".");
>                               UVM_UNLOCK_AND_WAIT(pg, slock, 0, "genput", 0);
>                               mutex_enter(slock);
>                       }
> @@ -1210,8 +1199,6 @@ skip_scan:
>       }
>  
>       if (has_trans) {
> -             if (need_wapbl)
> -                     WAPBL_END(vp->v_mount);
>               fstrans_done(vp->v_mount);
>       }
>  
> @@ -1585,12 +1572,6 @@ genfs_directio(struct vnode *vp, struct 
>               return;
>       }
>  
> -     if ((ioflag & IO_JOURNALLOCKED) == 0) {
> -             error = WAPBL_BEGIN(vp->v_mount);
> -             if (error)
> -                     return;
> -     }
> -
>       /*
>        * Do as much of the uio as possible with direct I/O.
>        */
> @@ -1636,9 +1617,6 @@ genfs_directio(struct vnode *vp, struct 
>               uio->uio_offset += len;
>               uio->uio_resid -= len;
>       }
> -
> -     if ((ioflag & IO_JOURNALLOCKED) == 0)
> -             WAPBL_END(vp->v_mount);
>  }
>  
>  /*


Home | Main Index | Thread Index | Old Index