spa_misc.c (339034) | spa_misc.c (339105) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2011, 2017 by Delphix. All rights reserved. | 23 * Copyright (c) 2011, 2018 by Delphix. All rights reserved. |
24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved. 25 * Copyright 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved. 26 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 27 * Copyright 2013 Saso Kiselkov. All rights reserved. 28 * Copyright (c) 2014 Integros [integros.com] 29 * Copyright (c) 2017 Datto Inc. 30 */ 31 --- 401 unchanged lines hidden (view full) --- 433SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_slop_shift, CTLFLAG_RWTUN, 434 &spa_slop_shift, 0, 435 "Shift value of reserved space (1/(2^spa_slop_shift))."); 436uint64_t spa_min_slop = 128 * 1024 * 1024; 437SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, spa_min_slop, CTLFLAG_RWTUN, 438 &spa_min_slop, 0, 439 "Minimal value of reserved space"); 440 | 24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved. 25 * Copyright 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved. 26 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 27 * Copyright 2013 Saso Kiselkov. All rights reserved. 28 * Copyright (c) 2014 Integros [integros.com] 29 * Copyright (c) 2017 Datto Inc. 30 */ 31 --- 401 unchanged lines hidden (view full) --- 433SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_slop_shift, CTLFLAG_RWTUN, 434 &spa_slop_shift, 0, 435 "Shift value of reserved space (1/(2^spa_slop_shift))."); 436uint64_t spa_min_slop = 128 * 1024 * 1024; 437SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, spa_min_slop, CTLFLAG_RWTUN, 438 &spa_min_slop, 0, 439 "Minimal value of reserved space"); 440 |
441int spa_allocators = 4; 442 |
|
441/*PRINTFLIKE2*/ 442void 443spa_load_failed(spa_t *spa, const char *fmt, ...) 444{ 445 va_list adx; 446 char buf[256]; 447 448 va_start(adx, fmt); --- 255 unchanged lines hidden (view full) --- 704 mutex_init(&spa->spa_evicting_os_lock, NULL, MUTEX_DEFAULT, NULL); 705 mutex_init(&spa->spa_history_lock, NULL, MUTEX_DEFAULT, NULL); 706 mutex_init(&spa->spa_proc_lock, NULL, MUTEX_DEFAULT, NULL); 707 mutex_init(&spa->spa_props_lock, NULL, MUTEX_DEFAULT, NULL); 708 mutex_init(&spa->spa_cksum_tmpls_lock, NULL, MUTEX_DEFAULT, NULL); 709 mutex_init(&spa->spa_scrub_lock, NULL, MUTEX_DEFAULT, NULL); 710 mutex_init(&spa->spa_suspend_lock, NULL, MUTEX_DEFAULT, NULL); 711 mutex_init(&spa->spa_vdev_top_lock, NULL, MUTEX_DEFAULT, NULL); | 443/*PRINTFLIKE2*/ 444void 445spa_load_failed(spa_t *spa, const char *fmt, ...) 446{ 447 va_list adx; 448 char buf[256]; 449 450 va_start(adx, fmt); --- 255 unchanged lines hidden (view full) --- 706 mutex_init(&spa->spa_evicting_os_lock, NULL, MUTEX_DEFAULT, NULL); 707 mutex_init(&spa->spa_history_lock, NULL, MUTEX_DEFAULT, NULL); 708 mutex_init(&spa->spa_proc_lock, NULL, MUTEX_DEFAULT, NULL); 709 mutex_init(&spa->spa_props_lock, NULL, MUTEX_DEFAULT, NULL); 710 mutex_init(&spa->spa_cksum_tmpls_lock, NULL, MUTEX_DEFAULT, NULL); 711 mutex_init(&spa->spa_scrub_lock, NULL, MUTEX_DEFAULT, NULL); 712 mutex_init(&spa->spa_suspend_lock, NULL, MUTEX_DEFAULT, NULL); 713 mutex_init(&spa->spa_vdev_top_lock, NULL, MUTEX_DEFAULT, NULL); |
712 mutex_init(&spa->spa_alloc_lock, NULL, MUTEX_DEFAULT, NULL); | |
713 714 cv_init(&spa->spa_async_cv, NULL, CV_DEFAULT, NULL); 715 cv_init(&spa->spa_evicting_os_cv, NULL, CV_DEFAULT, NULL); 716 cv_init(&spa->spa_proc_cv, NULL, CV_DEFAULT, NULL); 717 cv_init(&spa->spa_scrub_io_cv, NULL, CV_DEFAULT, NULL); 718 cv_init(&spa->spa_suspend_cv, NULL, CV_DEFAULT, NULL); 719 720 for (int t = 0; t < TXG_SIZE; t++) --- 57 unchanged lines hidden (view full) --- 778 /* 779 * Set the alternate root, if there is one. 780 */ 781 if (altroot) { 782 spa->spa_root = spa_strdup(altroot); 783 spa_active_count++; 784 } 785 | 714 715 cv_init(&spa->spa_async_cv, NULL, CV_DEFAULT, NULL); 716 cv_init(&spa->spa_evicting_os_cv, NULL, CV_DEFAULT, NULL); 717 cv_init(&spa->spa_proc_cv, NULL, CV_DEFAULT, NULL); 718 cv_init(&spa->spa_scrub_io_cv, NULL, CV_DEFAULT, NULL); 719 cv_init(&spa->spa_suspend_cv, NULL, CV_DEFAULT, NULL); 720 721 for (int t = 0; t < TXG_SIZE; t++) --- 57 unchanged lines hidden (view full) --- 779 /* 780 * Set the alternate root, if there is one. 781 */ 782 if (altroot) { 783 spa->spa_root = spa_strdup(altroot); 784 spa_active_count++; 785 } 786 |
786 avl_create(&spa->spa_alloc_tree, zio_bookmark_compare, 787 sizeof (zio_t), offsetof(zio_t, io_alloc_node)); | 787 spa->spa_alloc_count = spa_allocators; 788 spa->spa_alloc_locks = kmem_zalloc(spa->spa_alloc_count * 789 sizeof (kmutex_t), KM_SLEEP); 790 spa->spa_alloc_trees = kmem_zalloc(spa->spa_alloc_count * 791 sizeof (avl_tree_t), KM_SLEEP); 792 for (int i = 0; i < spa->spa_alloc_count; i++) { 793 mutex_init(&spa->spa_alloc_locks[i], NULL, MUTEX_DEFAULT, NULL); 794 avl_create(&spa->spa_alloc_trees[i], zio_bookmark_compare, 795 sizeof (zio_t), offsetof(zio_t, io_alloc_node)); 796 } |
788 789 /* 790 * Every pool starts with the default cachefile 791 */ 792 list_create(&spa->spa_config_list, sizeof (spa_config_dirent_t), 793 offsetof(spa_config_dirent_t, scd_link)); 794 795 dp = kmem_zalloc(sizeof (spa_config_dirent_t), KM_SLEEP); --- 63 unchanged lines hidden (view full) --- 859 860 while ((dp = list_head(&spa->spa_config_list)) != NULL) { 861 list_remove(&spa->spa_config_list, dp); 862 if (dp->scd_path != NULL) 863 spa_strfree(dp->scd_path); 864 kmem_free(dp, sizeof (spa_config_dirent_t)); 865 } 866 | 797 798 /* 799 * Every pool starts with the default cachefile 800 */ 801 list_create(&spa->spa_config_list, sizeof (spa_config_dirent_t), 802 offsetof(spa_config_dirent_t, scd_link)); 803 804 dp = kmem_zalloc(sizeof (spa_config_dirent_t), KM_SLEEP); --- 63 unchanged lines hidden (view full) --- 868 869 while ((dp = list_head(&spa->spa_config_list)) != NULL) { 870 list_remove(&spa->spa_config_list, dp); 871 if (dp->scd_path != NULL) 872 spa_strfree(dp->scd_path); 873 kmem_free(dp, sizeof (spa_config_dirent_t)); 874 } 875 |
867 avl_destroy(&spa->spa_alloc_tree); | 876 for (int i = 0; i < spa->spa_alloc_count; i++) { 877 avl_destroy(&spa->spa_alloc_trees[i]); 878 mutex_destroy(&spa->spa_alloc_locks[i]); 879 } 880 kmem_free(spa->spa_alloc_locks, spa->spa_alloc_count * 881 sizeof (kmutex_t)); 882 kmem_free(spa->spa_alloc_trees, spa->spa_alloc_count * 883 sizeof (avl_tree_t)); 884 |
868 list_destroy(&spa->spa_config_list); 869 870 nvlist_free(spa->spa_label_features); 871 nvlist_free(spa->spa_load_info); 872 spa_config_set(spa, NULL); 873 874#ifdef illumos 875 mutex_enter(&cpu_lock); --- 18 unchanged lines hidden (view full) --- 894 zio_checksum_templates_free(spa); 895 896 cv_destroy(&spa->spa_async_cv); 897 cv_destroy(&spa->spa_evicting_os_cv); 898 cv_destroy(&spa->spa_proc_cv); 899 cv_destroy(&spa->spa_scrub_io_cv); 900 cv_destroy(&spa->spa_suspend_cv); 901 | 885 list_destroy(&spa->spa_config_list); 886 887 nvlist_free(spa->spa_label_features); 888 nvlist_free(spa->spa_load_info); 889 spa_config_set(spa, NULL); 890 891#ifdef illumos 892 mutex_enter(&cpu_lock); --- 18 unchanged lines hidden (view full) --- 911 zio_checksum_templates_free(spa); 912 913 cv_destroy(&spa->spa_async_cv); 914 cv_destroy(&spa->spa_evicting_os_cv); 915 cv_destroy(&spa->spa_proc_cv); 916 cv_destroy(&spa->spa_scrub_io_cv); 917 cv_destroy(&spa->spa_suspend_cv); 918 |
902 mutex_destroy(&spa->spa_alloc_lock); | |
903 mutex_destroy(&spa->spa_async_lock); 904 mutex_destroy(&spa->spa_errlist_lock); 905 mutex_destroy(&spa->spa_errlog_lock); 906 mutex_destroy(&spa->spa_evicting_os_lock); 907 mutex_destroy(&spa->spa_history_lock); 908 mutex_destroy(&spa->spa_proc_lock); 909 mutex_destroy(&spa->spa_props_lock); 910 mutex_destroy(&spa->spa_cksum_tmpls_lock); --- 1488 unchanged lines hidden --- | 919 mutex_destroy(&spa->spa_async_lock); 920 mutex_destroy(&spa->spa_errlist_lock); 921 mutex_destroy(&spa->spa_errlog_lock); 922 mutex_destroy(&spa->spa_evicting_os_lock); 923 mutex_destroy(&spa->spa_history_lock); 924 mutex_destroy(&spa->spa_proc_lock); 925 mutex_destroy(&spa->spa_props_lock); 926 mutex_destroy(&spa->spa_cksum_tmpls_lock); --- 1488 unchanged lines hidden --- |