dnode.c (321547) | dnode.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) 2012, 2016 by Delphix. All rights reserved. | 23 * Copyright (c) 2012, 2017 by Delphix. All rights reserved. |
24 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 25 * Copyright (c) 2014 Integros [integros.com] 26 */ 27 28#include <sys/zfs_context.h> 29#include <sys/dbuf.h> 30#include <sys/dnode.h> 31#include <sys/dmu.h> --- 1250 unchanged lines hidden (view full) --- 1282 mutex_exit(&dn->dn_mtx); 1283#endif 1284 1285 /* 1286 * Determine old uid/gid when necessary 1287 */ 1288 dmu_objset_userquota_get_ids(dn, B_TRUE, tx); 1289 | 24 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 25 * Copyright (c) 2014 Integros [integros.com] 26 */ 27 28#include <sys/zfs_context.h> 29#include <sys/dbuf.h> 30#include <sys/dnode.h> 31#include <sys/dmu.h> --- 1250 unchanged lines hidden (view full) --- 1282 mutex_exit(&dn->dn_mtx); 1283#endif 1284 1285 /* 1286 * Determine old uid/gid when necessary 1287 */ 1288 dmu_objset_userquota_get_ids(dn, B_TRUE, tx); 1289 |
1290 mutex_enter(&os->os_lock); | 1290 multilist_t *dirtylist = os->os_dirty_dnodes[txg & TXG_MASK]; 1291 multilist_sublist_t *mls = multilist_sublist_lock_obj(dirtylist, dn); |
1291 1292 /* 1293 * If we are already marked dirty, we're done. 1294 */ 1295 if (list_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { | 1292 1293 /* 1294 * If we are already marked dirty, we're done. 1295 */ 1296 if (list_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { |
1296 mutex_exit(&os->os_lock); | 1297 multilist_sublist_unlock(mls); |
1297 return; 1298 } 1299 1300 ASSERT(!refcount_is_zero(&dn->dn_holds) || 1301 !avl_is_empty(&dn->dn_dbufs)); 1302 ASSERT(dn->dn_datablksz != 0); 1303 ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); 1304 ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); 1305 ASSERT0(dn->dn_next_bonustype[txg&TXG_MASK]); 1306 1307 dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n", 1308 dn->dn_object, txg); 1309 | 1298 return; 1299 } 1300 1301 ASSERT(!refcount_is_zero(&dn->dn_holds) || 1302 !avl_is_empty(&dn->dn_dbufs)); 1303 ASSERT(dn->dn_datablksz != 0); 1304 ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); 1305 ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); 1306 ASSERT0(dn->dn_next_bonustype[txg&TXG_MASK]); 1307 1308 dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n", 1309 dn->dn_object, txg); 1310 |
1310 if (dn->dn_free_txg > 0 && dn->dn_free_txg <= txg) { 1311 list_insert_tail(&os->os_free_dnodes[txg&TXG_MASK], dn); 1312 } else { 1313 list_insert_tail(&os->os_dirty_dnodes[txg&TXG_MASK], dn); 1314 } | 1311 multilist_sublist_insert_head(mls, dn); |
1315 | 1312 |
1316 mutex_exit(&os->os_lock); | 1313 multilist_sublist_unlock(mls); |
1317 1318 /* 1319 * The dnode maintains a hold on its containing dbuf as 1320 * long as there are holds on it. Each instantiated child 1321 * dbuf maintains a hold on the dnode. When the last child 1322 * drops its hold, the dnode will drop its hold on the 1323 * containing dbuf. We add a "dirty hold" here so that the 1324 * dnode will hang around after we finish processing its --- 4 unchanged lines hidden (view full) --- 1329 (void) dbuf_dirty(dn->dn_dbuf, tx); 1330 1331 dsl_dataset_dirty(os->os_dsl_dataset, tx); 1332} 1333 1334void 1335dnode_free(dnode_t *dn, dmu_tx_t *tx) 1336{ | 1314 1315 /* 1316 * The dnode maintains a hold on its containing dbuf as 1317 * long as there are holds on it. Each instantiated child 1318 * dbuf maintains a hold on the dnode. When the last child 1319 * drops its hold, the dnode will drop its hold on the 1320 * containing dbuf. We add a "dirty hold" here so that the 1321 * dnode will hang around after we finish processing its --- 4 unchanged lines hidden (view full) --- 1326 (void) dbuf_dirty(dn->dn_dbuf, tx); 1327 1328 dsl_dataset_dirty(os->os_dsl_dataset, tx); 1329} 1330 1331void 1332dnode_free(dnode_t *dn, dmu_tx_t *tx) 1333{ |
1337 int txgoff = tx->tx_txg & TXG_MASK; 1338 1339 dprintf("dn=%p txg=%llu\n", dn, tx->tx_txg); 1340 1341 /* we should be the only holder... hopefully */ 1342 /* ASSERT3U(refcount_count(&dn->dn_holds), ==, 1); */ 1343 | |
1344 mutex_enter(&dn->dn_mtx); 1345 if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg) { 1346 mutex_exit(&dn->dn_mtx); 1347 return; 1348 } 1349 dn->dn_free_txg = tx->tx_txg; 1350 mutex_exit(&dn->dn_mtx); 1351 | 1334 mutex_enter(&dn->dn_mtx); 1335 if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg) { 1336 mutex_exit(&dn->dn_mtx); 1337 return; 1338 } 1339 dn->dn_free_txg = tx->tx_txg; 1340 mutex_exit(&dn->dn_mtx); 1341 |
1352 /* 1353 * If the dnode is already dirty, it needs to be moved from 1354 * the dirty list to the free list. 1355 */ 1356 mutex_enter(&dn->dn_objset->os_lock); 1357 if (list_link_active(&dn->dn_dirty_link[txgoff])) { 1358 list_remove(&dn->dn_objset->os_dirty_dnodes[txgoff], dn); 1359 list_insert_tail(&dn->dn_objset->os_free_dnodes[txgoff], dn); 1360 mutex_exit(&dn->dn_objset->os_lock); 1361 } else { 1362 mutex_exit(&dn->dn_objset->os_lock); 1363 dnode_setdirty(dn, tx); 1364 } | 1342 dnode_setdirty(dn, tx); |
1365} 1366 1367/* 1368 * Try to change the block size for the indicated dnode. This can only 1369 * succeed if there are no blocks allocated or dirty beyond first block 1370 */ 1371int 1372dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) --- 648 unchanged lines hidden --- | 1343} 1344 1345/* 1346 * Try to change the block size for the indicated dnode. This can only 1347 * succeed if there are no blocks allocated or dirty beyond first block 1348 */ 1349int 1350dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) --- 648 unchanged lines hidden --- |