misc/173254: Upgrade requests used in ZFS trim map based on ashi

看板FB_bugs作者時間12年前 (2013/04/27 12:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
>Number: 173254 >Category: misc >Synopsis: Upgrade requests used in ZFS trim map based on ashift (patch included) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 01 04:10:01 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Steven Hartland >Release: 8.3-RELEASE >Organization: Multiplay >Environment: FreeBSD dev 8.3-RELEASE-p4 FreeBSD 8.3-RELEASE-p4 #22: Mon Sep 17 17:18:32 UTC 2012 root@dev:/usr/obj/usr/src/sys/MULTIPLAY amd64 >Description: Upgrades trim free request sizes before inserting them into to free map, making range consolidation much more effective particularly for small deletes. This reduces memory used by the free map as well as reducing the number of bio requests down to geom required to process all deletes. In tests this achieved a factor of 10 reduction of trim ranges / geom call downs. >How-To-Repeat: N/A >Fix: Apply the attached patch Patch attached with submission follows: Upgrades trim free request sizes before inserting them into to free map, making range consolidation much more effective particularly for small deletes. This reduces memory used by the free map as well as reducing the number of bio requests down to geom required to process all deletes. In tests this achieved a factor of 10 reduction of trim ranges / geom call downs. --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c 2012-10-25 13:01:17.556311206 +0000 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c 2012-10-25 13:48:39.280408543 +0000 @@ -2324,7 +2324,7 @@ /* * ========================================================================== - * Read and write to physical devices + * Read, write and delete to physical devices * ========================================================================== */ static int --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c 2012-10-25 13:01:17.544310799 +0000 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c 2012-10-25 14:41:49.391313700 +0000 @@ -263,14 +263,27 @@ void trim_map_free(zio_t *zio) { + uint64_t size, align; vdev_t *vd = zio->io_vd; trim_map_t *tm = vd->vdev_trimmap; if (zfs_notrim || vd->vdev_notrim || tm == NULL) return; + /* + * Upgrade size based on ashift which would be done by + * zio_vdev_io_start later anyway. + * + * This makes free range consolidation much more effective + * than it would otherwise be. + */ + size = zio->io_size; + align = 1ULL << vd->vdev_top->vdev_ashift; + if (P2PHASE(size, align) != 0) + size = P2ROUNDUP(size, align); + mutex_enter(&tm->tm_lock); - trim_map_free_locked(tm, zio->io_offset, zio->io_offset + zio->io_size, + trim_map_free_locked(tm, zio->io_offset, zio->io_offset + size, vd->vdev_spa->spa_syncing_txg); mutex_exit(&tm->tm_lock); } @@ -282,13 +295,25 @@ trim_map_t *tm = vd->vdev_trimmap; trim_seg_t tsearch, *ts; boolean_t left_over, right_over; - uint64_t start, end; + uint64_t start, end, align, size; if (zfs_notrim || vd->vdev_notrim || tm == NULL) return (B_TRUE); + /* + * Upgrade size based on ashift which would be done by + * zio_vdev_io_start later anyway. + * + * This ensures that entire blocks are invalidated by + * writes + */ + align = 1ULL << vd->vdev_top->vdev_ashift; + size = zio->io_size; + if (P2PHASE(size, align) != 0) + size = P2ROUNDUP(size, align); + start = zio->io_offset; - end = start + zio->io_size; + end = start + size; tsearch.ts_start = start; tsearch.ts_end = end; >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
文章代碼(AID): #1HUrJRkC (FB_bugs)