-#if defined(KERNEL) && DIAGNOSTIC
-void
-ffs_checkoverlap(bp, ip)
- struct buf *bp;
- struct inode *ip;
-{
- register struct buf *ebp, *ep;
- register ufs_daddr_t start, last;
- struct vnode *vp;
-#ifdef NeXT
- int devBlockSize=0;
-#endif /* NeXT */
-
- ebp = &buf[nbuf];
- start = bp->b_blkno;
-#ifdef NeXT
- VOP_DEVBLOCKSIZE(ip->i_devvp,&devBlockSize);
- last = start + btodb(bp->b_bcount, devBlockSize) - 1;
-#else
- last = start + btodb(bp->b_bcount) - 1;
-#endif /* NeXT */
- for (ep = buf; ep < ebp; ep++) {
- if (ep == bp || (ep->b_flags & B_INVAL) ||
- ep->b_vp == NULLVP)
- continue;
- if (VOP_BMAP(ep->b_vp, (ufs_daddr_t)0, &vp, (ufs_daddr_t)0,
- NULL))
- continue;
- if (vp != ip->i_devvp)
- continue;
- /* look for overlap */
-#ifdef NeXT
- if (ep->b_bcount == 0 || ep->b_blkno > last ||
- ep->b_blkno + btodb(ep->b_bcount, devBlockSize) <= start)
- continue;
- vprint("Disk overlap", vp);
- (void)printf("\tstart %d, end %d overlap start %d, end %d\n",
- start, last, ep->b_blkno,
- ep->b_blkno + btodb(ep->b_bcount, devBlockSize) - 1);
-#else
- if (ep->b_bcount == 0 || ep->b_blkno > last ||
- ep->b_blkno + btodb(ep->b_bcount) <= start)
- continue;
- vprint("Disk overlap", vp);
- (void)printf("\tstart %d, end %d overlap start %d, end %d\n",
- start, last, ep->b_blkno,
- ep->b_blkno + btodb(ep->b_bcount) - 1);
-#endif /* NeXT */
- panic("Disk buffer overlap");
- }
-}
-#endif /* DIAGNOSTIC */
-