Author: markj
Date: Thu Aug 11 07:58:23 2016
New Revision: 303951
URL: https://svnweb.freebsd.org/changeset/base/303951

Log:
  Remove b_pin_count from struct buf.
  
  It was added in r153192 for XFS and doesn't appear to have been used for
  anything else. XFS was disconnected in r241607 and removed entirely in
  r247631.
  
  Reported by:  mlaier
  Reviewed by:  imp, kib
  Differential Revision:        https://reviews.freebsd.org/D7468

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_cluster.c
  head/sys/sys/buf.h

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c     Thu Aug 11 07:11:15 2016        (r303950)
+++ head/sys/kern/vfs_bio.c     Thu Aug 11 07:58:23 2016        (r303951)
@@ -1479,7 +1479,6 @@ buf_alloc(void)
        bp->b_npages = 0;
        bp->b_dirtyoff = bp->b_dirtyend = 0;
        bp->b_bufobj = NULL;
-       bp->b_pin_count = 0;
        bp->b_data = bp->b_kvabase = unmapped_buf;
        bp->b_fsprivate1 = NULL;
        bp->b_fsprivate2 = NULL;
@@ -1908,9 +1907,6 @@ bufwrite(struct buf *bp)
 
        BUF_ASSERT_HELD(bp);
 
-       if (bp->b_pin_count > 0)
-               bunpin_wait(bp);
-
        KASSERT(!(bp->b_vflags & BV_BKGRDINPROG),
            ("FFS background buffer should not get here %p", bp));
 
@@ -3123,10 +3119,7 @@ flushbufqueues(struct vnode *lvp, int ta
                mtx_unlock(&bqlocks[queue]);
                if (error != 0)
                        continue;
-               if (bp->b_pin_count > 0) {
-                       BUF_UNLOCK(bp);
-                       continue;
-               }
+
                /*
                 * BKGRDINPROG can only be set with the buf and bufobj
                 * locks both held.  We tolerate a race to clear it here.
@@ -3546,19 +3539,6 @@ loop:
                        if ((bp->b_flags & B_VMIO) == 0 ||
                            (size > bp->b_kvasize)) {
                                if (bp->b_flags & B_DELWRI) {
-                                       /*
-                                        * If buffer is pinned and caller does
-                                        * not want sleep  waiting for it to be
-                                        * unpinned, bail out
-                                        * */
-                                       if (bp->b_pin_count > 0) {
-                                               if (flags & GB_LOCK_NOWAIT) {
-                                                       bqrelse(bp);
-                                                       return (NULL);
-                                               } else {
-                                                       bunpin_wait(bp);
-                                               }
-                                       }
                                        bp->b_flags |= B_NOCACHE;
                                        bwrite(bp);
                                } else {
@@ -4632,41 +4612,6 @@ bufobj_wwait(struct bufobj *bo, int slpf
        return (error);
 }
 
-void
-bpin(struct buf *bp)
-{
-       struct mtx *mtxp;
-
-       mtxp = mtx_pool_find(mtxpool_sleep, bp);
-       mtx_lock(mtxp);
-       bp->b_pin_count++;
-       mtx_unlock(mtxp);
-}
-
-void
-bunpin(struct buf *bp)
-{
-       struct mtx *mtxp;
-
-       mtxp = mtx_pool_find(mtxpool_sleep, bp);
-       mtx_lock(mtxp);
-       if (--bp->b_pin_count == 0)
-               wakeup(bp);
-       mtx_unlock(mtxp);
-}
-
-void
-bunpin_wait(struct buf *bp)
-{
-       struct mtx *mtxp;
-
-       mtxp = mtx_pool_find(mtxpool_sleep, bp);
-       mtx_lock(mtxp);
-       while (bp->b_pin_count > 0)
-               msleep(bp, mtxp, PRIBIO, "bwunpin", 0);
-       mtx_unlock(mtxp);
-}
-
 /*
  * Set bio_data or bio_ma for struct bio from the struct buf.
  */

Modified: head/sys/kern/vfs_cluster.c
==============================================================================
--- head/sys/kern/vfs_cluster.c Thu Aug 11 07:11:15 2016        (r303950)
+++ head/sys/kern/vfs_cluster.c Thu Aug 11 07:58:23 2016        (r303951)
@@ -836,12 +836,6 @@ cluster_wbuild(struct vnode *vp, long si
                        --len;
                        continue;
                }
-               if (tbp->b_pin_count >  0) {
-                       BUF_UNLOCK(tbp);
-                       ++start_lbn;
-                       --len;
-                       continue;
-               }
                bremfree(tbp);
                tbp->b_flags &= ~B_DONE;
 
@@ -954,14 +948,6 @@ cluster_wbuild(struct vnode *vp, long si
                                }
 
                                /*
-                                * Do not pull in pinned buffers.
-                                */
-                               if (tbp->b_pin_count > 0) {
-                                       BUF_UNLOCK(tbp);
-                                       break;
-                               }
-
-                               /*
                                 * Ok, it's passed all the tests,
                                 * so remove it from the free list
                                 * and mark it busy. We will use it.

Modified: head/sys/sys/buf.h
==============================================================================
--- head/sys/sys/buf.h  Thu Aug 11 07:11:15 2016        (r303950)
+++ head/sys/sys/buf.h  Thu Aug 11 07:58:23 2016        (r303951)
@@ -139,7 +139,6 @@ struct buf {
        void    *b_fsprivate1;
        void    *b_fsprivate2;
        void    *b_fsprivate3;
-       int     b_pin_count;
 };
 
 #define b_object       b_bufobj->bo_object
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to