summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_cluster.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-11-13 01:01:44 +0000
committerdg <dg@FreeBSD.org>1998-11-13 01:01:44 +0000
commit841cc6703ab79abc6b11c4118fe76d9c2ebb4928 (patch)
tree6ae1a1728e4d3851ed26b50688f1ade64d59dc75 /sys/kern/vfs_cluster.c
parent514469df6671264fc270c9608d8cb26642f6b701 (diff)
downloadFreeBSD-src-841cc6703ab79abc6b11c4118fe76d9c2ebb4928.zip
FreeBSD-src-841cc6703ab79abc6b11c4118fe76d9c2ebb4928.tar.gz
Restored the "reallocblks" code to its former glory. What this does is
basically do a on-the-fly defragmentation of the FFS filesystem, changing file block allocations to make them contiguous. Thanks to Kirk McKusick for providing hints on what needed to be done to get this working.
Diffstat (limited to 'sys/kern/vfs_cluster.c')
-rw-r--r--sys/kern/vfs_cluster.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index c7f7f32..2fcdbd9 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
- * $Id: vfs_cluster.c,v 1.70 1998/09/04 08:06:55 dfr Exp $
+ * $Id: vfs_cluster.c,v 1.71 1998/10/25 17:44:52 phk Exp $
*/
#include "opt_debug_cluster.h"
@@ -43,6 +43,7 @@
#include <sys/proc.h>
#include <sys/buf.h>
#include <sys/vnode.h>
+#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/resourcevar.h>
#include <vm/vm.h>
@@ -57,10 +58,10 @@ static int rcluster= 0;
SYSCTL_INT(_debug, OID_AUTO, rcluster, CTLFLAG_RW, &rcluster, 0, "");
#endif
-#ifdef notyet_block_reallocation_enabled
+static MALLOC_DEFINE(M_SEGMENT, "cluster_save buffer", "cluster_save buffer");
+
static struct cluster_save *
cluster_collectbufs __P((struct vnode *vp, struct buf *last_bp));
-#endif
static struct buf *
cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn,
daddr_t blkno, long size, int run, struct buf *fbp));
@@ -539,16 +540,7 @@ cluster_write(bp, filesize)
* reallocating to make it sequential.
*/
cursize = vp->v_lastw - vp->v_cstart + 1;
-#ifndef notyet_block_reallocation_enabled
if (((u_quad_t) bp->b_offset + lblocksize) != filesize ||
- lbn != vp->v_lastw + 1 ||
- vp->v_clen <= cursize) {
- if (!async)
- cluster_wbuild(vp, lblocksize,
- vp->v_cstart, cursize);
- }
-#else
- if ((lbn + 1) * lblocksize != filesize ||
lbn != vp->v_lastw + 1 || vp->v_clen <= cursize) {
if (!async)
cluster_wbuild(vp, lblocksize,
@@ -583,7 +575,6 @@ cluster_write(bp, filesize)
return;
}
}
-#endif /* notyet_block_reallocation_enabled */
}
/*
* Consider beginning a cluster. If at end of file, make
@@ -822,7 +813,6 @@ cluster_wbuild(vp, size, start_lbn, len)
return totalwritten;
}
-#ifdef notyet_block_reallocation_enabled
/*
* Collect together all the buffers in a cluster.
* Plus add one additional buffer.
@@ -848,4 +838,3 @@ cluster_collectbufs(vp, last_bp)
buflist->bs_nchildren = i + 1;
return (buflist);
}
-#endif /* notyet_block_reallocation_enabled */
OpenPOWER on IntegriCloud