zfeature.c (239774) | zfeature.c (249195) |
---|---|
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/* | 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/* |
23 * Copyright (c) 2012 by Delphix. All rights reserved. | 23 * Copyright (c) 2013 by Delphix. All rights reserved. |
24 */ 25 26#include <sys/zfs_context.h> 27#include <sys/zfeature.h> 28#include <sys/dmu.h> 29#include <sys/nvpair.h> 30#include <sys/zap.h> 31#include <sys/dmu_tx.h> --- 189 unchanged lines hidden (view full) --- 221 uint64_t refcount; 222 uint64_t zapobj = feature->fi_can_readonly ? write_obj : read_obj; 223 224 /* 225 * If the pool is currently being created, the feature objects may not 226 * have been allocated yet. Act as though all features are disabled. 227 */ 228 if (zapobj == 0) | 24 */ 25 26#include <sys/zfs_context.h> 27#include <sys/zfeature.h> 28#include <sys/dmu.h> 29#include <sys/nvpair.h> 30#include <sys/zap.h> 31#include <sys/dmu_tx.h> --- 189 unchanged lines hidden (view full) --- 221 uint64_t refcount; 222 uint64_t zapobj = feature->fi_can_readonly ? write_obj : read_obj; 223 224 /* 225 * If the pool is currently being created, the feature objects may not 226 * have been allocated yet. Act as though all features are disabled. 227 */ 228 if (zapobj == 0) |
229 return (ENOTSUP); | 229 return (SET_ERROR(ENOTSUP)); |
230 231 err = zap_lookup(os, zapobj, feature->fi_guid, sizeof (uint64_t), 1, 232 &refcount); 233 if (err != 0) { 234 if (err == ENOENT) | 230 231 err = zap_lookup(os, zapobj, feature->fi_guid, sizeof (uint64_t), 1, 232 &refcount); 233 if (err != 0) { 234 if (err == ENOENT) |
235 return (ENOTSUP); | 235 return (SET_ERROR(ENOTSUP)); |
236 else 237 return (err); 238 } 239 *res = refcount; 240 return (0); 241} 242 243static int --- 24 unchanged lines hidden (view full) --- 268 * If the feature is already enabled, ignore the request. 269 */ 270 if (error == 0) 271 return (0); 272 refcount = 0; 273 break; 274 case FEATURE_ACTION_INCR: 275 if (error == ENOENT) | 236 else 237 return (err); 238 } 239 *res = refcount; 240 return (0); 241} 242 243static int --- 24 unchanged lines hidden (view full) --- 268 * If the feature is already enabled, ignore the request. 269 */ 270 if (error == 0) 271 return (0); 272 refcount = 0; 273 break; 274 case FEATURE_ACTION_INCR: 275 if (error == ENOENT) |
276 return (ENOTSUP); | 276 return (SET_ERROR(ENOTSUP)); |
277 if (refcount == UINT64_MAX) | 277 if (refcount == UINT64_MAX) |
278 return (EOVERFLOW); | 278 return (SET_ERROR(EOVERFLOW)); |
279 refcount++; 280 break; 281 case FEATURE_ACTION_DECR: 282 if (error == ENOENT) | 279 refcount++; 280 break; 281 case FEATURE_ACTION_DECR: 282 if (error == ENOENT) |
283 return (ENOTSUP); | 283 return (SET_ERROR(ENOTSUP)); |
284 if (refcount == 0) | 284 if (refcount == 0) |
285 return (EOVERFLOW); | 285 return (SET_ERROR(EOVERFLOW)); |
286 refcount--; 287 break; 288 default: 289 ASSERT(0); 290 break; 291 } 292 293 if (action == FEATURE_ACTION_ENABLE) { --- 131 unchanged lines hidden --- | 286 refcount--; 287 break; 288 default: 289 ASSERT(0); 290 break; 291 } 292 293 if (action == FEATURE_ACTION_ENABLE) { --- 131 unchanged lines hidden --- |