Merge tag 'pwm/for-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry...
[linux-2.6-microblaze.git] / Documentation / filesystems / f2fs.rst
index 992bf91..09de6eb 100644 (file)
@@ -185,6 +185,7 @@ fault_type=%d                Support configuring fault injection type, should be
                         FAULT_KVMALLOC           0x000000002
                         FAULT_PAGE_ALLOC         0x000000004
                         FAULT_PAGE_GET           0x000000008
+                        FAULT_ALLOC_BIO          0x000000010 (obsolete)
                         FAULT_ALLOC_NID          0x000000020
                         FAULT_ORPHAN             0x000000040
                         FAULT_BLOCK              0x000000080
@@ -195,6 +196,7 @@ fault_type=%d                Support configuring fault injection type, should be
                         FAULT_CHECKPOINT         0x000001000
                         FAULT_DISCARD            0x000002000
                         FAULT_WRITE_IO           0x000004000
+                        FAULT_SLAB_ALLOC         0x000008000
                         ===================      ===========
 mode=%s                         Control block allocation mode which supports "adaptive"
                         and "lfs". In "lfs" mode, there should be no random
@@ -281,6 +283,18 @@ compress_extension=%s       Support adding specified extension, so that f2fs can enab
                         For other files, we can still enable compression via ioctl.
                         Note that, there is one reserved special extension '*', it
                         can be set to enable compression for all files.
+nocompress_extension=%s           Support adding specified extension, so that f2fs can disable
+                        compression on those corresponding files, just contrary to compression extension.
+                        If you know exactly which files cannot be compressed, you can use this.
+                        The same extension name can't appear in both compress and nocompress
+                        extension at the same time.
+                        If the compress extension specifies all files, the types specified by the
+                        nocompress extension will be treated as special cases and will not be compressed.
+                        Don't allow use '*' to specifie all file in nocompress extension.
+                        After add nocompress_extension, the priority should be:
+                        dir_flag < comp_extention,nocompress_extension < comp_file_flag,no_comp_file_flag.
+                        See more in compression sections.
+
 compress_chksum                 Support verifying chksum of raw data in compressed cluster.
 compress_mode=%s        Control file compression mode. This supports "fs" and "user"
                         modes. In "fs" mode (default), f2fs does automatic compression
@@ -289,6 +303,9 @@ compress_mode=%s     Control file compression mode. This supports "fs" and "user"
                         choosing the target file and the timing. The user can do manual
                         compression/decompression on the compression enabled files using
                         ioctls.
+compress_cache          Support to use address space of a filesystem managed inode to
+                        cache compressed block, in order to improve cache hit ratio of
+                        random read.
 inlinecrypt             When possible, encrypt/decrypt the contents of encrypted
                         files using the blk-crypto framework rather than
                         filesystem-layer encryption. This allows the use of
@@ -297,6 +314,14 @@ inlinecrypt                 When possible, encrypt/decrypt the contents of encrypted
                         Documentation/block/inline-encryption.rst.
 atgc                    Enable age-threshold garbage collection, it provides high
                         effectiveness and efficiency on background GC.
+discard_unit=%s                 Control discard unit, the argument can be "block", "segment"
+                        and "section", issued discard command's offset/size will be
+                        aligned to the unit, by default, "discard_unit=block" is set,
+                        so that small discard functionality is enabled.
+                        For blkzoned device, "discard_unit=section" will be set by
+                        default, it is helpful for large sized SMR or ZNS devices to
+                        reduce memory cost by getting rid of fs metadata supports small
+                        discard.
 ======================== ============================================================
 
 Debugfs Entries
@@ -717,10 +742,10 @@ users.
 ===================== ======================== ===================
 User                  F2FS                     Block
 ===================== ======================== ===================
-                      META                     WRITE_LIFE_NOT_SET
-                      HOT_NODE                 "
-                      WARM_NODE                "
-                      COLD_NODE                "
+N/A                   META                     WRITE_LIFE_NOT_SET
+N/A                   HOT_NODE                 "
+N/A                   WARM_NODE                "
+N/A                   COLD_NODE                "
 ioctl(COLD)           COLD_DATA                WRITE_LIFE_EXTREME
 extension list        "                        "
 
@@ -746,10 +771,10 @@ WRITE_LIFE_LONG       "                        WRITE_LIFE_LONG
 ===================== ======================== ===================
 User                  F2FS                     Block
 ===================== ======================== ===================
-                      META                     WRITE_LIFE_MEDIUM;
-                      HOT_NODE                 WRITE_LIFE_NOT_SET
-                      WARM_NODE                "
-                      COLD_NODE                WRITE_LIFE_NONE
+N/A                   META                     WRITE_LIFE_MEDIUM;
+N/A                   HOT_NODE                 WRITE_LIFE_NOT_SET
+N/A                   WARM_NODE                "
+N/A                   COLD_NODE                WRITE_LIFE_NONE
 ioctl(COLD)           COLD_DATA                WRITE_LIFE_EXTREME
 extension list        "                        "
 
@@ -814,19 +839,39 @@ Compression implementation
   all logical blocks in cluster contain valid data and compress ratio of
   cluster data is lower than specified threshold.
 
-- To enable compression on regular inode, there are three ways:
+- To enable compression on regular inode, there are four ways:
 
   * chattr +c file
   * chattr +c dir; touch dir/file
   * mount w/ -o compress_extension=ext; touch file.ext
   * mount w/ -o compress_extension=*; touch any_file
 
+- To disable compression on regular inode, there are two ways:
+
+  * chattr -c file
+  * mount w/ -o nocompress_extension=ext; touch file.ext
+
+- Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
+
+  * compress_extension=so; nocompress_extension=zip; chattr +c dir; touch
+    dir/foo.so; touch dir/bar.zip; touch dir/baz.txt; then foo.so and baz.txt
+    should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
+    can enable compress on bar.zip.
+  * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
+    dir/foo.so; touch dir/bar.zip; touch dir/baz.txt; then foo.so should be
+    compresse, bar.zip and baz.txt should be non-compressed.
+    chattr+c dir/bar.zip; chattr+c dir/baz.txt; can enable compress on bar.zip
+    and baz.txt.
+
 - At this point, compression feature doesn't expose compressed space to user
   directly in order to guarantee potential data updates later to the space.
   Instead, the main goal is to reduce data writes to flash disk as much as
   possible, resulting in extending disk life time as well as relaxing IO
-  congestion. Alternatively, we've added ioctl interface to reclaim compressed
-  space and show it to user after putting the immutable bit.
+  congestion. Alternatively, we've added ioctl(F2FS_IOC_RELEASE_COMPRESS_BLOCKS)
+  interface to reclaim compressed space and show it to user after putting the
+  immutable bit. Immutable bit, after release, it doesn't allow writing/mmaping
+  on the file, until reserving compressed space via
+  ioctl(F2FS_IOC_RESERVE_COMPRESS_BLOCKS) or truncating filesize to zero.
 
 Compress metadata layout::