diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2007-05-30 15:59:36 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2007-05-30 15:59:36 +0000 |
commit | d6d5b8a14834bcf7c886975434ca4e9a7df71b6c (patch) | |
tree | 6238e1680d241ecd9a11942b93f6fe8f9ab5d161 /sys/dev | |
parent | 6921c3989cb4a1cc0037e85d8c53f9cbe1f52c26 (diff) |
Sync after the metadata is saved.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/softraid.c | 16 | ||||
-rw-r--r-- | sys/dev/softraidvar.h | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 222a807e7fc..cf06191cfc7 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.58 2007/05/30 13:55:47 tedu Exp $ */ +/* $OpenBSD: softraid.c,v 1.59 2007/05/30 15:59:35 marco Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -397,6 +397,7 @@ sr_put_wu(struct sr_workunit *wu) wu->swu_blk_start = 0; wu->swu_blk_end = 0; wu->swu_collider = NULL; + wu->swu_fake = 0; while ((ccb = TAILQ_FIRST(&wu->swu_ccb)) != NULL) { TAILQ_REMOVE(&wu->swu_ccb, ccb, ccb_link); @@ -1528,14 +1529,17 @@ int sr_raid_sync(struct sr_workunit *wu) { struct sr_discipline *sd = wu->swu_dis; - int s, rv = 0; + int s, rv = 0, ios; DNPRINTF(SR_D_DIS, "%s: sr_raid_sync\n", DEVNAME(sd->sd_sc)); + /* when doing a fake sync don't coun't the wu */ + ios = wu->swu_fake ? 0 : 1; + s = splbio(); sd->sd_sync = 1; - while (sd->sd_wu_pending > 1) + while (sd->sd_wu_pending > ios) if (tsleep(sd, PRIBIO, "sr_sync", 60 * hz) == EWOULDBLOCK) { DNPRINTF(SR_D_DIS, "%s: sr_raid_sync timeout\n", DEVNAME(sd->sd_sc)); @@ -2140,6 +2144,7 @@ sr_save_metadata(struct sr_discipline *sd, u_int32_t flags) struct sr_chunk_meta *im_sc; struct sr_chunk *src; struct buf b; + struct sr_workunit wu; int i, rv = 1, ch = 0; size_t sz = SR_META_SIZE * 512; @@ -2257,6 +2262,11 @@ sr_save_metadata(struct sr_discipline *sd, u_int32_t flags) DEVNAME(sc), src->src_meta.scm_devname); } + bzero(&wu, sizeof(wu)); + wu.swu_fake = 1; + wu.swu_dis = sd; + sd->sd_scsi_sync(&wu); + rv = 0; bad: return (rv); diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h index ca55b2f41dc..d39f0897464 100644 --- a/sys/dev/softraidvar.h +++ b/sys/dev/softraidvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softraidvar.h,v 1.25 2007/05/30 13:55:47 tedu Exp $ */ +/* $OpenBSD: softraidvar.h,v 1.26 2007/05/30 15:59:35 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <sro@peereboom.us> * @@ -90,6 +90,7 @@ struct sr_workunit { #define SR_WU_DEFERRED 5 #define SR_WU_PENDING 6 + int swu_fake; /* faked wu */ /* workunit io range */ daddr64_t swu_blk_start; daddr64_t swu_blk_end; |