static void cache_heuristic_check(int major) { int bufs, d; u64_t btotal, bfree, bused; fs_blockstats(&btotal, &bfree, &bused); bufs = fs_bufs_heuristic(10, btotal, bfree, fs_block_size, major); /* set the cache to the new heuristic size if the new one * is more than 10% off from the current one. */ d = bufs-nr_bufs; if(d < 0) d = -d; if(d*100/nr_bufs > 10) { cache_resize(fs_block_size, bufs); } }
/*===========================================================================* * fs_statvfs * *===========================================================================*/ int fs_statvfs(struct statvfs *st) { struct super_block *sp; int scale; u64_t used; sp = get_super(fs_dev); scale = sp->s_log_zone_size; fs_blockstats(&st->f_blocks, &st->f_bfree, &used); st->f_bavail = st->f_bfree; st->f_bsize = sp->s_block_size << scale; st->f_frsize = sp->s_block_size; st->f_iosize = st->f_frsize; st->f_files = sp->s_ninodes; st->f_ffree = count_free_bits(sp, IMAP); st->f_favail = st->f_ffree; st->f_namemax = MFS_DIRSIZ; return(OK); }