summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_vfsops.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-12-29 12:25:28 +0000
committerkib <kib@FreeBSD.org>2010-12-29 12:25:28 +0000
commit17dccd1898b6a0ddd49fcd77d7314ddc494cbac8 (patch)
treecaf44cb53e3be97531f2a851ce0a0a25b34c7ac1 /sys/ufs/ffs/ffs_vfsops.c
parente8862739b90ac36ae90c4552837b4959cbd54410 (diff)
downloadFreeBSD-src-17dccd1898b6a0ddd49fcd77d7314ddc494cbac8.zip
FreeBSD-src-17dccd1898b6a0ddd49fcd77d7314ddc494cbac8.tar.gz
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
Diffstat (limited to 'sys/ufs/ffs/ffs_vfsops.c')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 72f40da..f578382 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -895,6 +895,21 @@ ffs_mountfs(devvp, mp, td)
mp->mnt_stat.f_mntonname);
#endif
}
+ if ((fs->fs_flags & FS_TRIM) != 0) {
+ size = sizeof(int);
+ if (g_io_getattr("GEOM::candelete", cp, &size,
+ &ump->um_candelete) == 0) {
+ if (!ump->um_candelete)
+ printf(
+"WARNING: %s: TRIM flag on fs but disk does not support TRIM\n",
+ mp->mnt_stat.f_mntonname);
+ } else {
+ printf(
+"WARNING: %s: TRIM flag on fs but cannot get whether disk supports TRIM\n",
+ mp->mnt_stat.f_mntonname);
+ ump->um_candelete = 0;
+ }
+ }
ump->um_mountp = mp;
ump->um_dev = dev;
OpenPOWER on IntegriCloud