sysprog21 / simplefs

A simple native file system for Linux kernel
Other
365 stars 91 forks source link

Call drop_nlink() when unlink a file #8

Closed colinyoyo26 closed 4 years ago

colinyoyo26 commented 4 years ago

Set inode's link properly when unlink a file.

The following error would occur when use make check to test the file system before this modification: ls: cannot read symbolic link 'symlink': Invalid argument

Also replace inode_inc_link_count() and inode_dec_link_count() with inc_nlink() and drop_nlink() if mark_inode_dirty() would be called after it to avoid redundant call of mark_inode_dirty().