Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Aug 2011 12:51:43 +0300
From:      Dmitry Zamaruyev <dmitry.zamaruyev@zoral.com.ua>
To:        Dmitry Zamaruyev <dmitry.zamaruyev@zoral.com.ua>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: SSD and gmirror
Message-ID:  <20110811125143.6a70fb4a@ghost.kharkov.zoral.com.ua>
In-Reply-To: <20110804130014.0df63364@ghost.kharkov.zoral.com.ua>
References:  <20110804130014.0df63364@ghost.kharkov.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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=20
/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) !=3D 0) {
  997                 size =3D sizeof(int);
  998                 if (g_io_getattr("GEOM::candelete", cp, &size,
  999                     &ump->um_candelete) =3D=3D 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 TR=
IM\n",
 1007                             mp->mnt_stat.f_mntonname);
 1008                         ump->um_candelete =3D 0;=20
 1009                 }
 1010         }

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

=D0=92 Thu, 4 Aug 2011 13:00:14 +0300
Dmitry Zamaruyev <dmitry.zamaruyev@zoral.com.ua> =D0=BF=D0=B8=D1=88=D0=B5=
=D1=82:

> Hello list,
>=20
> 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?
>=20



--=20
Best regards,
Dmitry Zamaruyev,
System administrator.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110811125143.6a70fb4a>