Deleted Added
full compact
vdev_disk.c (254012) vdev_disk.c (255750)
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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2013 by Delphix. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. 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

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

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) 2013 by Delphix. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2013 Joyent, Inc. All rights reserved.
25 */
26
27#include <sys/zfs_context.h>
28#include <sys/spa_impl.h>
29#include <sys/refcount.h>
30#include <sys/vdev_disk.h>
31#include <sys/vdev_impl.h>
32#include <sys/fs/zfs.h>

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

426 (void) ldi_close(dvd->vd_lh, spa_mode(vd->vdev_spa), kcred);
427
428 vd->vdev_delayed_close = B_FALSE;
429 kmem_free(dvd, sizeof (vdev_disk_t));
430 vd->vdev_tsd = NULL;
431}
432
433int
26 */
27
28#include <sys/zfs_context.h>
29#include <sys/spa_impl.h>
30#include <sys/refcount.h>
31#include <sys/vdev_disk.h>
32#include <sys/vdev_impl.h>
33#include <sys/fs/zfs.h>

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

427 (void) ldi_close(dvd->vd_lh, spa_mode(vd->vdev_spa), kcred);
428
429 vd->vdev_delayed_close = B_FALSE;
430 kmem_free(dvd, sizeof (vdev_disk_t));
431 vd->vdev_tsd = NULL;
432}
433
434int
434vdev_disk_physio(ldi_handle_t vd_lh, caddr_t data, size_t size,
435 uint64_t offset, int flags)
435vdev_disk_physio(vdev_t *vd, caddr_t data,
436 size_t size, uint64_t offset, int flags, boolean_t isdump)
436{
437{
438 vdev_disk_t *dvd = vd->vdev_tsd;
439
440 ASSERT(vd->vdev_ops == &vdev_disk_ops);
441
442 /*
443 * If in the context of an active crash dump, use the ldi_dump(9F)
444 * call instead of ldi_strategy(9F) as usual.
445 */
446 if (isdump) {
447 ASSERT3P(dvd, !=, NULL);
448 return (ldi_dump(dvd->vd_lh, data, lbtodb(offset),
449 lbtodb(size)));
450 }
451
452 return (vdev_disk_ldi_physio(dvd->vd_lh, data, size, offset, flags));
453}
454
455int
456vdev_disk_ldi_physio(ldi_handle_t vd_lh, caddr_t data,
457 size_t size, uint64_t offset, int flags)
458{
437 buf_t *bp;
438 int error = 0;
439
440 if (vd_lh == NULL)
441 return (SET_ERROR(EINVAL));
442
443 ASSERT(flags & B_READ || flags & B_WRITE);
444

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

675 label = kmem_alloc(sizeof (vdev_label_t), KM_SLEEP);
676
677 *config = NULL;
678 for (l = 0; l < VDEV_LABELS; l++) {
679 uint64_t offset, state, txg = 0;
680
681 /* read vdev label */
682 offset = vdev_label_offset(size, l, 0);
459 buf_t *bp;
460 int error = 0;
461
462 if (vd_lh == NULL)
463 return (SET_ERROR(EINVAL));
464
465 ASSERT(flags & B_READ || flags & B_WRITE);
466

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

697 label = kmem_alloc(sizeof (vdev_label_t), KM_SLEEP);
698
699 *config = NULL;
700 for (l = 0; l < VDEV_LABELS; l++) {
701 uint64_t offset, state, txg = 0;
702
703 /* read vdev label */
704 offset = vdev_label_offset(size, l, 0);
683 if (vdev_disk_physio(vd_lh, (caddr_t)label,
705 if (vdev_disk_ldi_physio(vd_lh, (caddr_t)label,
684 VDEV_SKIP_SIZE + VDEV_PHYS_SIZE, offset, B_READ) != 0)
685 continue;
686
687 if (nvlist_unpack(label->vl_vdev_phys.vp_nvlist,
688 sizeof (label->vl_vdev_phys.vp_nvlist), config, 0) != 0) {
689 *config = NULL;
690 continue;
691 }

--- 25 unchanged lines hidden ---
706 VDEV_SKIP_SIZE + VDEV_PHYS_SIZE, offset, B_READ) != 0)
707 continue;
708
709 if (nvlist_unpack(label->vl_vdev_phys.vp_nvlist,
710 sizeof (label->vl_vdev_phys.vp_nvlist), config, 0) != 0) {
711 *config = NULL;
712 continue;
713 }

--- 25 unchanged lines hidden ---