abd.c (d09a955a605d03471c5ab7bd17b8a6186fdc148c) abd.c (e639e0d27cc863ba1b8de20e861e6b5d9b922a8e)
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

--- 356 unchanged lines hidden (view full) ---

365 /*
366 * If the parent is responsible for freeing the child gang
367 * ABD we will just splice the child's children ABD list to
368 * the parent's list and immediately free the child gang ABD
369 * struct. The parent gang ABDs children from the child gang
370 * will retain all the free_on_free settings after being
371 * added to the parents list.
372 */
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

--- 356 unchanged lines hidden (view full) ---

365 /*
366 * If the parent is responsible for freeing the child gang
367 * ABD we will just splice the child's children ABD list to
368 * the parent's list and immediately free the child gang ABD
369 * struct. The parent gang ABDs children from the child gang
370 * will retain all the free_on_free settings after being
371 * added to the parents list.
372 */
373#ifdef ZFS_DEBUG
374 /*
375 * If cabd had abd_parent, we have to drop it here. We can't
376 * transfer it to pabd, nor we can clear abd_size leaving it.
377 */
378 if (cabd->abd_parent != NULL) {
379 (void) zfs_refcount_remove_many(
380 &cabd->abd_parent->abd_children,
381 cabd->abd_size, cabd);
382 cabd->abd_parent = NULL;
383 }
384#endif
373 pabd->abd_size += cabd->abd_size;
385 pabd->abd_size += cabd->abd_size;
386 cabd->abd_size = 0;
374 list_move_tail(&ABD_GANG(pabd).abd_gang_chain,
375 &ABD_GANG(cabd).abd_gang_chain);
376 ASSERT(list_is_empty(&ABD_GANG(cabd).abd_gang_chain));
377 abd_verify(pabd);
378 abd_free(cabd);
379 } else {
380 for (abd_t *child = list_head(&ABD_GANG(cabd).abd_gang_chain);
381 child != NULL;

--- 21 unchanged lines hidden (view full) ---

403
404 /*
405 * If the child being added is a gang ABD, we will add the
406 * child's ABDs to the parent gang ABD. This allows us to account
407 * for the offset correctly in the parent gang ABD.
408 */
409 if (abd_is_gang(cabd)) {
410 ASSERT(!list_link_active(&cabd->abd_gang_link));
387 list_move_tail(&ABD_GANG(pabd).abd_gang_chain,
388 &ABD_GANG(cabd).abd_gang_chain);
389 ASSERT(list_is_empty(&ABD_GANG(cabd).abd_gang_chain));
390 abd_verify(pabd);
391 abd_free(cabd);
392 } else {
393 for (abd_t *child = list_head(&ABD_GANG(cabd).abd_gang_chain);
394 child != NULL;

--- 21 unchanged lines hidden (view full) ---

416
417 /*
418 * If the child being added is a gang ABD, we will add the
419 * child's ABDs to the parent gang ABD. This allows us to account
420 * for the offset correctly in the parent gang ABD.
421 */
422 if (abd_is_gang(cabd)) {
423 ASSERT(!list_link_active(&cabd->abd_gang_link));
411 ASSERT(!list_is_empty(&ABD_GANG(cabd).abd_gang_chain));
412 return (abd_gang_add_gang(pabd, cabd, free_on_free));
413 }
414 ASSERT(!abd_is_gang(cabd));
415
416 /*
417 * In order to verify that an ABD is not already part of
418 * another gang ABD, we must lock the child ABD's abd_mtx
419 * to check its abd_gang_link status. We unlock the abd_mtx

--- 798 unchanged lines hidden ---
424 return (abd_gang_add_gang(pabd, cabd, free_on_free));
425 }
426 ASSERT(!abd_is_gang(cabd));
427
428 /*
429 * In order to verify that an ABD is not already part of
430 * another gang ABD, we must lock the child ABD's abd_mtx
431 * to check its abd_gang_link status. We unlock the abd_mtx

--- 798 unchanged lines hidden ---