Mercurial > illumos > illumos-gate
changeset 13968:e4988c7d0403
3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread (fix race condition)
author | George Wilson <george.wilson@delphix.com> |
---|---|
date | Thu, 21 Feb 2013 13:58:29 -0800 |
parents | 92bec6d87f59 |
children | b2c7608044b7 |
files | usr/src/uts/common/fs/zfs/metaslab.c |
diffstat | 1 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/metaslab.c Wed Feb 20 22:50:16 2013 -0800 +++ b/usr/src/uts/common/fs/zfs/metaslab.c Thu Feb 21 13:58:29 2013 -0800 @@ -1383,6 +1383,13 @@ mutex_exit(&mg->mg_lock); return (-1ULL); } + + /* + * If the selected metaslab is condensing, skip it. + */ + if (msp->ms_map->sm_condensing) + continue; + was_active = msp->ms_weight & METASLAB_ACTIVE_MASK; if (activation_weight == METASLAB_WEIGHT_PRIMARY) break; @@ -1423,16 +1430,6 @@ mutex_enter(&msp->ms_lock); /* - * If this metaslab is currently condensing then pick again as - * we can't manipulate this metaslab until it's committed - * to disk. - */ - if (msp->ms_map->sm_condensing) { - mutex_exit(&msp->ms_lock); - continue; - } - - /* * Ensure that the metaslab we have selected is still * capable of handling our request. It's possible that * another thread may have changed the weight while we @@ -1458,6 +1455,16 @@ continue; } + /* + * If this metaslab is currently condensing then pick again as + * we can't manipulate this metaslab until it's committed + * to disk. + */ + if (msp->ms_map->sm_condensing) { + mutex_exit(&msp->ms_lock); + continue; + } + if ((offset = space_map_alloc(msp->ms_map, asize)) != -1ULL) break;