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
This commit is contained in:
Mark Johnston 2016-08-11 07:58:23 +00:00
parent d293d0c934
commit 5004817335
3 changed files with 1 additions and 71 deletions

View File

@ -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 target, int flushdeps)
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 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int slpflag, int slptimeo,
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 slpflag, int timeo)
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.
*/

View File

@ -836,12 +836,6 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
--len;
continue;
}
if (tbp->b_pin_count > 0) {
BUF_UNLOCK(tbp);
++start_lbn;
--len;
continue;
}
bremfree(tbp);
tbp->b_flags &= ~B_DONE;
@ -953,14 +947,6 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
break;
}
/*
* 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

View File

@ -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