From 0196d962928b6af11993a8b5faedfdf7c4dd8029 Mon Sep 17 00:00:00 2001 From: mckusick Date: Sun, 10 Jul 2011 05:34:49 +0000 Subject: [PATCH] When first creating snapshots, we may free some blocks within it. These blocks should not have TRIM applied to them. Submitted by: Kostik Belousov --- sys/ufs/ffs/ffs_alloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 6d27ace13c7e..357b152fcb26 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -2038,7 +2038,11 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum, vtype, dephd) ffs_snapblkfree(fs, devvp, bno, size, inum, vtype, dephd)) { return; } - if (!ump->um_candelete) { + /* + * 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; }