scfs.txt 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. SCFS (Samsung/Stackable Compression Filesystem)
  2. ===============================================
  3. [ sunghwan.yoon | jm45.kim | sangwoo2.lee | inbae.lee ] @ samsung.com
  4. v. 1.0.0 [12/12/2013] : first release
  5. v. 1.1.0 [12/26/2013] : async read, lower page cache invalidation
  6. v. 1.2.0 [06/20/2014] : major performance optimization (for reads)
  7. bug fixes, error handling
  8. What is SCFS
  9. ============
  10. 1. Overview
  11. SCFS is a proprietary filesystem developed for Samsung Android devices. Akin to
  12. the eCryptFS, SCFS is stackable on top of a native, "lower" filesystem, and is
  13. designed to provide per-cluster compression feature. Cluster size, compression
  14. algorithm type, and compression ratio threshold (CRT) are configurable parameters
  15. as mount options. (See further below for details)
  16. The current version of SCFS was developed for usage on the /system partition.
  17. Mounting on other devices or partitions is NOT recommended.
  18. SCFS works only with properly "formatted" partitions, either with the make_scfs
  19. tool, or proper SCFS writes (i.e. via cp command from an existing EXT4 partition).
  20. 2. Supported features:
  21. - regular file reads
  22. - regular file append writes
  23. - transparent compression/decompression
  24. - variable cluster size (16KB default)
  25. - various compression algorithms (LZO default)
  26. - variable compression ratio threshold
  27. 3. Unsupported features:
  28. - non-append writes (i.e. random or overwrites)
  29. - truncate
  30. - mmap for writes
  31. - bmap
  32. - debugfs-style tool support
  33. 4. Notes:
  34. - Some or all of the clusters in a given file may remain uncompressed.
  35. - In some cases, files may actually increase in size after compression,
  36. because of SCFS metadata and/or byte alignment padding appended:
  37. - A file with none of the clusters were compressed
  38. - A file, compressed with saved space less than that of alignment + metadata
  39. - Compression ratio threshold dictates how aggressively the cluster write routine
  40. will try to compress clusters: if set to low, only the clusters that are
  41. well-compressable will actually be compressed, and vice versa.
  42. Usage Guide
  43. ===========
  44. 1. Mounting SCFS
  45. mount -t scfs -o [ro|rw] <lower_dir> <upper_dir>
  46. ro,rw (default) same as ext4
  47. <lower_dir> mountpoint for the compressed system partition
  48. (/.system)
  49. <upper_dir> SCFS mountpoint, system partition
  50. (/system)
  51. 2. Unmounting SCFS
  52. *** IMPORTANT ***
  53. The <upper_dir> MUST BE unmounted BEFORE the <lower_dir> is unmounted:
  54. umount /system
  55. umount /.system
  56. 3. Miscellaneaous interface
  57. 3.1. statfs
  58. If f_type of struct statfs is 0x53305955 (SCFS_MAGIC), it is indicative of
  59. the filesystem for a given path being SCFS.
  60. 3.2. Kernel support for SCFS
  61. If /proc/filesystems list includes scfs, and sysfs node /sys/fs/scfs/system_type
  62. exists, then SCFS is enabled in the kernel.
  63. 3.3. System partition compressed flag
  64. Even if sysfs node /sys/fs/scfs/system_type exists, if it is read to be "ext4"
  65. instead of "scfs", the system partition is not formatted in SCFS.