dsl_pool.c (321523) | dsl_pool.c (321553) |
---|---|
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, 2016 by Delphix. All rights reserved. | 23 * Copyright (c) 2011, 2017 by Delphix. All rights reserved. |
24 * Copyright (c) 2013 Steven Hartland. All rights reserved. 25 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 26 * Copyright (c) 2014 Integros [integros.com] 27 * Copyright 2016 Nexenta Systems, Inc. All rights reserved. 28 */ 29 30#include <sys/dsl_pool.h> 31#include <sys/dsl_dataset.h> --- 95 unchanged lines hidden (view full) --- 127 * by the maximum number of operations per second. This will smoothly 128 * handle between 10x and 1/10th this number. 129 * 130 * Note: zfs_delay_scale * zfs_dirty_data_max must be < 2^64, due to the 131 * multiply in dmu_tx_delay(). 132 */ 133uint64_t zfs_delay_scale = 1000 * 1000 * 1000 / 2000; 134 | 24 * Copyright (c) 2013 Steven Hartland. All rights reserved. 25 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 26 * Copyright (c) 2014 Integros [integros.com] 27 * Copyright 2016 Nexenta Systems, Inc. All rights reserved. 28 */ 29 30#include <sys/dsl_pool.h> 31#include <sys/dsl_dataset.h> --- 95 unchanged lines hidden (view full) --- 127 * by the maximum number of operations per second. This will smoothly 128 * handle between 10x and 1/10th this number. 129 * 130 * Note: zfs_delay_scale * zfs_dirty_data_max must be < 2^64, due to the 131 * multiply in dmu_tx_delay(). 132 */ 133uint64_t zfs_delay_scale = 1000 * 1000 * 1000 / 2000; 134 |
135/* 136 * This determines the number of threads used by the dp_sync_taskq. 137 */ 138int zfs_sync_taskq_batch_pct = 75; |
|
135 136#if defined(__FreeBSD__) && defined(_KERNEL) 137 138extern int zfs_vdev_async_write_active_max_dirty_percent; 139 140SYSCTL_DECL(_vfs_zfs); 141 142SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max, CTLFLAG_RWTUN, --- 116 unchanged lines hidden (view full) --- 259 offsetof(dsl_dataset_t, ds_dirty_link)); 260 txg_list_create(&dp->dp_dirty_zilogs, 261 offsetof(zilog_t, zl_dirty_link)); 262 txg_list_create(&dp->dp_dirty_dirs, 263 offsetof(dsl_dir_t, dd_dirty_link)); 264 txg_list_create(&dp->dp_sync_tasks, 265 offsetof(dsl_sync_task_t, dst_node)); 266 | 139 140#if defined(__FreeBSD__) && defined(_KERNEL) 141 142extern int zfs_vdev_async_write_active_max_dirty_percent; 143 144SYSCTL_DECL(_vfs_zfs); 145 146SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max, CTLFLAG_RWTUN, --- 116 unchanged lines hidden (view full) --- 263 offsetof(dsl_dataset_t, ds_dirty_link)); 264 txg_list_create(&dp->dp_dirty_zilogs, 265 offsetof(zilog_t, zl_dirty_link)); 266 txg_list_create(&dp->dp_dirty_dirs, 267 offsetof(dsl_dir_t, dd_dirty_link)); 268 txg_list_create(&dp->dp_sync_tasks, 269 offsetof(dsl_sync_task_t, dst_node)); 270 |
271 dp->dp_sync_taskq = taskq_create("dp_sync_taskq", 272 zfs_sync_taskq_batch_pct, minclsyspri, 1, INT_MAX, 273 TASKQ_THREADS_CPU_PCT); 274 |
|
267 mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); 268 cv_init(&dp->dp_spaceavail_cv, NULL, CV_DEFAULT, NULL); 269 270 dp->dp_vnrele_taskq = taskq_create("zfs_vn_rele_taskq", 1, minclsyspri, 271 1, 4, 0); 272 273 return (dp); 274} --- 134 unchanged lines hidden (view full) --- 409 if (dp->dp_meta_objset) 410 dmu_objset_evict(dp->dp_meta_objset); 411 412 txg_list_destroy(&dp->dp_dirty_datasets); 413 txg_list_destroy(&dp->dp_dirty_zilogs); 414 txg_list_destroy(&dp->dp_sync_tasks); 415 txg_list_destroy(&dp->dp_dirty_dirs); 416 | 275 mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); 276 cv_init(&dp->dp_spaceavail_cv, NULL, CV_DEFAULT, NULL); 277 278 dp->dp_vnrele_taskq = taskq_create("zfs_vn_rele_taskq", 1, minclsyspri, 279 1, 4, 0); 280 281 return (dp); 282} --- 134 unchanged lines hidden (view full) --- 417 if (dp->dp_meta_objset) 418 dmu_objset_evict(dp->dp_meta_objset); 419 420 txg_list_destroy(&dp->dp_dirty_datasets); 421 txg_list_destroy(&dp->dp_dirty_zilogs); 422 txg_list_destroy(&dp->dp_sync_tasks); 423 txg_list_destroy(&dp->dp_dirty_dirs); 424 |
425 taskq_destroy(dp->dp_sync_taskq); 426 |
|
417 /* 418 * We can't set retry to TRUE since we're explicitly specifying 419 * a spa to flush. This is good enough; any missed buffers for 420 * this spa won't cause trouble, and they'll eventually fall 421 * out of the ARC just like any other unused buffer. 422 */ 423 arc_flush(dp->dp_spa, FALSE); 424 --- 172 unchanged lines hidden (view full) --- 597 mutex_enter(&dp->dp_lock); 598 ASSERT(spa_sync_pass(dp->dp_spa) == 1 || 599 dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] == 0); 600 dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] = 0; 601 mutex_exit(&dp->dp_lock); 602 603 /* 604 * After the data blocks have been written (ensured by the zio_wait() | 427 /* 428 * We can't set retry to TRUE since we're explicitly specifying 429 * a spa to flush. This is good enough; any missed buffers for 430 * this spa won't cause trouble, and they'll eventually fall 431 * out of the ARC just like any other unused buffer. 432 */ 433 arc_flush(dp->dp_spa, FALSE); 434 --- 172 unchanged lines hidden (view full) --- 607 mutex_enter(&dp->dp_lock); 608 ASSERT(spa_sync_pass(dp->dp_spa) == 1 || 609 dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] == 0); 610 dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] = 0; 611 mutex_exit(&dp->dp_lock); 612 613 /* 614 * After the data blocks have been written (ensured by the zio_wait() |
605 * above), update the user/group space accounting. | 615 * above), update the user/group space accounting. This happens 616 * in tasks dispatched to dp_sync_taskq, so wait for them before 617 * continuing. |
606 */ 607 for (ds = list_head(&synced_datasets); ds != NULL; 608 ds = list_next(&synced_datasets, ds)) { 609 dmu_objset_do_userquota_updates(ds->ds_objset, tx); 610 } | 618 */ 619 for (ds = list_head(&synced_datasets); ds != NULL; 620 ds = list_next(&synced_datasets, ds)) { 621 dmu_objset_do_userquota_updates(ds->ds_objset, tx); 622 } |
623 taskq_wait(dp->dp_sync_taskq); |
|
611 612 /* 613 * Sync the datasets again to push out the changes due to 614 * userspace updates. This must be done before we process the 615 * sync tasks, so that any snapshots will have the correct 616 * user accounting information (and we won't get confused 617 * about which blocks are part of the snapshot). 618 */ --- 30 unchanged lines hidden (view full) --- 649 dp->dp_mos_used_delta, 650 dp->dp_mos_compressed_delta, 651 dp->dp_mos_uncompressed_delta, tx); 652 dp->dp_mos_used_delta = 0; 653 dp->dp_mos_compressed_delta = 0; 654 dp->dp_mos_uncompressed_delta = 0; 655 } 656 | 624 625 /* 626 * Sync the datasets again to push out the changes due to 627 * userspace updates. This must be done before we process the 628 * sync tasks, so that any snapshots will have the correct 629 * user accounting information (and we won't get confused 630 * about which blocks are part of the snapshot). 631 */ --- 30 unchanged lines hidden (view full) --- 662 dp->dp_mos_used_delta, 663 dp->dp_mos_compressed_delta, 664 dp->dp_mos_uncompressed_delta, tx); 665 dp->dp_mos_used_delta = 0; 666 dp->dp_mos_compressed_delta = 0; 667 dp->dp_mos_uncompressed_delta = 0; 668 } 669 |
657 if (list_head(&mos->os_dirty_dnodes[txg & TXG_MASK]) != NULL || 658 list_head(&mos->os_free_dnodes[txg & TXG_MASK]) != NULL) { | 670 if (!multilist_is_empty(mos->os_dirty_dnodes[txg & TXG_MASK])) { |
659 dsl_pool_sync_mos(dp, tx); 660 } 661 662 /* 663 * If we modify a dataset in the same txg that we want to destroy it, 664 * its dsl_dir's dd_dbuf will be dirty, and thus have a hold on it. 665 * dsl_dir_destroy_check() will fail if there are unexpected holds. 666 * Therefore, we want to sync the MOS (thus syncing the dd_dbuf --- 41 unchanged lines hidden (view full) --- 708/* 709 * TRUE if the current thread is the tx_sync_thread or if we 710 * are being called from SPA context during pool initialization. 711 */ 712int 713dsl_pool_sync_context(dsl_pool_t *dp) 714{ 715 return (curthread == dp->dp_tx.tx_sync_thread || | 671 dsl_pool_sync_mos(dp, tx); 672 } 673 674 /* 675 * If we modify a dataset in the same txg that we want to destroy it, 676 * its dsl_dir's dd_dbuf will be dirty, and thus have a hold on it. 677 * dsl_dir_destroy_check() will fail if there are unexpected holds. 678 * Therefore, we want to sync the MOS (thus syncing the dd_dbuf --- 41 unchanged lines hidden (view full) --- 720/* 721 * TRUE if the current thread is the tx_sync_thread or if we 722 * are being called from SPA context during pool initialization. 723 */ 724int 725dsl_pool_sync_context(dsl_pool_t *dp) 726{ 727 return (curthread == dp->dp_tx.tx_sync_thread || |
716 spa_is_initializing(dp->dp_spa)); | 728 spa_is_initializing(dp->dp_spa) || 729 taskq_member(dp->dp_sync_taskq, curthread)); |
717} 718 719uint64_t 720dsl_pool_adjustedsize(dsl_pool_t *dp, boolean_t netfree) 721{ 722 uint64_t space, resv; 723 724 /* --- 455 unchanged lines hidden --- | 730} 731 732uint64_t 733dsl_pool_adjustedsize(dsl_pool_t *dp, boolean_t netfree) 734{ 735 uint64_t space, resv; 736 737 /* --- 455 unchanged lines hidden --- |