Eleven Reads To Read

A vsfs-style file system is freshly mounted, so the superblock is in memory and every other structure is still on disk with an empty cache. A process runs:

int fd = open("/foo/bar", O_RDONLY);   /* bar is 12 KB, three 4 KB blocks */
read(fd, buf, 4096);
read(fd, buf, 4096);
read(fd, buf, 4096);
close(fd);

How many disk reads does the open() alone issue, and how many of the I/Os in the whole sequence touch the inode bitmap or the data bitmap?

A

3 reads for the open(), one inode per path component, since directory entries live inside the directory inode

B

5 reads for the open(), and 0 I/Os touch either bitmap

C

5 reads for the open() plus 1 read of the inode bitmap to confirm bar's inode is allocated

D

5 reads and 1 write for the open(), because open() stamps bar's last-accessed time