Date: Sat, 9 Jul 2011 14:42:45 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223887 - head/sys/ufs/ffs Message-ID: <201107091442.p69Egj3X004476@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 9 14:42:45 2011 New Revision: 223887 URL: http://svn.freebsd.org/changeset/base/223887 Log: Use helper functions instead of manually managing TDP_INBDFLUSH. Sponsored by: The FreeBSD Foundation Reviewed by: alc (previous version) MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_balloc.c Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Sat Jul 9 14:41:28 2011 (r223886) +++ head/sys/ufs/ffs/ffs_balloc.c Sat Jul 9 14:42:45 2011 (r223887) @@ -234,9 +234,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t if (num < 1) panic ("ffs_balloc_ufs1: ufs_getlbns returned indirect block"); #endif - saved_inbdflush = ~TDP_INBDFLUSH | (curthread->td_pflags & - TDP_INBDFLUSH); - curthread->td_pflags |= TDP_INBDFLUSH; + saved_inbdflush = thread_pflags_set(TDP_INBDFLUSH); /* * Fetch the first indirect block allocating if necessary. */ @@ -250,7 +248,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); return (error); } nb = newb; @@ -356,7 +354,7 @@ retry: * If asked only for the indirect block, then return it. */ if (flags & BA_METAONLY) { - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); *bpp = bp; return (0); } @@ -406,7 +404,7 @@ retry: bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); *bpp = nbp; return (0); } @@ -428,11 +426,11 @@ retry: nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); } - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); *bpp = nbp; return (0); fail: - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); /* * If we have failed to allocate any blocks, simply return the error. * This is the usual case and avoids the need to fsync the file. @@ -774,9 +772,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t if (num < 1) panic ("ffs_balloc_ufs2: ufs_getlbns returned indirect block"); #endif - saved_inbdflush = ~TDP_INBDFLUSH | (curthread->td_pflags & - TDP_INBDFLUSH); - curthread->td_pflags |= TDP_INBDFLUSH; + saved_inbdflush = thread_pflags_set(TDP_INBDFLUSH); /* * Fetch the first indirect block allocating if necessary. */ @@ -790,7 +786,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); return (error); } nb = newb; @@ -896,7 +892,7 @@ retry: * If asked only for the indirect block, then return it. */ if (flags & BA_METAONLY) { - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); *bpp = bp; return (0); } @@ -946,7 +942,7 @@ retry: bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); *bpp = nbp; return (0); } @@ -974,11 +970,11 @@ retry: nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); } - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); *bpp = nbp; return (0); fail: - curthread->td_pflags &= saved_inbdflush; + thread_pflags_restore(saved_inbdflush); /* * If we have failed to allocate any blocks, simply return the error. * This is the usual case and avoids the need to fsync the file.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107091442.p69Egj3X004476>