Deleted Added
full compact
spa_history.c (194118) spa_history.c (209962)
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 2008 Sun Microsystems, Inc. All rights reserved.
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
24 * Use is subject to license terms.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#include <sys/spa.h>
30#include <sys/spa_impl.h>
31#include <sys/zap.h>
32#include <sys/dsl_synctask.h>
33#include <sys/dmu_tx.h>
34#include <sys/dmu_objset.h>
35#include <sys/utsname.h>
36#include <sys/sunddi.h>

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

122 uint64_t firstread, reclen, phys_bof;
123 char buf[sizeof (reclen)];
124 int err;
125
126 phys_bof = spa_history_log_to_phys(shpp->sh_bof, shpp);
127 firstread = MIN(sizeof (reclen), shpp->sh_phys_max_off - phys_bof);
128
129 if ((err = dmu_read(mos, spa->spa_history, phys_bof, firstread,
27#include <sys/spa.h>
28#include <sys/spa_impl.h>
29#include <sys/zap.h>
30#include <sys/dsl_synctask.h>
31#include <sys/dmu_tx.h>
32#include <sys/dmu_objset.h>
33#include <sys/utsname.h>
34#include <sys/sunddi.h>

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

120 uint64_t firstread, reclen, phys_bof;
121 char buf[sizeof (reclen)];
122 int err;
123
124 phys_bof = spa_history_log_to_phys(shpp->sh_bof, shpp);
125 firstread = MIN(sizeof (reclen), shpp->sh_phys_max_off - phys_bof);
126
127 if ((err = dmu_read(mos, spa->spa_history, phys_bof, firstread,
130 buf)) != 0)
128 buf, DMU_READ_PREFETCH)) != 0)
131 return (err);
132 if (firstread != sizeof (reclen)) {
133 if ((err = dmu_read(mos, spa->spa_history,
134 shpp->sh_pool_create_len, sizeof (reclen) - firstread,
129 return (err);
130 if (firstread != sizeof (reclen)) {
131 if ((err = dmu_read(mos, spa->spa_history,
132 shpp->sh_pool_create_len, sizeof (reclen) - firstread,
135 buf + firstread)) != 0)
133 buf + firstread, DMU_READ_PREFETCH)) != 0)
136 return (err);
137 }
138
139 reclen = LE_64(*((uint64_t *)buf));
140 shpp->sh_bof += reclen + sizeof (reclen);
141 shpp->sh_records_lost++;
142 return (0);
143}

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

376 *len = read_len + leftover;
377
378 if (read_len == 0) {
379 mutex_exit(&spa->spa_history_lock);
380 dmu_buf_rele(dbp, FTAG);
381 return (0);
382 }
383
134 return (err);
135 }
136
137 reclen = LE_64(*((uint64_t *)buf));
138 shpp->sh_bof += reclen + sizeof (reclen);
139 shpp->sh_records_lost++;
140 return (0);
141}

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

374 *len = read_len + leftover;
375
376 if (read_len == 0) {
377 mutex_exit(&spa->spa_history_lock);
378 dmu_buf_rele(dbp, FTAG);
379 return (0);
380 }
381
384 err = dmu_read(mos, spa->spa_history, phys_read_off, read_len, buf);
382 err = dmu_read(mos, spa->spa_history, phys_read_off, read_len, buf,
383 DMU_READ_PREFETCH);
385 if (leftover && err == 0) {
386 err = dmu_read(mos, spa->spa_history, shpp->sh_pool_create_len,
384 if (leftover && err == 0) {
385 err = dmu_read(mos, spa->spa_history, shpp->sh_pool_create_len,
387 leftover, buf + read_len);
386 leftover, buf + read_len, DMU_READ_PREFETCH);
388 }
389 mutex_exit(&spa->spa_history_lock);
390
391 dmu_buf_rele(dbp, FTAG);
392 return (err);
393}
394
395void

--- 34 unchanged lines hidden ---
387 }
388 mutex_exit(&spa->spa_history_lock);
389
390 dmu_buf_rele(dbp, FTAG);
391 return (err);
392}
393
394void

--- 34 unchanged lines hidden ---