Skip to contentSkip to conversation

Remove unused stuff

PATCH In review [email protected] 1 participant 2 messages Sep 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Remove unused stuff

And now that things are static, remove things that are not used.

 xfs_bmap.c       |   36 ------------------
 xfs_bmap_btree.c |   74 -------------------------------------
 xfs_bmap_btree.h |   11 -----
 xfs_da_btree.c   |   15 -------
 xfs_da_btree.h   |    1 
 xfs_error.c      |   26 -------------
 xfs_error.h      |    1 
 xfs_rtalloc.c    |  108 -------------------------------------------------------
 xfs_rtalloc.h    |   18 ---------
 9 files changed, 290 deletions(-)
xfs_da_btree.c +0 -15
Index: xfs-linux/xfs_da_btree.c
===================================================================
@@ -2166,21 +2166,6 @@ xfs_da_reada_buf(
 		return rval;
 }
 
-/*
- * Calculate the number of bits needed to hold i different values.
- */
-uint
-xfs_da_log2_roundup(uint i)
-{
-	uint rval;
-
-	for (rval = 0; rval < NBBY * sizeof(i); rval++) {
-		if ((1 << rval) >= i)
-			break;
-	}
-	return(rval);
-}
-
 kmem_zone_t *xfs_da_state_zone;	/* anchor for state struct zone */
 kmem_zone_t *xfs_dabuf_zone;		/* dabuf zone */
 
xfs_da_btree.h +0 -1
Index: xfs-linux/xfs_da_btree.h
===================================================================
@@ -249,7 +249,6 @@ int	xfs_da_shrink_inode(xfs_da_args_t *a
 					  xfs_dabuf_t *dead_buf);
 
 uint xfs_da_hashname(const uchar_t *name_string, int name_length);
-uint xfs_da_log2_roundup(uint i);
 xfs_da_state_t *xfs_da_state_alloc(void);
 void xfs_da_state_free(xfs_da_state_t *state);
 
xfs_bmap.c +0 -36
Index: xfs-linux/xfs_bmap.c
===================================================================
@@ -185,16 +185,6 @@ xfs_bmap_btree_to_extents(
 	int			*logflagsp, /* inode logging flags */
 	int			whichfork); /* data or attr fork */
 
