[f2fs] Add vnode flag and Clean up vnode locking

It adds new members to InodeInfoFlag emum class to track
vnode state in vnode_cache. kInit means that vnode is
being initiailzed and not ready for use. kDirty indicates
that vnode needs to be written to disk and kept in dirty_list.
kActive means that vnode has valid open_count, and it prevents
from making unnecessary RefPtr from vnode_cache when the vnode
is being recycled. kBad means that vnode should be dropped without
purging. kBad can be set if one makes new RefPtr for a vnode that
someone already created. When one tries to access a unstable vnode
in unstable state, it is put into VnodeF2fs::flag_cvar_ waiting for
regarding flags to be clear. Also, this change removes unnecessary
VnodeF2fs::i_mutex that protects the same region as fs_lock.

BUG: 78148

Test: fx test f2fs-unittest f2fs-fs-tests f2fs-slow-fs-tests

Change-Id: Id009e18bdb4f68ef0777feb9488c394fb4b4e3da
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/f2fs/+/567021
Reviewed-by: Brett Wilson <brettw@google.com>
17 files changed
tree: 1892c33f1a549b2850066bce8d93c6c77762f448
  1. patches/
  2. test/
  3. test_files/
  4. third_party/
  5. tools/
  6. admin.cc
  7. admin.h
  8. AUTHORS
  9. bcache.cc
  10. bcache.h
  11. BUILD.gn
  12. checkpoint.cc
  13. CONTRIBUTING.md
  14. data.cc
  15. dir.cc
  16. dir.h
  17. dir_hash.cc
  18. f2fs.cc
  19. f2fs.h
  20. f2fs_internal.h
  21. f2fs_layout.h
  22. f2fs_lib.h
  23. f2fs_types.h
  24. file.cc
  25. file.h
  26. fsck.cc
  27. fsck.h
  28. gc.cc
  29. inline.cc
  30. LICENSE
  31. mkfs.cc
  32. mkfs.h
  33. mount.cc
  34. mount.h
  35. namei.cc
  36. namestring.h
  37. node.cc
  38. node.h
  39. PATENTS
  40. query.cc
  41. query.h
  42. README.md
  43. recovery.cc
  44. segment.cc
  45. segment.h
  46. super.cc
  47. vnode.cc
  48. vnode.h
  49. vnode_cache.cc
  50. vnode_cache.h
README.md

What is F2FS?

F2FS is the most commonly used log-structured file system in Linux. It supports flash-friendly features such as adaptive logging, multi-head logging, fsync acceleration, and node address translation. For more information see: https://www.usenix.org/conference/fast15/technical-sessions/presentation/lee

Major Release

1st release (Apr-06-2021)

  • Features: mkfs, mount/umount, read, write, rmdir, mkdir, rename, fsync, lseek, link, unlink
  • Remarks
  • Fuchsia base code ; Thu Mar 11 08:53:24 2021 Prashanth Swaminathan,76a08ad1474 [speak] Migrate to new component templates
  • There is no cache. Every request is handled as a synchronous operation.
  • fsync() triggers checkpointing
  • lock granularity: file operation
  • LFS is used for block allocation by default, and IPU is forced when the number of free sections is below 50%.
  • no background/foreground gc
  • disable the roll-forward recovery
  • 6 active logs
  • disable the ext-identify feature
  • block allocation: LFS, IPU
  • fsck do nothing, but it returns true
  • no discard

2nd release (May-28-2021)

  • Features: truncate, ssr, fsync, recovery
  • Remarks
  • Fuchsia base code ; Thu May 20 07:25:45 2021 Yilong Li, 02c0dfff0fdb
  • support the roll-forward recovery and file level fsync()
  • block allocation: LFS, IPU, SSR
  • truncate

3rd release (June-25-2021)

  • Features: fsck, mount option, mkfs option
  • all fs-tests and large-fs-tests passed
  • Remarks
  • fsck (base: 7f35b548d4b)
  • support the ext-identify feature
  • support discard

4th release (July-30-2021)

  • Features: vnode cache, inline dentry
  • unit test coverage

5th release (August-27-2021)

  • Features: dentry cache
  • Landing
  • Linux compatibility test coverage

6th release (September-30-2021 ~)

  • Features: gc, node cache, pager support, mmap, wb, readahead, ... (as new fuchsia features coming)
  • stress test coverage
  • performance test

How to build

$ fx set core.x64 --with-base //bundles:tools --with-base //bundles:tests --with-base third_party/f2fs
(see third_party/f2fs/test_files/README.md for test)