Re: mkfs.btrfs vs fstrim on an SD Card (not SSD)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I may have answered my own question using strace. And for whatever reason this time fstrim worked.

fstrim
ioctl(3, FITRIM, 0x7fffbf6b87e0) 
…
write(1, "/mnt/: 13.9 MiB (14598144 bytes)"…, 41/mnt/: 13.9 MiB (14598144 bytes) trimmed

Clearly this is only erasing what the file system is aware of having been recently deleted, even though it's a bit off as I'd just deleted a 6.1MB file.



mkfs.btrs:

ioctl(3, BLKGETSIZE64, 14729330176)     = 0
ioctl(3, BLKDISCARD, {0, 7fff920ee4a0}) = 0
write(2, "Performing full device TRIM (13."..., 43Performing full device TRIM (13.72GiB) ...
) = 43
ioctl(3, BLKDISCARD, {0, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {40000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {80000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {c0000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {100000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {140000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {180000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {1c0000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {200000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {240000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {280000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {2c0000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {300000000, 7fff920ee4a0}) = 0
ioctl(3, BLKDISCARD, {340000000, 7fff920ee4a0}) = 0

And this blew away everything on that partition.

Since the SD Card spec references a completely different command than the ATA spec (TRIM), I don't think either one of these are TRIM, even if functionally equivalent. Instead the SD Card ERASE_* commands are probably being used, but I can't confirm this because writes to /dev/mmcblk0 aren't showing up with:

echo scsi:scsi_dispatch_cmd_start > /sys/kernel/debug/tracing/set_event 
echo 1 > /sys/kernel/debug/tracing/tracing_on
cat /sys/kernel/debug/tracing/trace_pipe


Chris Murphy--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux