As per my understanding kernel maintains 4 tables.

  1. Per process FD table.
  2. System wide open file table struct file
  3. Inode (in-memory) table struct vnode
  4. Inode (on-disk) table.

struct file have one field named struct file_operations f_ops; which contains FS specific operations like ext2_read(), ext2_write();

struct vnode also have one field struct vnodeops v_op; which contains FS specific operations too.

My question is why we have similar functionalities inside both? Or am I getting something wrong? Are things different in Unix and Linux? Because I did not find struct vnode inside Linux's fs.h

Reference: https://www.usna.edu/Users/cs/wcbrown/courses/IC221/classes/L09/Class.html

Diagram (from "Unix internals new frontiers" book)

enter image description here


Okay, I have found the answer.

In previous versions of Unix like SVR4, struct file does not contain file_operations field and all operations e.g. read, write etc. contained by vnode->v_op.

However, in case of Linux struct file will contain file_operations field which will have functions like open, read, write etc. and struct inode (similar to vnode) will contain inode_operations field which will have operations like lookup, link, unlink, symlink, rmdir, mkdir, rename, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.