Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk

This commit is contained in:
Brian Behlendorf 2010-05-28 12:42:42 -07:00
commit f86bf1dc03
16 changed files with 104 additions and 109 deletions

View File

@ -689,14 +689,15 @@ libzfs_mnttab_remove(libzfs_handle_t *hdl, const char *fsname)
} }
int int
zfs_spa_version(zfs_handle_t *zhp, int *version) zfs_spa_version(zfs_handle_t *zhp, int *spa_version)
{ {
zpool_handle_t *handle = zhp->zpool_hdl; zpool_handle_t *zpool_handle = zhp->zpool_hdl;
if (handle == NULL) if (zpool_handle == NULL)
return (-1); return (-1);
*version = zpool_get_prop_int(handle, ZPOOL_PROP_VERSION, NULL); *spa_version = zpool_get_prop_int(zpool_handle,
ZPOOL_PROP_VERSION, NULL);
return (0); return (0);
} }
@ -706,12 +707,12 @@ zfs_spa_version(zfs_handle_t *zhp, int *version)
static int static int
zfs_which_resv_prop(zfs_handle_t *zhp, zfs_prop_t *resv_prop) zfs_which_resv_prop(zfs_handle_t *zhp, zfs_prop_t *resv_prop)
{ {
int version; int spa_version;
if (zfs_spa_version(zhp, &version) < 0) if (zfs_spa_version(zhp, &spa_version) < 0)
return (-1); return (-1);
if (version >= SPA_VERSION_REFRESERVATION) if (spa_version >= SPA_VERSION_REFRESERVATION)
*resv_prop = ZFS_PROP_REFRESERVATION; *resv_prop = ZFS_PROP_REFRESERVATION;
else else
*resv_prop = ZFS_PROP_RESERVATION; *resv_prop = ZFS_PROP_RESERVATION;
@ -1744,11 +1745,11 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
*/ */
{ {
val = getprop_uint64(zhp, prop, &source); val = getprop_uint64(zhp, prop, &source);
time_t local_time = (time_t)val; time_t time = (time_t)val;
struct tm t; struct tm t;
if (literal || if (literal ||
localtime_r(&local_time, &t) == NULL || localtime_r(&time, &t) == NULL ||
strftime(propbuf, proplen, "%a %b %e %k:%M %Y", strftime(propbuf, proplen, "%a %b %e %k:%M %Y",
&t) == 0) &t) == 0)
(void) snprintf(propbuf, proplen, "%llu", (u_longlong_t) val); (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t) val);

View File

@ -212,12 +212,12 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto)
* informative error message. * informative error message.
*/ */
static boolean_t static boolean_t
dir_is_empty(const char *dirn) dir_is_empty(const char *dirname)
{ {
DIR *dirp; DIR *dirp;
struct dirent64 *dp; struct dirent64 *dp;
if ((dirp = opendir(dirn)) == NULL) if ((dirp = opendir(dirname)) == NULL)
return (B_TRUE); return (B_TRUE);
while ((dp = readdir64(dirp)) != NULL) { while ((dp = readdir64(dirp)) != NULL) {

View File

@ -1895,13 +1895,13 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
*/ */
avl_tree_t *local_avl; avl_tree_t *local_avl;
nvlist_t *local_nv, *fs; nvlist_t *local_nv, *fs;
char *cp = strchr(zc.zc_value, '@');
/* /*
* XXX Do this faster by just iterating over snaps in * XXX Do this faster by just iterating over snaps in
* this fs. Also if zc_value does not exist, we will * this fs. Also if zc_value does not exist, we will
* get a strange "does not exist" error message. * get a strange "does not exist" error message.
*/ */
cp = strchr(zc.zc_value, '@');
*cp = '\0'; *cp = '\0';
if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, if (gather_nvlist(hdl, zc.zc_value, NULL, NULL,
&local_nv, &local_avl) == 0) { &local_nv, &local_avl) == 0) {

View File

@ -527,19 +527,19 @@ void
zfs_nicenum(uint64_t num, char *buf, size_t buflen) zfs_nicenum(uint64_t num, char *buf, size_t buflen)
{ {
uint64_t n = num; uint64_t n = num;
int i = 0, j; int index = 0;
char u; char u;
while (n >= 1024) { while (n >= 1024) {
n /= 1024; n /= 1024;
i++; index++;
} }
u = " KMGTPE"[i]; u = " KMGTPE"[index];
if (i == 0) { if (index == 0) {
(void) snprintf(buf, buflen, "%llu", (u_longlong_t) n); (void) snprintf(buf, buflen, "%llu", (u_longlong_t) n);
} else if ((num & ((1ULL << 10 * i) - 1)) == 0) { } else if ((num & ((1ULL << 10 * index) - 1)) == 0) {
/* /*
* If this is an even multiple of the base, always display * If this is an even multiple of the base, always display
* without any decimal precision. * without any decimal precision.
@ -555,9 +555,10 @@ zfs_nicenum(uint64_t num, char *buf, size_t buflen)
* develop some complex heuristics for this, but it's much * develop some complex heuristics for this, but it's much
* easier just to try each combination in turn. * easier just to try each combination in turn.
*/ */
for (j = 2; j >= 0; j--) { int i;
if (snprintf(buf, buflen, "%.*f%c", j, for (i = 2; i >= 0; i--) {
(double)num / (1ULL << 10 * i), u) <= 5) if (snprintf(buf, buflen, "%.*f%c", i,
(double)num / (1ULL << 10 * index), u) <= 5)
break; break;
} }
} }
@ -1387,7 +1388,7 @@ zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type)
{ {
zprop_list_t *entry; zprop_list_t *entry;
zprop_list_t **last; zprop_list_t **last;
expand_data_t ed; expand_data_t exp;
if (*plp == NULL) { if (*plp == NULL) {
/* /*
@ -1397,11 +1398,11 @@ zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type)
*/ */
last = plp; last = plp;
ed.last = last; exp.last = last;
ed.hdl = hdl; exp.hdl = hdl;
ed.type = type; exp.type = type;
if (zprop_iter_common(zprop_expand_list_cb, &ed, B_FALSE, if (zprop_iter_common(zprop_expand_list_cb, &exp, B_FALSE,
B_FALSE, type) == ZPROP_INVAL) B_FALSE, type) == ZPROP_INVAL)
return (-1); return (-1);

View File

@ -324,7 +324,7 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
int fd; int fd;
vnode_t *vp; vnode_t *vp;
int old_umask; int old_umask;
char real_path[MAXPATHLEN]; char realpath[MAXPATHLEN];
struct stat64 st; struct stat64 st;
int err; int err;
@ -352,14 +352,14 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
return (errno); return (errno);
} }
close(fd); close(fd);
(void) sprintf(real_path, "%s", path); (void) sprintf(realpath, "%s", path);
dsk = strstr(path, "/dsk/"); dsk = strstr(path, "/dsk/");
if (dsk != NULL) if (dsk != NULL)
(void) sprintf(real_path + (dsk - path) + 1, "r%s", (void) sprintf(realpath + (dsk - path) + 1, "r%s",
dsk + 1); dsk + 1);
} else { } else {
(void) sprintf(real_path, "%s", path); (void) sprintf(realpath, "%s", path);
if (!(flags & FCREAT) && stat64(real_path, &st) == -1) if (!(flags & FCREAT) && stat64(realpath, &st) == -1)
return (errno); return (errno);
} }
@ -378,7 +378,7 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
* The construct 'flags - FREAD' conveniently maps combinations of * The construct 'flags - FREAD' conveniently maps combinations of
* FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR. * FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR.
*/ */
fd = open64(real_path, flags - FREAD, mode); fd = open64(realpath, flags - FREAD, mode);
if (flags & FCREAT) if (flags & FCREAT)
(void) umask(old_umask); (void) umask(old_umask);
@ -418,16 +418,16 @@ int
vn_openat(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, vn_openat(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2,
int x3, vnode_t *startvp, int fd) int x3, vnode_t *startvp, int fd)
{ {
char *real_path = umem_alloc(strlen(path) + 2, UMEM_NOFAIL); char *realpath = umem_alloc(strlen(path) + 2, UMEM_NOFAIL);
int ret; int ret;
ASSERT(startvp == rootdir); ASSERT(startvp == rootdir);
(void) sprintf(real_path, "/%s", path); (void) sprintf(realpath, "/%s", path);
/* fd ignored for now, need if want to simulate nbmand support */ /* fd ignored for now, need if want to simulate nbmand support */
ret = vn_open(real_path, x1, flags, mode, vpp, x2, x3); ret = vn_open(realpath, x1, flags, mode, vpp, x2, x3);
umem_free(real_path, strlen(path) + 2); umem_free(realpath, strlen(path) + 2);
return (ret); return (ret);
} }
@ -785,11 +785,11 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len)
} }
int int
ddi_strtoul(const char *serial, char **nptr, int base, unsigned long *result) ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result)
{ {
char *end; char *end;
*result = strtoul(serial, &end, base); *result = strtoul(hw_serial, &end, base);
if (*result == 0) if (*result == 0)
return (errno); return (errno);
return (0); return (0);

View File

@ -41,24 +41,24 @@ void
nicenum(uint64_t num, char *buf) nicenum(uint64_t num, char *buf)
{ {
uint64_t n = num; uint64_t n = num;
int i = 0; int index = 0;
char u; char u;
while (n >= 1024) { while (n >= 1024) {
n = (n + (1024 / 2)) / 1024; /* Round up or down */ n = (n + (1024 / 2)) / 1024; /* Round up or down */
i++; index++;
} }
u = " KMGTPE"[i]; u = " KMGTPE"[index];
if (i == 0) { if (index == 0) {
(void) sprintf(buf, "%llu", (u_longlong_t)n); (void) sprintf(buf, "%llu", (u_longlong_t)n);
} else if (n < 10 && (num & (num - 1)) != 0) { } else if (n < 10 && (num & (num - 1)) != 0) {
(void) sprintf(buf, "%.2f%c", (void) sprintf(buf, "%.2f%c",
(double)num / (1ULL << 10 * i), u); (double)num / (1ULL << 10 * index), u);
} else if (n < 100 && (num & (num - 1)) != 0) { } else if (n < 100 && (num & (num - 1)) != 0) {
(void) sprintf(buf, "%.1f%c", (void) sprintf(buf, "%.1f%c",
(double)num / (1ULL << 10 * i), u); (double)num / (1ULL << 10 * index), u);
} else { } else {
(void) sprintf(buf, "%llu%c", (u_longlong_t)n, u); (void) sprintf(buf, "%llu%c", (u_longlong_t)n, u);
} }

View File

@ -410,15 +410,15 @@ zfs_prop_userquota(const char *name)
* (strings) and internal representation (uint64_t). * (strings) and internal representation (uint64_t).
*/ */
int int
zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *idx) zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *index)
{ {
return (zprop_string_to_index(prop, string, idx, ZFS_TYPE_DATASET)); return (zprop_string_to_index(prop, string, index, ZFS_TYPE_DATASET));
} }
int int
zfs_prop_index_to_string(zfs_prop_t prop, uint64_t idx, const char **string) zfs_prop_index_to_string(zfs_prop_t prop, uint64_t index, const char **string)
{ {
return (zprop_index_to_string(prop, idx, string, ZFS_TYPE_DATASET)); return (zprop_index_to_string(prop, index, string, ZFS_TYPE_DATASET));
} }
/* /*

View File

@ -154,16 +154,16 @@ zpool_prop_default_numeric(zpool_prop_t prop)
int int
zpool_prop_string_to_index(zpool_prop_t prop, const char *string, zpool_prop_string_to_index(zpool_prop_t prop, const char *string,
uint64_t *idx) uint64_t *index)
{ {
return (zprop_string_to_index(prop, string, idx, ZFS_TYPE_POOL)); return (zprop_string_to_index(prop, string, index, ZFS_TYPE_POOL));
} }
int int
zpool_prop_index_to_string(zpool_prop_t prop, uint64_t idx, zpool_prop_index_to_string(zpool_prop_t prop, uint64_t index,
const char **string) const char **string)
{ {
return (zprop_index_to_string(prop, idx, string, ZFS_TYPE_POOL)); return (zprop_index_to_string(prop, index, string, ZFS_TYPE_POOL));
} }
#ifndef _KERNEL #ifndef _KERNEL

View File

@ -256,7 +256,7 @@ zprop_name_to_prop(const char *propname, zfs_type_t type)
} }
int int
zprop_string_to_index(int prop, const char *string, uint64_t *idx, zprop_string_to_index(int prop, const char *string, uint64_t *index,
zfs_type_t type) zfs_type_t type)
{ {
zprop_desc_t *prop_tbl; zprop_desc_t *prop_tbl;
@ -273,7 +273,7 @@ zprop_string_to_index(int prop, const char *string, uint64_t *idx,
for (i = 0; idx_tbl[i].pi_name != NULL; i++) { for (i = 0; idx_tbl[i].pi_name != NULL; i++) {
if (strcmp(string, idx_tbl[i].pi_name) == 0) { if (strcmp(string, idx_tbl[i].pi_name) == 0) {
*idx = idx_tbl[i].pi_value; *index = idx_tbl[i].pi_value;
return (0); return (0);
} }
} }
@ -282,7 +282,7 @@ zprop_string_to_index(int prop, const char *string, uint64_t *idx,
} }
int int
zprop_index_to_string(int prop, uint64_t idx, const char **string, zprop_index_to_string(int prop, uint64_t index, const char **string,
zfs_type_t type) zfs_type_t type)
{ {
zprop_desc_t *prop_tbl; zprop_desc_t *prop_tbl;
@ -298,7 +298,7 @@ zprop_index_to_string(int prop, uint64_t idx, const char **string,
return (-1); return (-1);
for (i = 0; idx_tbl[i].pi_name != NULL; i++) { for (i = 0; idx_tbl[i].pi_name != NULL; i++) {
if (idx_tbl[i].pi_value == idx) { if (idx_tbl[i].pi_value == index) {
*string = idx_tbl[i].pi_name; *string = idx_tbl[i].pi_name;
return (0); return (0);
} }

View File

@ -184,7 +184,7 @@ dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp)
*/ */
static int static int
dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
int rd, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags)
{ {
dsl_pool_t *dp = NULL; dsl_pool_t *dp = NULL;
dmu_buf_t **dbp; dmu_buf_t **dbp;
@ -235,7 +235,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
return (EIO); return (EIO);
} }
/* initiate async i/o */ /* initiate async i/o */
if (rd) { if (read) {
(void) dbuf_read(db, zio, dbuf_flags); (void) dbuf_read(db, zio, dbuf_flags);
} }
dbp[i] = &db->db; dbp[i] = &db->db;
@ -253,7 +253,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
} }
/* wait for other io to complete */ /* wait for other io to complete */
if (rd) { if (read) {
for (i = 0; i < nblks; i++) { for (i = 0; i < nblks; i++) {
dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbp[i]; dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbp[i];
mutex_enter(&db->db_mtx); mutex_enter(&db->db_mtx);
@ -277,7 +277,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
static int static int
dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset, dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
uint64_t length, int rd, void *tag, int *numbufsp, dmu_buf_t ***dbpp) uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp)
{ {
dnode_t *dn; dnode_t *dn;
int err; int err;
@ -286,7 +286,7 @@ dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
if (err) if (err)
return (err); return (err);
err = dmu_buf_hold_array_by_dnode(dn, offset, length, rd, tag, err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag,
numbufsp, dbpp, DMU_READ_PREFETCH); numbufsp, dbpp, DMU_READ_PREFETCH);
dnode_rele(dn, FTAG); dnode_rele(dn, FTAG);
@ -296,12 +296,12 @@ dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
int int
dmu_buf_hold_array_by_bonus(dmu_buf_t *db, uint64_t offset, dmu_buf_hold_array_by_bonus(dmu_buf_t *db, uint64_t offset,
uint64_t length, int rd, void *tag, int *numbufsp, dmu_buf_t ***dbpp) uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp)
{ {
dnode_t *dn = ((dmu_buf_impl_t *)db)->db_dnode; dnode_t *dn = ((dmu_buf_impl_t *)db)->db_dnode;
int err; int err;
err = dmu_buf_hold_array_by_dnode(dn, offset, length, rd, tag, err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag,
numbufsp, dbpp, DMU_READ_PREFETCH); numbufsp, dbpp, DMU_READ_PREFETCH);
return (err); return (err);

View File

@ -1178,11 +1178,11 @@ dmu_objset_fsid_guid(objset_t *os)
} }
void void
dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *st) dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat)
{ {
st->dds_type = os->os->os_phys->os_type; stat->dds_type = os->os->os_phys->os_type;
if (os->os->os_dsl_dataset) if (os->os->os_dsl_dataset)
dsl_dataset_fast_stat(os->os->os_dsl_dataset, st); dsl_dataset_fast_stat(os->os->os_dsl_dataset, stat);
} }
void void

View File

@ -901,28 +901,6 @@ restore_free(struct restorearg *ra, objset_t *os,
return (err); return (err);
} }
/*
* Compute checksum of drr_begin record
*/
static void
dmu_recv_stream_cksum(dmu_recv_cookie_t *drc, struct restorearg *ra)
{
dmu_replay_record_t *drr;
drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
drr->drr_type = DRR_BEGIN;
drr->drr_u.drr_begin = *drc->drc_drrb;
if (ra->byteswap) {
fletcher_4_incremental_byteswap(drr,
sizeof (dmu_replay_record_t), &(ra->cksum));
} else {
fletcher_4_incremental_native(drr,
sizeof (dmu_replay_record_t), &(ra->cksum));
}
kmem_free(drr, sizeof (dmu_replay_record_t));
}
/* /*
* NB: callers *must* call dmu_recv_end() if this succeeds. * NB: callers *must* call dmu_recv_end() if this succeeds.
*/ */
@ -937,7 +915,22 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC))
ra.byteswap = TRUE; ra.byteswap = TRUE;
dmu_recv_stream_cksum(drc, &ra); {
/* compute checksum of drr_begin record */
dmu_replay_record_t *drr;
drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
drr->drr_type = DRR_BEGIN;
drr->drr_u.drr_begin = *drc->drc_drrb;
if (ra.byteswap) {
fletcher_4_incremental_byteswap(drr,
sizeof (dmu_replay_record_t), &ra.cksum);
} else {
fletcher_4_incremental_native(drr,
sizeof (dmu_replay_record_t), &ra.cksum);
}
kmem_free(drr, sizeof (dmu_replay_record_t));
}
if (ra.byteswap) { if (ra.byteswap) {
struct drr_begin *drrb = drc->drc_drrb; struct drr_begin *drrb = drc->drc_drrb;

View File

@ -444,7 +444,7 @@ top:
if (zs) { if (zs) {
if (reset) { if (reset) {
zstream_t *rm = zs; zstream_t *remove = zs;
rc = 0; rc = 0;
mutex_exit(&zs->zst_lock); mutex_exit(&zs->zst_lock);
@ -456,7 +456,7 @@ top:
*/ */
for (zs = list_head(&zf->zf_stream); zs; for (zs = list_head(&zf->zf_stream); zs;
zs = list_next(&zf->zf_stream, zs)) { zs = list_next(&zf->zf_stream, zs)) {
if (zs == rm) { if (zs == remove) {
dmu_zfetch_stream_remove(zf, zs); dmu_zfetch_stream_remove(zf, zs);
mutex_destroy(&zs->zst_lock); mutex_destroy(&zs->zst_lock);
kmem_free(zs, sizeof (zstream_t)); kmem_free(zs, sizeof (zstream_t));

View File

@ -659,10 +659,10 @@ dnode_hold_impl(objset_impl_t *os, uint64_t object, int flag,
} }
if ((dn = children_dnodes[idx]) == NULL) { if ((dn = children_dnodes[idx]) == NULL) {
dnode_phys_t *dnpp = (dnode_phys_t *)db->db.db_data+idx; dnode_phys_t *dnp = (dnode_phys_t *)db->db.db_data+idx;
dnode_t *winner; dnode_t *winner;
dn = dnode_create(os, dnpp, db, object); dn = dnode_create(os, dnp, db, object);
winner = atomic_cas_ptr(&children_dnodes[idx], NULL, dn); winner = atomic_cas_ptr(&children_dnodes[idx], NULL, dn);
if (winner != NULL) { if (winner != NULL) {
dnode_destroy(dn); dnode_destroy(dn);

View File

@ -154,12 +154,12 @@ txg_thread_exit(tx_state_t *tx, callb_cpr_t *cpr, kthread_t **tpp)
} }
static void static void
txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t wt) txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t time)
{ {
CALLB_CPR_SAFE_BEGIN(cpr); CALLB_CPR_SAFE_BEGIN(cpr);
if (wt) if (time)
(void) cv_timedwait(cv, &tx->tx_sync_lock, lbolt + wt); (void) cv_timedwait(cv, &tx->tx_sync_lock, lbolt + time);
else else
cv_wait(cv, &tx->tx_sync_lock); cv_wait(cv, &tx->tx_sync_lock);

View File

@ -1506,7 +1506,7 @@ vdev_raidz_combrec(zio_t *zio, int total_errors, int data_errors)
void *orig[VDEV_RAIDZ_MAXPARITY]; void *orig[VDEV_RAIDZ_MAXPARITY];
int tstore[VDEV_RAIDZ_MAXPARITY + 2]; int tstore[VDEV_RAIDZ_MAXPARITY + 2];
int *tgts = &tstore[1]; int *tgts = &tstore[1];
int curr, next, i, c, n; int current, next, i, c, n;
int code, ret = 0; int code, ret = 0;
ASSERT(total_errors < rm->rm_firstdatacol); ASSERT(total_errors < rm->rm_firstdatacol);
@ -1554,12 +1554,12 @@ vdev_raidz_combrec(zio_t *zio, int total_errors, int data_errors)
orig[n - 1] = zio_buf_alloc(rm->rm_col[0].rc_size); orig[n - 1] = zio_buf_alloc(rm->rm_col[0].rc_size);
curr = 0; current = 0;
next = tgts[curr]; next = tgts[current];
while (curr != n) { while (current != n) {
tgts[curr] = next; tgts[current] = next;
curr = 0; current = 0;
/* /*
* Save off the original data that we're going to * Save off the original data that we're going to
@ -1606,34 +1606,34 @@ vdev_raidz_combrec(zio_t *zio, int total_errors, int data_errors)
do { do {
/* /*
* Find the next valid column after the curr * Find the next valid column after the current
* position.. * position..
*/ */
for (next = tgts[curr] + 1; for (next = tgts[current] + 1;
next < rm->rm_cols && next < rm->rm_cols &&
rm->rm_col[next].rc_error != 0; next++) rm->rm_col[next].rc_error != 0; next++)
continue; continue;
ASSERT(next <= tgts[curr + 1]); ASSERT(next <= tgts[current + 1]);
/* /*
* If that spot is available, we're done here. * If that spot is available, we're done here.
*/ */
if (next != tgts[curr + 1]) if (next != tgts[current + 1])
break; break;
/* /*
* Otherwise, find the next valid column after * Otherwise, find the next valid column after
* the previous position. * the previous position.
*/ */
for (c = tgts[curr - 1] + 1; for (c = tgts[current - 1] + 1;
rm->rm_col[c].rc_error != 0; c++) rm->rm_col[c].rc_error != 0; c++)
continue; continue;
tgts[curr] = c; tgts[current] = c;
curr++; current++;
} while (curr != n); } while (current != n);
} }
} }
n--; n--;