SSD and gmirror

Dmitry Zamaruyev dmitry.zamaruyev at zoral.com.ua
Thu Aug 11 09:52:38 UTC 2011


Having troubles using gmirror device with TRIM.

Two SSDs on 8.2-STABLE, supports TRIM on device:

# camcontrol identify ada1
pass1: <OCZ-VERTEX2 1.33> ATA-8 SATA 2.x device
pass1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)

protocol              ATA/ATAPI-8 SATA 2.x
device model          OCZ-VERTEX2
...
data set management (TRIM)     yes

And if I create UFS directly on SSD with TRIM enabled all goes OK (-E
uses trim to erase SSD):

# newfs -U -E -t /dev/ada1
/dev/ada1: 57241.9MB (117231408 sectors) block size 16384, fragment
size 2048 using 312 cylinder groups of 183.72MB, 11758 blks, 23552
inodes. with soft updates
Erasing sectors [128...117231407]
super-block backups (for fsck -b #) at:
 160, 376416, .....

# mount -t ufs /dev/ada1 /mnt

But if I add device to gmirror, situation is different. Newfs passed
ok (so TRIM call propagated to devices?), but mount complaints:

# newfs -U -E -t /dev/mirror/gm0s1a 
/dev/mirror/gm0s1a: 57239.9MB (117227312 sectors) block size 16384,
fragment size 2048 using 312 cylinder groups of 183.72MB, 11758 blks,
23552 inodes. with soft updates
Erasing sectors [128...117227311]
super-block backups (for fsck -b #) at:
 160, 376416, ........

# mount -t ufs /dev/mirror/gm0s1a /mnt
WARNING: /mnt: TRIM flag on fs but cannot get whether disk supports TRIM

If we look at UFS source, after such warning received - TRIM got
disabled at FS level:

ufs/ffs/ffs_vfsops.c:
  996         if ((fs->fs_flags & FS_TRIM) != 0) {
  997                 size = sizeof(int);
  998                 if (g_io_getattr("GEOM::candelete", cp, &size,
  999                     &ump->um_candelete) == 0) {
 1000                         if (!ump->um_candelete)
 1001                                 printf(
 1002 "WARNING: %s: TRIM flag on fs but disk does not support TRIM\n",
 1003                                     mp->mnt_stat.f_mntonname);
 1004                 } else {
 1005                         printf(
 1006 "WARNING: %s: TRIM flag on fs but cannot get whether disk supports TRIM\n",
 1007                             mp->mnt_stat.f_mntonname);
 1008                         ump->um_candelete = 0; 
 1009                 }
 1010         }

How I could achieve that call g_io_getattr("GEOM::candelete"...) will return without
errors and stating that underlying disks support TRIM ?

В Thu, 4 Aug 2011 13:00:14 +0300
Dmitry Zamaruyev <dmitry.zamaruyev at zoral.com.ua> пишет:

> Hello list,
> 
> I'm looking for clarification regarding gmirror/geom behavior in
> current 8-STABLE.
> I want to use couple of SSD drives in mirror RAID configuration with
> UFS on top. I know that UFS now supports TRIM (BIO_DELETE) on plain
> disks.
> But will gmirror propagate BIO_DELETE event to lower driver, so both
> SSDs will get trimmed when UFS issue this command?
> 



-- 
Best regards,
Dmitry Zamaruyev,
System administrator.


More information about the freebsd-geom mailing list