summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorperseant <perseant@NetBSD.org>2006-04-14 00:58:32 +0000
committerperseant <perseant@NetBSD.org>2006-04-14 00:58:32 +0000
commit0cdeebe9fa148dd0583607d7b7770eb6b6c353ee (patch)
tree78b23f27c5f1f7c732b4861e04a482bac8057149 /libexec
parent81ded5df65283dbb274f7af8d67cf788fc0c6bc7 (diff)
When checking hidden cleaning costs, don't erroneously add the first
indirect block when considering the cleaning of block numbers less than NDADDR (which do not use indirect blocks). Also, note the loss of only half a block per segment to fragmentation when considering the benefit function, rather than a whole block.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/lfs_cleanerd/lfs_cleanerd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libexec/lfs_cleanerd/lfs_cleanerd.c b/libexec/lfs_cleanerd/lfs_cleanerd.c
index 27aac9167ca..9b9599da1f1 100644
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.4 2006/04/05 21:42:49 perseant Exp $ */
+/* $NetBSD: lfs_cleanerd.c,v 1.5 2006/04/14 00:58:32 perseant Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -694,7 +694,7 @@ calc_cb(struct clfs *fs, int sn, struct clfs_seguse *t)
benefit = (int64_t)fs->lfs_ssize - t->nbytes -
(t->nsums + 1) * fs->lfs_fsize;
if (fs->lfs_bsize > fs->lfs_fsize) /* fragmentation */
- benefit -= fs->lfs_bsize;
+ benefit -= (fs->lfs_bsize / 2);
if (benefit <= 0) {
t->priority = 0;
return;
@@ -937,6 +937,9 @@ check_hidden_cost(struct clfs *fs, BLOCK_INFO *bip, int bic, off_t *ifc)
}
if (bip[i].bi_lbn == LFS_UNUSED_LBN)
continue;
+ if (bip[i].bi_lbn < NDADDR)
+ continue;
+
ufs_getlbns((struct lfs *)fs, NULL, (daddr_t)bip[i].bi_lbn, in, &num);
for (j = 0; j < num; j++) {
check_or_add(bip[i].bi_inode, in[j].in_lbn,