Cast back to int32_t in LFS_EST_BFREE and LFS_EST_RSVD macros, for

consistency with their arguments.

Change the debugging printf in lfs_reserve to match, and enclose it in
#ifdef DEBUG.

Tested on alpha, arm32, sparc.
This commit is contained in:
perseant 2000-09-13 00:07:56 +00:00
parent 022746fd14
commit a477e1b98b
2 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs.h,v 1.31 2000/09/09 04:49:54 perseant Exp $ */
/* $NetBSD: lfs.h,v 1.32 2000/09/13 00:07:56 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -550,7 +550,8 @@ struct segment {
* of segment summaries and inode blocks taken into account.
*/
/* Estimate number of clean blocks not available for writing */
#define LFS_EST_CMETA(F) ((((F)->lfs_dmeta * (u_int64_t)(F)->lfs_nclean) / \
#define LFS_EST_CMETA(F) (int32_t)((((F)->lfs_dmeta * \
(int64_t)(F)->lfs_nclean) / \
((F)->lfs_nseg - (F)->lfs_nclean)))
/* Estimate total size of the disk not including metadata */
@ -560,8 +561,9 @@ struct segment {
#define LFS_EST_BFREE(F) ((F)->lfs_bfree - LFS_EST_CMETA(F) - (F)->lfs_dmeta)
/* Amount of non-meta space not available to mortal man */
#define LFS_EST_RSVD(F) ((LFS_EST_NONMETA(F) * (u_int64_t)(F)->lfs_minfree) / \
100)
#define LFS_EST_RSVD(F) (int32_t)((LFS_EST_NONMETA(F) * \
(u_int64_t)(F)->lfs_minfree) / \
100)
/* Can credential C write BB blocks */
#define ISSPACE(F, BB, C) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_bio.c,v 1.29 2000/09/12 03:22:53 perseant Exp $ */
/* $NetBSD: lfs_bio.c,v 1.30 2000/09/13 00:07:56 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -142,11 +142,14 @@ lfs_reserve(fs, vp, nb)
while (nb > 0 && !lfs_fits(fs, nb + fs->lfs_ravail)) {
VOP_UNLOCK(vp, 0);
if (!slept)
if (!slept) {
#ifdef DEBUG
printf("lfs_reserve: waiting for %ld (bfree = %d,"
" est_bfree = %ld)\n",
" est_bfree = %d)\n",
nb + fs->lfs_ravail, fs->lfs_bfree,
(long)LFS_EST_BFREE(fs));
LFS_EST_BFREE(fs));
#endif
}
++slept;
/* Wake up the cleaner */