Re: TRIM support on SSD via ata(4)

2013-01-22 Thread Alexey Dokuchaev
On Tue, Jan 22, 2013 at 12:13:46PM +0700, Alexey Dokuchaev wrote:
 Unfortunately, I cannot use ahci(4) and limited to atacontrol(8), which
 does not have identify command like camcontrol(8).  Shall I recompile the
 kernel with ATA_CAM option?

I've switched to ATA_CAM and removed atadisk from /boot/loader.conf.  CAM
driver reported flags 0x896, which includes ADA_FLAG_CAN_TRIM (0x080).  In
adaregister() of /sys/cam/ata/ata_da.c, this is enough to in turn enable
DISKFLAG_CANDELETE disk flag:

if ((softc-flags  ADA_FLAG_CAN_TRIM) ||
((softc-flags  ADA_FLAG_CAN_CFA) 
!(softc-flags  ADA_FLAG_CAN_48BIT)))
softc-disk-d_flags |= DISKFLAG_CANDELETE;

In /sys/dev/ata/ata-disk.c, this check is different:

if ((atadev-param.support.command2  ATA_SUPPORT_CFA) ||
atadev-param.config == ATA_PROTO_CFA)
adp-disk-d_flags |= DISKFLAG_CANDELETE;

Since this disk evidently does not support CFA, ata(4) was not raising
DISKFLAG_CANDELETE flag.

With CAM_ATA, I can now use camcontrol(8) to talk to my disks:

# camcontrol identify ada0 | egrep TRIM\|Feature
Feature  Support  Enabled   Value   Vendor
data set management (TRIM) yes

TRIM on fs but drive does not have it warning is gone.  I wonder why
legacy ata(4) did not enable TRIM though.

./danfe
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


TRIM support on SSD via ata(4)

2013-01-21 Thread Alexey Dokuchaev
Hi there,

I've just bought this Crucial M4 SSD few days ago as a (hopefully) nice
upgrade option for my old laptop (I'm currently using it via SATA-IDE
cdrom bay).  Not the best setup, but alas I see no other options for me
due to lack of any real SATA ports and an old controller (my system is
recent 8.3-STABLE):

$ pciconf -lv | grep -i ata
atapci0@pci0:0:31:1:class=0x01018a card=0x83191033 chip=0x266f8086
rev=0x04 hdr=0x00
device = 'PATA100 Controller - 266F (82801FB/FBM/FW/FR/FRW)'
subclass   = ATA

Anyway, drive is recognized and seems to work quite fine, but one thing
in dmesg puzzles me when I mount filesystem from SSD:

TRIM flag on fs but disk does not support TRIM

Under Linux, hdparm(8) reports that TRIM is supported, so I'm wondering
why FreeBSD does not see it.  My ata(4) support in /boot/loader.conf looks
like this (little to none hardware support is compiled into the kernel):

ataintel_load=YES
atadisk_load=YES
atapci_load=YES

$ kldstat | grep ata
201 0xc0a65000 4734 atadisk.ko
215 0xc0a6a000 e398 ata.ko
223 0xc0a79000 80d4 atapci.ko
381 0xc0afc000 76ec ataintel.ko
392 0xc0b04000 6f50 ataahci.ko

Unfortunately, I cannot use ahci(4) and limited to atacontrol(8), which
does not have identify command like camcontrol(8).  Shall I recompile the
kernel with ATA_CAM option?  Is there way to force TRIM support, perhaps by
sending ATA commands directly to the drive?  Thanks,

./danfe

P.S.  Buying a new laptop is the easiest solution, but I do not want to do
that for various reasons, mostly because it's quite hard to find one that
would be nicely supported by FreeBSD these days.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org