diff options
author | imp <imp@FreeBSD.org> | 2015-10-16 03:06:02 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2015-10-16 03:06:02 +0000 |
commit | fb9846240a79d4b543da5de2f53d6a00ca0716dc (patch) | |
tree | b645b593c9ddb3348779ef2881c631b54c1dee3d /sys/ufs/ffs | |
parent | f39349df451605ba8516f1c7c4bd1f2c7826b5ac (diff) | |
download | FreeBSD-src-fb9846240a79d4b543da5de2f53d6a00ca0716dc.zip FreeBSD-src-fb9846240a79d4b543da5de2f53d6a00ca0716dc.tar.gz |
Do not relocate extents to make them contiguous if the underlying drive can do
deletions. Ability to do deletions is a strong indication that this
optimization will not help performance. It will only generate extra write
traffic. These devices are typically flash based and have a limited number of
write cycles. In addition, making the file contiguous in LBA space doesn't
improve the access times from flash devices because they have no seek time.
Reviewed by: mckusick@
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index c587dfb..19c00de 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -481,9 +481,19 @@ ffs_reallocblks(ap) struct cluster_save *a_buflist; } */ *ap; { + struct ufsmount *ump; - if (doreallocblks == 0) + /* + * If the underlying device can do deletes, then skip reallocating + * the blocks of this file into contiguous sequences. Devices that + * benefit from BIO_DELETE also benefit from not moving the data. + * These devices are flash and therefore work less well with this + * optimization. Also skip if reallocblks has been disabled globally. + */ + ump = VTOI(ap->a_vp)->i_ump; + if (ump->um_candelete || doreallocblks == 0) return (ENOSPC); + /* * We can't wait in softdep prealloc as it may fsync and recurse * here. Instead we simply fail to reallocate blocks if this @@ -492,7 +502,7 @@ ffs_reallocblks(ap) if (DOINGSOFTDEP(ap->a_vp)) if (softdep_prealloc(ap->a_vp, MNT_NOWAIT) != 0) return (ENOSPC); - if (VTOI(ap->a_vp)->i_ump->um_fstype == UFS1) + if (ump->um_fstype == UFS1) return (ffs_reallocblks_ufs1(ap)); return (ffs_reallocblks_ufs2(ap)); } |