Skip to contentSkip to conversation

will mkfs.btrfs do an initial pre-discard for SSDs like mke2fs does for Ext4?

DISCUSSION Werner Fischer 2 participants 2 messages Jul 3, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi all,

are there any plans that future versions of mkfs.btrfs will do an initial pre-discard for SSDs? (AFAIK mkfs.btrfs does not do this currently)

For Ext4, mke2fs does this with the -E discard option.

Quoted 1 line

From the mke2fs manpage:

-E discard
Attempt to discard blocks at mkfs time (discarding blocks initially is useful on solid state devices and sparse / thin-provisioned storage). When the device advertises that discard also zeroes data (any subsequent read after the discard and before write returns zero), then mark all not-yet-zeroed inode tables as zeroed. This significantly speeds up filesystem initialization. This is set as default.

Best regards,
Werner

#1 lore raw
Quoted 5 lines · Werner Fischer

Hi all,

are there any plans that future versions of mkfs.btrfs will do an initial pre-discard for SSDs? (AFAIK mkfs.btrfs does not do this currently)

It should already have it. That is, if you look in the right place

commit e6bd18d8938986c997c45f0ea95b221d4edec095

Author: Christoph Hellwig <[email protected]>
Date:   Thu Apr 21 16:24:07 2011 -0400

btrfs-progs: add discard support to mkfs

Discard the whole device before starting to create the filesystem
structures.
Modelled after similar support in mkfs.xfs.

IIRC it's already in tmp branch of Chris' btrfs-progs-unstable, but not in master (yet).

Signature · 1 line
Fajar