>[оверквотинг удален]
> Ага, только проблема в том что для ssd и hdd удобны довольно
> разные "стили" обмена данными. Например, у SSD нет особого penalty за
> seek через полдевайса в отличие от винча. Зато ему очень удобно
> если данные валятся большими блоками, по размеру erase-block флеша и смещение
> этих данных - по началу блока накопителя. Еще файловая система может
> подыгрывать SSD высылая ему команду trim, указывающую что "мы больше вон
> те блоки не юзаем, можешь их подгрести GC'ом когда делать нечего".
> Сие улучшает скорость записи, т.к. контроллеру ssd приходится не решать проблемы
> по мере их возникновения, стопоря запись, а появляется шанс заранее дорогу
> расчистить, чтобы потом по ней "с ветерком" шпарить.PS
Собственно, поскольку как-то указывать что за ху из ху ниже файловой системы к железяке, приходят к таким решениям. Ну и сотвественно маленько меняется логика FS в отношении нижнего слоя.
# man newfs
....
-t Turn on the TRIM enable flag. If enabled, and if the underlying
device supports the BIO_DELETE command, the file system will send
a delete request to the underlying device for each freed block.
The trim enable flag is typically set when the underlying device
uses flash-memory as the device can use the delete command to
pre-zero or at least avoid copying blocks that have been deleted.
...
# less /usr/src/sys/ufs/ufs/ufsmount.h
/* This structure describes the UFS specific mount structure data. */
struct ufsmount {
...
int um_candelete; /* devvp supports TRIM */
...
}
# less /usr/src/sys/ufs/ffs/ffs_alloc.c
/*
* Nothing to delay if TRIM is disabled, or the operation is
* performed on the snapshot.
*/
if (!ump->um_candelete || devvp->v_type == VREG) {
ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd);
return;
}
И так далее.
# svn log /usr/src/sys/ufs/ffs/ffs_alloc.c
------------------------------------------------------------------------
r216796 | kib | 2010-12-29 15:25:28 +0300 (Wed, 29 Dec 2010) | 16 lines
Add kernel side support for BIO_DELETE/TRIM on UFS.
The FS_TRIM fs flag indicates that administrator requested issuing of
TRIM commands for the volume. UFS will only send the command to disk
if the disk reports GEOM::candelete attribute.
Since disk queue is reordered, data block is marked as free in the bitmap
only after TRIM command completed. Due to need to sleep waiting for
i/o to finish, TRIM bio_done routine schedules taskqueue to set the
bitmap bit.
Based on the patch by: mckusick
Reviewed by: mckusick, pjd
Tested by: pho
MFC after: 1 month
В данном примере, если правильно понял, если стоит флаг трим и трям, то битовые операции проводить в снимке системы.
Там еще всякое.