Btrfs SSD mount options

This post is about choosing the best performance options for Btrfs + SSD while still maximizing SSD lifetime. Here is my /etc/fstab mount options:

space_cache,compress=lzo,discard,noatime,nodiratime,subvol=root

Here is quotes from man pages, forums and wikis about options that I looking for. I decided to not to use autodefrag and inode_cache.

space_cache
          This space_cache option will be selected while mounting a
          mount point which has Btrfs file system. This will store the
          free space cache on the disk to make the caching of a block
          much faster. Without this, Btrfs has to scan the entire tree
          every time looking for the free space that can be allocated.
          If enabled, Kernel will have available FS free space block
          addresses in memory, thus when you create a new file it will
          immediately start writing data to disk.

noatime
          Do not update inode access times on this filesystem  (e.g.,  for
          faster access on the news spool to speed up news servers).

nodiratime
          Do not update directory inode access times on this filesystem.

Before setting discard check your version with sudo smartctl --info /dev/sda.

discard
          Enables discard/TRIM on freed blocks. Note that before SATA
          3.1, TRIM commands are synchronous and will block all I/O
          while running. This may cause short freezes while this
          happens, for example during a filesystem sync. You may not
          want to use discard in that case but enable regular trims
          instead.

To enable fstrim run this systemctl enable fstrim.timer

compress=lzo
          Enable compression. Starting with kernel 2.6.38 you can
          choose the algorithm for compression:
          compress=zlib - Better compression ratio. It's the default
          and safe for olders kernels.
          compress=lzo - Faster compression.
          compress=no - Disables compression (starting with kernel
          3.6).

inode_cache (since 3.0)
          Enable free inode number caching. Not recommended to use
          unless files on your filesystem get assigned inode numbers
          that are approaching 264. Normally, new files in each
          subvolume get assigned incrementally (plus one from the last
          time) and are not reused. The mount option turns on caching
          of the existing inode numbers and reuse of inode numbers of
          deleted files.
          This option may slow down your system at first run, or after
          mounting without the option.

autodefrag
    https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg30749.html


space_cache,compress=lzo,discard,noatime,nodiratime,subvol=root