Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Mar 2012 09:51:16 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Grzegorz Bernacki <gber@FreeBSD.org>
Cc:        svn-src-projects@freebsd.org, src-committers@freebsd.org, kib@FreeBSD.org
Subject:   Re: svn commit: r233072 - projects/nand/sys/kern
Message-ID:  <20120317085116.GC1340@garage.freebsd.pl>
In-Reply-To: <201203170318.q2H3ITdI047893@svn.freebsd.org>
References:  <201203170318.q2H3ITdI047893@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--W5WqUoFLvi1M7tJE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Mar 17, 2012 at 03:18:29AM +0000, Grzegorz Bernacki wrote:
> Author: gber
> Date: Sat Mar 17 03:18:28 2012
> New Revision: 233072
> URL: http://svn.freebsd.org/changeset/base/233072
>=20
> Log:
>   Add VFS changes necessary for NANDFS to work.
>  =20
>   Ignore B_MANAGED buffer by syncer and ignore signal when msleep as it
>   can cause file system inconsistency.

I'd suggest running these changes through kib@. Especially vn_start_write()
change below looks ugly, but maybe it is only temporary?

>   Obtained from: Semihalf
>   Supported by:  FreeBSD Foundation, Juniper Networks
>=20
> Modified:
>   projects/nand/sys/kern/vfs_bio.c
>   projects/nand/sys/kern/vfs_subr.c
>   projects/nand/sys/kern/vfs_vnops.c
>=20
> Modified: projects/nand/sys/kern/vfs_bio.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- projects/nand/sys/kern/vfs_bio.c	Sat Mar 17 03:02:10 2012	(r233071)
> +++ projects/nand/sys/kern/vfs_bio.c	Sat Mar 17 03:18:28 2012	(r233072)
> @@ -2672,7 +2672,8 @@ loop:
>  		else if ((bp->b_flags & (B_VMIO | B_INVAL)) =3D=3D 0)
>  			bp->b_flags |=3D B_CACHE;
>  		BO_LOCK(bo);
> -		bremfree(bp);
> +		if (!(bp->b_flags & B_MANAGED))
> +			bremfree(bp);
>  		BO_UNLOCK(bo);
> =20
>  		/*
>=20
> Modified: projects/nand/sys/kern/vfs_subr.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- projects/nand/sys/kern/vfs_subr.c	Sat Mar 17 03:02:10 2012	(r233071)
> +++ projects/nand/sys/kern/vfs_subr.c	Sat Mar 17 03:18:28 2012	(r233072)
> @@ -2018,7 +2018,8 @@ reassignbuf(struct buf *bp)
>  	 * of clean buffers.
>  	 */
>  	if (bp->b_flags & B_DELWRI) {
> -		if ((bo->bo_flag & BO_ONWORKLST) =3D=3D 0) {
> +		if (!(bp->b_flags & B_MANAGED) &&
> +		    (bo->bo_flag & BO_ONWORKLST) =3D=3D 0) {
>  			switch (vp->v_type) {
>  			case VDIR:
>  				delay =3D dirdelay;
> @@ -2034,13 +2035,15 @@ reassignbuf(struct buf *bp)
>  		buf_vlist_add(bp, bo, BX_VNDIRTY);
>  	} else {
>  		buf_vlist_add(bp, bo, BX_VNCLEAN);
> -
> -		if ((bo->bo_flag & BO_ONWORKLST) && bo->bo_dirty.bv_cnt =3D=3D 0) {
> -			mtx_lock(&sync_mtx);
> -			LIST_REMOVE(bo, bo_synclist);
> -			syncer_worklist_len--;
> -			mtx_unlock(&sync_mtx);
> -			bo->bo_flag &=3D ~BO_ONWORKLST;
> +		if (!(bp->b_flags & B_MANAGED)) {
> +			if ((bo->bo_flag & BO_ONWORKLST) &&
> +			    bo->bo_dirty.bv_cnt =3D=3D 0) {
> +				mtx_lock(&sync_mtx);
> +				LIST_REMOVE(bo, bo_synclist);
> +				syncer_worklist_len--;
> +				mtx_unlock(&sync_mtx);
> +				bo->bo_flag &=3D ~BO_ONWORKLST;
> +			}
>  		}
>  	}
>  #ifdef INVARIANTS
>=20
> Modified: projects/nand/sys/kern/vfs_vnops.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- projects/nand/sys/kern/vfs_vnops.c	Sat Mar 17 03:02:10 2012	(r233071)
> +++ projects/nand/sys/kern/vfs_vnops.c	Sat Mar 17 03:18:28 2012	(r233072)
> @@ -1055,6 +1055,8 @@ vn_start_write(vp, mpp, flags)
>  				error =3D EWOULDBLOCK;
>  				goto unlock;
>  			}
> +			if (strcmp(mp->mnt_stat.f_fstypename, "nandfs") =3D=3D 0)
> +				flags &=3D ~PCATCH;
>  			error =3D msleep(&mp->mnt_flag, MNT_MTX(mp),
>  			    (PUSER - 1) | (flags & PCATCH), "suspfs", 0);
>  			if (error)

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

--W5WqUoFLvi1M7tJE
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk9kUIQACgkQForvXbEpPzR2ywCgtRN9JkI1s81xZ0AI5BpXTR6c
0LgAoOtNObRl132B1bHxIlZ2Am/AGRGU
=TEzT
-----END PGP SIGNATURE-----

--W5WqUoFLvi1M7tJE--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120317085116.GC1340>