space_map.c (236250) | space_map.c (240415) |
---|---|
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 --- 8 unchanged lines hidden (view full) --- 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ | 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 --- 8 unchanged lines hidden (view full) --- 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ |
25/* 26 * Copyright (c) 2012 by Delphix. All rights reserved. 27 */ |
|
25 26#include <sys/zfs_context.h> 27#include <sys/spa.h> 28#include <sys/dmu.h> 29#include <sys/zio.h> 30#include <sys/space_map.h> 31 32SYSCTL_DECL(_vfs_zfs); --- 42 unchanged lines hidden (view full) --- 75 sm->sm_shift = shift; 76 sm->sm_lock = lp; 77} 78 79void 80space_map_destroy(space_map_t *sm) 81{ 82 ASSERT(!sm->sm_loaded && !sm->sm_loading); | 28 29#include <sys/zfs_context.h> 30#include <sys/spa.h> 31#include <sys/dmu.h> 32#include <sys/zio.h> 33#include <sys/space_map.h> 34 35SYSCTL_DECL(_vfs_zfs); --- 42 unchanged lines hidden (view full) --- 78 sm->sm_shift = shift; 79 sm->sm_lock = lp; 80} 81 82void 83space_map_destroy(space_map_t *sm) 84{ 85 ASSERT(!sm->sm_loaded && !sm->sm_loading); |
83 VERIFY3U(sm->sm_space, ==, 0); | 86 VERIFY0(sm->sm_space); |
84 avl_destroy(&sm->sm_root); 85 cv_destroy(&sm->sm_load_cv); 86} 87 88void 89space_map_add(space_map_t *sm, uint64_t start, uint64_t size) 90{ 91 avl_index_t where; --- 212 unchanged lines hidden (view full) --- 304 ASSERT(!sm->sm_loaded); 305 ASSERT(!sm->sm_loading); 306 307 sm->sm_loading = B_TRUE; 308 end = smo->smo_objsize; 309 space = smo->smo_alloc; 310 311 ASSERT(sm->sm_ops == NULL); | 87 avl_destroy(&sm->sm_root); 88 cv_destroy(&sm->sm_load_cv); 89} 90 91void 92space_map_add(space_map_t *sm, uint64_t start, uint64_t size) 93{ 94 avl_index_t where; --- 212 unchanged lines hidden (view full) --- 307 ASSERT(!sm->sm_loaded); 308 ASSERT(!sm->sm_loading); 309 310 sm->sm_loading = B_TRUE; 311 end = smo->smo_objsize; 312 space = smo->smo_alloc; 313 314 ASSERT(sm->sm_ops == NULL); |
312 VERIFY3U(sm->sm_space, ==, 0); | 315 VERIFY0(sm->sm_space); |
313 314 if (maptype == SM_FREE) { 315 space_map_add(sm, sm->sm_start, sm->sm_size); 316 space = sm->sm_size - space; 317 } 318 319 bufsize = 1ULL << SPACE_MAP_BLOCKSHIFT; 320 entry_map = zio_buf_alloc(bufsize); --- 172 unchanged lines hidden (view full) --- 493 dmu_write(os, smo->smo_object, smo->smo_objsize, 494 size, entry_map, tx); 495 mutex_enter(sm->sm_lock); 496 smo->smo_objsize += size; 497 } 498 499 zio_buf_free(entry_map, bufsize); 500 | 316 317 if (maptype == SM_FREE) { 318 space_map_add(sm, sm->sm_start, sm->sm_size); 319 space = sm->sm_size - space; 320 } 321 322 bufsize = 1ULL << SPACE_MAP_BLOCKSHIFT; 323 entry_map = zio_buf_alloc(bufsize); --- 172 unchanged lines hidden (view full) --- 496 dmu_write(os, smo->smo_object, smo->smo_objsize, 497 size, entry_map, tx); 498 mutex_enter(sm->sm_lock); 499 smo->smo_objsize += size; 500 } 501 502 zio_buf_free(entry_map, bufsize); 503 |
501 VERIFY3U(sm->sm_space, ==, 0); | 504 VERIFY0(sm->sm_space); |
502} 503 504void 505space_map_truncate(space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx) 506{ 507 VERIFY(dmu_free_range(os, smo->smo_object, 0, -1ULL, tx) == 0); 508 509 smo->smo_objsize = 0; --- 130 unchanged lines hidden --- | 505} 506 507void 508space_map_truncate(space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx) 509{ 510 VERIFY(dmu_free_range(os, smo->smo_object, 0, -1ULL, tx) == 0); 511 512 smo->smo_objsize = 0; --- 130 unchanged lines hidden --- |