fixed bug that caused number of inodes to make estimation to be terrible
in most cases
This commit is contained in:
parent
0d31130d29
commit
75689debe3
1 changed files with 6 additions and 3 deletions
|
@ -39,8 +39,8 @@
|
||||||
#include "../../servers/fs/super.h"
|
#include "../../servers/fs/super.h"
|
||||||
#include <minix/fslib.h>
|
#include <minix/fslib.h>
|
||||||
|
|
||||||
#ifndef min
|
#ifndef max
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
|
@ -267,7 +267,7 @@ char *argv[];
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
int kb;
|
int kb;
|
||||||
kb = blocks * (min(block_size,1024) / 1024);
|
kb = blocks * (max(block_size,1024) / 1024);
|
||||||
/* The default for inodes is 2 blocks per kb, rounded up
|
/* The default for inodes is 2 blocks per kb, rounded up
|
||||||
* to fill an inode block. Above 20M, the average files are
|
* to fill an inode block. Above 20M, the average files are
|
||||||
* sure to be larger because it is hard to fill up 20M with
|
* sure to be larger because it is hard to fill up 20M with
|
||||||
|
@ -280,9 +280,12 @@ char *argv[];
|
||||||
if (kb >= 60000) i = kb / 5;
|
if (kb >= 60000) i = kb / 5;
|
||||||
if (kb >= 80000) i = kb / 6;
|
if (kb >= 80000) i = kb / 6;
|
||||||
if (kb >= 100000) i = kb / 7;
|
if (kb >= 100000) i = kb / 7;
|
||||||
|
|
||||||
|
/* round up to fill inode block */
|
||||||
i += inodes_per_block - 1;
|
i += inodes_per_block - 1;
|
||||||
i = i / inodes_per_block * inodes_per_block;
|
i = i / inodes_per_block * inodes_per_block;
|
||||||
if (i > INODE_MAX) i = INODE_MAX;
|
if (i > INODE_MAX) i = INODE_MAX;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (blocks < 5) pexit("Block count too small");
|
if (blocks < 5) pexit("Block count too small");
|
||||||
if (blocks > max_nrblocks) pexit("Block count too large");
|
if (blocks > max_nrblocks) pexit("Block count too large");
|
||||||
|
|
Loading…
Reference in a new issue