Skip to contentSkip to conversation

sata_nv silently ignores discard (TRIM) command?

DISCUSSION Alberto Mattea 2 participants 5 messages Jan 14, 2011

lore
Share & tools
lore
#0 lore raw

Hello all.
I'm testing linux 2.6.37 final with a Crucial RealSSD C300 (256GB). The chipset is a nforce 570 (M2N32-SLI Deluxe); lspci:
IDE interface [0101]: nVidia Corporation MCP55 SATA Controller [10de:037f] (rev a2) (prog-if 85 [Master SecO PriO])
Subsystem: ASUSTeK Computer Inc. Device [1043:cb84]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-

        Latency: 0 (750ns min, 250ns max)
        Interrupt: pin C routed to IRQ 21
        Region 0: I/O ports at f200 [size=8]
        Region 1: I/O ports at f100 [size=4]
        Region 2: I/O ports at f000 [size=8]
        Region 3: I/O ports at ef00 [size=4]
        Region 4: I/O ports at ee00 [size=16]
        Region 5: Memory at fe02b000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [44] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 

PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [b0] MSI: Enable- Count=1/4 Maskable- 64bit+
Address: 0000000000000000 Data: 0000
Capabilities: [cc] HyperTransport: MSI Mapping Enable+ Fixed+ Kernel driver in use: sata_nv
Kernel modules: sata_nv

On the device there is a single ext4 partition, mounted with -o discard. Dmesg:
EXT4-fs (sda1): re-mounted. Opts: errors=remount- ro,discard,data=writeback,commit=0

To test whether TRIM is working, I did the following:

# dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct
# hdparm --fibmap tempfile
(File begins at 66090496)
# hdparm --read-sector 66090496 /dev/sda
(Random data)
# rm tempfile
# sync
# hdparm --read-sector 66090496 /dev/sda
Now, if I'm correct after a successful TRIM the last command should output all 
zeroes, but exactly the same random data is reported instead. However, there 
is nothing in dmesg about TRIM failing. Does sata_nv support TRIM on the 570?
Thanks
Alberto
#1 lore raw
Quoted 34 lines · Alberto Mattea

Hello all.
I'm testing linux 2.6.37 final with a Crucial RealSSD C300 (256GB). The chipset is a nforce 570 (M2N32-SLI Deluxe); lspci:
IDE interface [0101]: nVidia Corporation MCP55 SATA Controller [10de:037f] (rev a2) (prog-if 85 [Master SecO PriO])
Subsystem: ASUSTeK Computer Inc. Device [1043:cb84]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-

        Latency: 0 (750ns min, 250ns max)
        Interrupt: pin C routed to IRQ 21
        Region 0: I/O ports at f200 [size=8]
        Region 1: I/O ports at f100 [size=4]
        Region 2: I/O ports at f000 [size=8]
        Region 3: I/O ports at ef00 [size=4]
        Region 4: I/O ports at ee00 [size=16]
        Region 5: Memory at fe02b000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [44] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 

PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [b0] MSI: Enable- Count=1/4 Maskable- 64bit+
Address: 0000000000000000 Data: 0000
Capabilities: [cc] HyperTransport: MSI Mapping Enable+ Fixed+ Kernel driver in use: sata_nv
Kernel modules: sata_nv

On the device there is a single ext4 partition, mounted with -o discard. Dmesg:
EXT4-fs (sda1): re-mounted. Opts: errors=remount- ro,discard,data=writeback,commit=0

To test whether TRIM is working, I did the following:

Quoted 11 lines
# dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct
# hdparm --fibmap tempfile
(File begins at 66090496)
# hdparm --read-sector 66090496 /dev/sda
(Random data)
# rm tempfile
# sync
# hdparm --read-sector 66090496 /dev/sda
Now, if I'm correct after a successful TRIM the last command should output all 
zeroes, but exactly the same random data is reported instead. However, there 
is nothing in dmesg about TRIM failing. Does sata_nv support TRIM on the 570?

What does 'cat /sys/block/sda/queue/discard_zeroes_data' say?

Cheers,
Jeff

#2 lore raw

In data venerdì 14 gennaio 2011 19:32:45, Jeff Moyer ha scritto:

Quoted 5 lines

What does 'cat /sys/block/sda/queue/discard_zeroes_data' say?

Cheers,
Jeff

Hi Jeff, it says 0. So I assume it's not working?
Thanks
Alberto

#3 lore raw
Quoted 7 lines · Alberto Mattea

In data venerdì 14 gennaio 2011 19:32:45, Jeff Moyer ha scritto:

Quoted 5 lines

What does 'cat /sys/block/sda/queue/discard_zeroes_data' say?

Cheers,
Jeff

Hi Jeff, it says 0. So I assume it's not working?

That means that discarded blocks are not zeroed. The trim was likely processed just fine.

Cheers,
Jeff

#4 lore raw
Quoted 6 lines

That means that discarded blocks are not zeroed. The trim was likely processed just fine.

Cheers,
Jeff

Thanks a lot! I was already worrying about changing motherboard. Bye
Alberto