-#ifdef DEBUG
-/*
- * Check that the extents list for the inode ip is in the right order.
- */
-STATIC void
-xfs_bmap_check_extents(
-	xfs_inode_t		*ip,		/* incore inode pointer */
-	int			whichfork);	/* data or attr fork */
-#endif
-
 /*
  * Called by xfs_bmapi to update file extent records and the btree
  * after removing space (or undoing a delayed allocation).
@@ -6046,32 +6036,6 @@ xfs_bmap_eof(
 }
 
 #ifdef DEBUG
-/*
- * Check that the extents list for the inode ip is in the right order.
- */
-STATIC void
-xfs_bmap_check_extents(
-	xfs_inode_t		*ip,		/* incore inode pointer */
-	int			whichfork)	/* data or attr fork */
-{
-	xfs_bmbt_rec_t		*ep;		/* current extent entry */
-	xfs_extnum_t		idx;		/* extent record index */
-	xfs_ifork_t		*ifp;		/* inode fork pointer */
-	xfs_extnum_t		nextents;	/* number of extents in list */
-	xfs_bmbt_rec_t		*nextp;		/* next extent entry */
-
-	ifp = XFS_IFORK_PTR(ip, whichfork);
-	ASSERT(ifp->if_flags & XFS_IFEXTENTS);
-	nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
-	ep = xfs_iext_get_ext(ifp, 0);
-	for (idx = 0; idx < nextents - 1; idx++) {
-		nextp = xfs_iext_get_ext(ifp, idx + 1);
-		xfs_btree_check_rec(XFS_BTNUM_BMAP, (void *)ep,
-			(void *)(nextp));
-		ep = nextp;
-	}
-}
-
 STATIC xfs_buf_t *
 xfs_bmap_get_bp(
 	xfs_btree_cur_t         *cur,
xfs_bmap_btree.c +0 -74

92 lines not on this page · raw message

xfs_bmap_btree.h +0 -11
Index: xfs-linux/xfs_bmap_btree.h
===================================================================
@@ -317,9 +317,7 @@ extern xfs_filblks_t xfs_bmbt_disk_get_b
 extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
 #else
 #define xfs_bmbt_disk_get_all(r, s)	xfs_bmbt_get_all(r, s)
-#define xfs_bmbt_disk_get_state(r)	xfs_bmbt_get_state(r)
 #define xfs_bmbt_disk_get_blockcount(r)	xfs_bmbt_get_blockcount(r)
-#define xfs_bmbt_disk_get_startblock(r)	xfs_bmbt_get_blockcount(r)
 #define xfs_bmbt_disk_get_startoff(r)	xfs_bmbt_get_startoff(r)
 #endif /* XFS_NATIVE_HOST */
 
@@ -356,15 +354,6 @@ extern void xfs_bmbt_to_bmdr(xfs_bmbt_bl
 extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t,
 				xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t);
 
-#ifdef DEBUG
-/*
- * Get the data from the pointed-to record.
- */
-extern int xfs_bmbt_get_rec(struct xfs_btree_cur *, xfs_fileoff_t *,
-				xfs_fsblock_t *, xfs_filblks_t *,
-				xfs_exntst_t *, int *);
-#endif
-
 #endif	/* __KERNEL__ */
 
 #endif	/* __XFS_BMAP_BTREE_H__ */
xfs_rtalloc.c +0 -108

117 lines not on this page · raw message

xfs_rtalloc.h +0 -18
Index: xfs-linux/xfs_rtalloc.h
===================================================================
@@ -134,24 +134,6 @@ xfs_rtpick_extent(
 	xfs_rtblock_t		*pick);	/* result rt extent */
 
 /*
- * Debug code: print out the value of a range in the bitmap.
- */
-void
-xfs_rtprint_range(
-	struct xfs_mount	*mp,	/* file system mount structure */
-	struct xfs_trans	*tp,	/* transaction pointer */
-	xfs_rtblock_t		start,	/* starting block to print */
-	xfs_extlen_t		len);	/* length to print */
-
-/*
- * Debug code: print the summary file.
- */
-void
-xfs_rtprint_summary(
-	struct xfs_mount	*mp,	/* file system mount structure */
-	struct xfs_trans	*tp);	/* transaction pointer */
-
-/*
  * Grow the realtime area of the filesystem.
  */
 int
xfs_error.c +0 -26
Index: xfs-linux/xfs_error.c
===================================================================
@@ -132,32 +132,6 @@ xfs_errortag_add(int error_tag, xfs_moun
 }
 
 int
-xfs_errortag_clear(int error_tag, xfs_mount_t *mp)
-{
-	int i;
-	int64_t fsid;
-
-	memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
-
-	for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
-		if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
-			xfs_etest[i] = 0;
-			xfs_etest_fsid[i] = 0LL;
-			kmem_free(xfs_etest_fsname[i],
-				  strlen(xfs_etest_fsname[i]) + 1);
-			xfs_etest_fsname[i] = NULL;
-			cmn_err(CE_WARN, "Cleared XFS error tag #%d",
-				error_tag);
-			return 0;
-		}
-	}
-
-	cmn_err(CE_WARN, "XFS error tag %d not on", error_tag);
-
-	return 1;
-}
-
-int
 xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud)
 {
 	int i;
xfs_error.h +0 -1
Index: xfs-linux/xfs_error.h
===================================================================
@@ -144,7 +144,6 @@ extern void xfs_error_test_init(void);
 #endif /* __ANSI_CPP__ */
 
 extern int xfs_errortag_add(int error_tag, xfs_mount_t *mp);
-extern int xfs_errortag_clear(int error_tag, xfs_mount_t *mp);
 extern int xfs_errortag_clearall(xfs_mount_t *mp);
 extern int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud);
 #else
#1 lore raw
Quoted 13 lines · [email protected] wrote:

And now that things are static, remove things that are not used.

 xfs_bmap.c       |   36 ------------------
 xfs_bmap_btree.c |   74 -------------------------------------
 xfs_bmap_btree.h |   11 -----
 xfs_da_btree.c   |   15 -------
 xfs_da_btree.h   |    1 
 xfs_error.c      |   26 -------------
 xfs_error.h      |    1 
 xfs_rtalloc.c    |  108 -------------------------------------------------------
 xfs_rtalloc.h    |   18 ---------
 9 files changed, 290 deletions(-)
Quoted 1 line

I suppose that if this code is deemed useful, maybe it could be moved to some xfs_*_debug.[ch] files so it's not lost....

Hm, or looks like some of it is used in userspace (xfs_da_log2_roundup) it could be moved there if not ever used in the kernel. (although from a quick look I'm not sure that's doing anything useful there either, anymore).

-Eric