Btrfsのbtrfs-transactionでioが100%になって困る

デスクトップ検索のRecollを試してみようと recollindex コマンドでindexを作ってみました.すると様々なアプリケーションがフリーズ.indexが出来るまでの辛抱だろうと1日ほど放置してみましたが解消しません.
1つのコマンドを発行して実行されるまで何分も掛かってしまいます.

cpuやmemoryはガラガラです.
iotop を叩いてみると btrfs-transaction がほぼ100%で張り付いています.

マウントオプションはこんな感じ.

$ mount | grep \ /\
/dev/mapper/t430s--vg-root on / type btrfs (rw,noatime,nodiratime,ssd,discard,space_cache,subvolid=5,subvol=/)

discard を `btrfs(5) ` で確認するとちょっと怪しいような?

       discard, nodiscard
           (default: off)

           Enable discarding of freed file blocks. This is useful for SSD devices, thinly provisioned LUNs, or virtual machine images; however, every storage layer must
           support discard for it to work. if the backing device does not support asynchronous queued TRIM, then this operation can severely degrade performance, because a
           synchronous TRIM operation will be attempted instead. Queued TRIM requires newer than SATA revision 3.1 chipsets and devices.

       If it is not necessary to immediately discard freed blocks, then the fstrim tool can be used to discard all free blocks in a batch. Scheduling a TRIM during a period
       of low system activity will prevent latent interference with the performance of other operations. Also, a device may ignore the TRIM command if the range is too
       small, so running a batch discard has a greater probability of actually discarding the blocks.

       If discarding is not necessary to be done at the block freeing time, there’s fstrim(8) tool that lets the filesystem discard all free blocks in a batch, possibly not
       much interfering with other operations. Also, the device may ignore the TRIM command if the range is too small, so running the batch discard can actually discard the
       blocks.

SATAのバージョンを確認すると 3.2 なので問題無さそう?

$ sudo smartctl --info /dev/sda | grep ^SATA
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)

でも一旦無効にしてみます.
#ついでに付けた compress=lzo は別でやるべきだった…….

$ time sudo mount -o remount,rw,noatime,nodiratime,ssd,nodiscard,compress=lzo,space_cache /
real    42m32.840s
user    0m0.014s
sys     0m15.209s
$ mount | grep \ /\
/dev/mapper/t430s--vg-root on / type btrfs (rw,noatime,nodiratime,compress=lzo,ssd,space_cache,subvolid=5,subvol=/)

これが当たりだったようでioは一気に空きました!
SATA 3.2 だけど何か別の条件が良くないのでしょうか?

忘れないうちに fstab も修正しておきます.(nodiscard は既定値なので書いていない)

 sudo git -C /etc diff HEAD^ -- /etc/fstab
diff --git a/fstab b/fstab
index b029749..386278f 100644
--- a/fstab
+++ b/fstab
@@ -5,7 +5,7 @@
 # that works even if disks are added and removed. See fstab(5).
 #
 # <file system> <mount point>   <type>  <options>       <dump>  <pass>
-/dev/mapper/t430s--vg-root /               btrfs   noatime,nodiratime,ssd,discard,space_cache 0       0
+/dev/mapper/t430s--vg-root /               btrfs   noatime,nodiratime,ssd,compress=lzo,space_cache 0       0
 # /boot was on /dev/sda2 during installation
 UUID=cba2591a-12da-481e-b239-c002faca22e1 /boot           ext2    defaults        0       2
 # /boot/efi was on /dev/sda1 during installation

これで暫く様子を見てみます.
問題なければ別途TRIMを設定したほうがいいかな?

環境

$ dpkg-query -W btrfs-progs iotop smartmontools
btrfs-progs     5.2.1-1
iotop   0.6-24-g733f3f8-1
smartmontools   7.0-2
$ sudo smartctl -i /dev/sda | grep -E '^Device Model:|Firmware Version:|SATA Version is:'
Device Model:     Seagate BarraCuda SSD ZA1000CM10002
Firmware Version: STAS1024
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です