Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
remove unused ffs_checkoverlap() ext2fs_checkoverlap()
To:
tech@openbsd.org
Date:
Sun, 6 Oct 2024 13:29:00 +1100

Download raw body.

Thread
  • Jonathan Gray:

    remove unused ffs_checkoverlap() ext2fs_checkoverlap()

Index: sys/ufs/ext2fs/ext2fs_extern.h
===================================================================
RCS file: /cvs/src/sys/ufs/ext2fs/ext2fs_extern.h,v
diff -u -p -r1.38 ext2fs_extern.h
--- sys/ufs/ext2fs/ext2fs_extern.h	20 Jan 2020 23:21:56 -0000	1.38
+++ sys/ufs/ext2fs/ext2fs_extern.h	6 Oct 2024 02:16:45 -0000
@@ -92,9 +92,6 @@ int	ext2fs_checkpath(struct inode *, str
 /* ext2fs_subr.c */
 int	ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **);
 int	ext2fs_vinit(struct mount *, struct vnode **);
-#ifdef DIAGNOSTIC
-void	ext2fs_checkoverlap(struct buf *, struct inode *);
-#endif
 
 /* ext2fs_vfsops.c */
 int	ext2fs_mountroot(void);
Index: sys/ufs/ext2fs/ext2fs_subr.c
===================================================================
RCS file: /cvs/src/sys/ufs/ext2fs/ext2fs_subr.c,v
diff -u -p -r1.37 ext2fs_subr.c
--- sys/ufs/ext2fs/ext2fs_subr.c	20 Oct 2021 06:35:39 -0000	1.37
+++ sys/ufs/ext2fs/ext2fs_subr.c	6 Oct 2024 02:17:12 -0000
@@ -110,37 +110,6 @@ ext2fs_bufatoff(struct inode *ip, off_t 
 }
 #endif
 
-#if defined(_KERNEL) && defined(DIAGNOSTIC)
-void
-ext2fs_checkoverlap(struct buf *bp, struct inode *ip)
-{
-	struct buf *ep;
-	struct vnode *vp;
-	daddr_t start, last;
-
-	start = bp->b_blkno;
-	last = start + btodb(bp->b_bcount) - 1;
-	LIST_FOREACH(ep, &bufhead, b_list) {
-		if (ep == bp || (ep->b_flags & B_INVAL) ||
-			ep->b_vp == NULLVP)
-			continue;
-		if (VOP_BMAP(ep->b_vp, 0, &vp, NULL, NULL))
-			continue;
-		if (vp != ip->i_devvp)
-			continue;
-		/* look for overlap */
-		if (ep->b_bcount == 0 || ep->b_blkno > last ||
-			ep->b_blkno + btodb(ep->b_bcount) <= start)
-			continue;
-		vprint("Disk overlap", vp);
-		printf("\tstart %lld, end %lld overlap start %lld, end %lld\n",
-			start, last, (long long)ep->b_blkno,
-			(long long)(ep->b_blkno + btodb(ep->b_bcount) - 1));
-		panic("Disk buffer overlap");
-	}
-}
-#endif /* DIAGNOSTIC */
-
 /*
  * Initialize the vnode associated with a new inode, handle aliased vnodes.
  */
Index: sys/ufs/ffs/ffs_extern.h
===================================================================
RCS file: /cvs/src/sys/ufs/ffs/ffs_extern.h,v
diff -u -p -r1.50 ffs_extern.h
--- sys/ufs/ffs/ffs_extern.h	13 May 2024 01:15:53 -0000	1.50
+++ sys/ufs/ffs/ffs_extern.h	6 Oct 2024 02:17:44 -0000
@@ -125,9 +125,6 @@ int ffs_truncate(struct inode *, off_t, 
 /* ffs_subr.c */
 int  ffs_bufatoff(struct inode *, off_t, char **, struct buf **);
 void ffs_fragacct(struct fs *, int, int32_t[], int);
-#ifdef DIAGNOSTIC
-void	ffs_checkoverlap(struct buf *, struct inode *);
-#endif
 int  ffs_isfreeblock(struct fs *, u_char *, daddr_t);
 int  ffs_isblock(struct fs *, u_char *, daddr_t);
 void ffs_clrblock(struct fs *, u_char *, daddr_t);
Index: sys/ufs/ffs/ffs_subr.c
===================================================================
RCS file: /cvs/src/sys/ufs/ffs/ffs_subr.c,v
diff -u -p -r1.34 ffs_subr.c
--- sys/ufs/ffs/ffs_subr.c	20 Oct 2021 06:35:39 -0000	1.34
+++ sys/ufs/ffs/ffs_subr.c	6 Oct 2024 02:18:03 -0000
@@ -119,38 +119,6 @@ ffs_fragacct(struct fs *fs, int fragmap,
 	}
 }
 
-#if defined(_KERNEL) && defined(DIAGNOSTIC)
-void
-ffs_checkoverlap(struct buf *bp, struct inode *ip)
-{
-	daddr_t start, last;
-	struct vnode *vp;
-	struct buf *ep;
-
-	start = bp->b_blkno;
-	last = start + btodb(bp->b_bcount) - 1;
-	LIST_FOREACH(ep, &bufhead, b_list) {
-		if (ep == bp || (ep->b_flags & B_INVAL) ||
-		    ep->b_vp == NULLVP)
-			continue;
-		if (VOP_BMAP(ep->b_vp, 0, &vp, NULL, NULL))
-			continue;
-		if (vp != ip->i_devvp)
-			continue;
-		/* look for overlap */
-		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 %lld, end %lld overlap start %llu, "
-		    "end %llu\n", (long long)start, (long long)last,
-		    (long long)ep->b_blkno,
-		    (long long)(ep->b_blkno + btodb(ep->b_bcount) - 1));
-		panic("Disk buffer overlap");
-	}
-}
-#endif /* DIAGNOSTIC */
-
 /*
  * block operations
  *