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 --- 7 unchanged lines hidden (view full) --- 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) 2012 by Delphix. All rights reserved. |
24 * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. |
25 */ 26 27#include <sys/zfs_context.h> 28#include <sys/dmu.h> 29#include <sys/dmu_tx.h> 30#include <sys/space_map.h> 31#include <sys/metaslab_impl.h> 32#include <sys/vdev_impl.h> --- 60 unchanged lines hidden (view full) --- 93int metaslab_prefetch_limit = SPA_DVAS_PER_BP; 94 95/* 96 * Percentage bonus multiplier for metaslabs that are in the bonus area. 97 */ 98int metaslab_smo_bonus_pct = 150; 99 100/* |
101 * Should we be willing to write data to degraded vdevs? 102 */ 103boolean_t zfs_write_to_degraded = B_FALSE; 104SYSCTL_INT(_vfs_zfs, OID_AUTO, write_to_degraded, CTLFLAG_RW, 105 &zfs_write_to_degraded, 0, 106 "Allow writing data to degraded vdevs"); 107TUNABLE_INT("vfs.zfs.write_to_degraded", &zfs_write_to_degraded); 108 109/* |
110 * ========================================================================== 111 * Metaslab classes 112 * ========================================================================== 113 */ 114metaslab_class_t * 115metaslab_class_create(spa_t *spa, space_map_ops_t *ops) 116{ 117 metaslab_class_t *mc; --- 1270 unchanged lines hidden (view full) --- 1388 } else { 1389 allocatable = vdev_allocatable(vd); 1390 } 1391 if (!allocatable) 1392 goto next; 1393 1394 /* 1395 * Avoid writing single-copy data to a failing vdev |
1396 * unless the user instructs us that it is okay. |
1397 */ 1398 if ((vd->vdev_stat.vs_write_errors > 0 || 1399 vd->vdev_state < VDEV_STATE_HEALTHY) && |
1400 d == 0 && dshift == 3 && 1401 !(zfs_write_to_degraded && vd->vdev_state == 1402 VDEV_STATE_DEGRADED)) { |
1403 all_zero = B_FALSE; 1404 goto next; 1405 } 1406 1407 ASSERT(mg->mg_class == mc); 1408 1409 distance = vd->vdev_asize >> dshift; 1410 if (distance <= (1ULL << vd->vdev_ms_shift)) --- 265 unchanged lines hidden --- |