minix/minix/fs/isofs/stadir.c
Jean-Baptiste Boric b1d068470b isofs: reworked for better performance
isofs now uses an in-memory directory listing built on-the-fly instead
of parsing the ISO 9660 data structures over and over for almost every
request. This yields huge performance improvements.

The directory listing is allocated dynamically, but Minix servers aren't
normally supposed to do that because critical servers would crash if the
system runs out of memory. isofs is quite frugal, won't allocate memory
after having the whole directory tree cached and is not that critical
(its most important job is to serve as a root file system during
installation).

The benefits and elegance of this scheme far outweights this small
problem in practice.

Change-Id: I13d070388c07d274cbee0645cbc50295c447c5b6
2015-10-07 12:40:24 +02:00

28 lines
485 B
C

#include "inc.h"
#include <sys/stat.h>
#include <sys/statvfs.h>
int fs_stat(ino_t ino_nr, struct stat *statbuf)
{
struct inode *rip;
if ((rip = get_inode(ino_nr)) == NULL)
return EINVAL;
*statbuf = rip->i_stat;
return OK;
}
int fs_statvfs(struct statvfs *st)
{
st->f_flag = ST_NOTRUNC;
st->f_bsize = v_pri.logical_block_size_l;
st->f_frsize = st->f_bsize;
st->f_iosize = st->f_bsize;
st->f_blocks = v_pri.volume_space_size_l;
st->f_namemax = NAME_MAX;
return OK;
}