"Debian 12 Bookworm Minimal Install w/BTRFS " by JustAGuy Linux at 8:28 he sets an option for ssd,

mount -o ... ssd ...

What is the option ssd? When should it be used, and when should it not be used? I don't see it documented in man mount. But I did find it online, https://btrfs.readthedocs.io/en/latest/btrfs-man5.html

It says,

Since 4.14, the block layout optimizations have been dropped. This used to help with first generations of SSD devices. Their FTL (flash translation layer) was not effective and the optimization was supposed to improve the wear by better aligning blocks. This is no longer true with modern SSD devices and the optimization had no real benefit. Furthermore it caused increased fragmentation. The layout tuning has been kept intact for the option ssd_spread.

Without the "block layout optimizations" what else does the ssd option do to "control SSD allocation schemes"?

1 Answer 1


In Linux 6.5-rc3, there are only three references to the SSD options.

In fetch_cluster_info, the SSD option will allocate bigger clusters:

if (space_info->flags & BTRFS_BLOCK_GROUP_METADATA) {
    ret = &fs_info->meta_alloc_cluster;
    if (btrfs_test_opt(fs_info, SSD))
        *empty_cluster = SZ_2M;
        *empty_cluster = SZ_64K;
} else if ((space_info->flags & BTRFS_BLOCK_GROUP_DATA) &&
           btrfs_test_opt(fs_info, SSD_SPREAD)) {
    *empty_cluster = SZ_2M;
    ret = &fs_info->data_alloc_cluster;

In btrfs_find_space_cluster, the SSD option will disallow any fragmentation:

 * Choose the minimum extent size we'll require for this
 * cluster.  For SSD_SPREAD, don't allow any fragmentation.
 * For metadata, allow allocates with smaller extents.  For
 * data, keep it dense.
if (btrfs_test_opt(fs_info, SSD_SPREAD)) {
    cont1_bytes = bytes + empty_size;
    min_bytes = cont1_bytes;
} else if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) {
    cont1_bytes = bytes;
    min_bytes = fs_info->sectorsize;
} else {
    cont1_bytes = max(bytes, (bytes + empty_size) >> 2);
    min_bytes = fs_info->sectorsize;

In btrfs_sync_log:

/* when we're on an ssd, just kick the log commit out */
if (!btrfs_test_opt(fs_info, SSD) &&
    test_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state)) {

As a side note, this question came up once in the mailing list on 26 Mar 2020.

  • This is a really good answer I don't exactly understand all of it it, but it's a great start. The point is that the ssd option still does something other then "block layout optimizations" Jul 31 at 6:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .