Turn the "updating" flag (back) into two sequence number fields at
either ends of the structure so we have a way to determine if a snapshot is consistent.
This commit is contained in:
parent
63c4eff41a
commit
9b444236d6
@ -327,8 +327,8 @@ g_io_deliver(struct bio *bp, int error)
|
||||
}
|
||||
binuptime(&t1);
|
||||
/* Raise the "inconsistent" flag for userland */
|
||||
atomic_set_acq_int(&cp->stat->updating, 1);
|
||||
atomic_set_acq_int(&pp->stat->updating, 1);
|
||||
atomic_add_acq_int(&cp->stat->seq0, 1);
|
||||
atomic_add_acq_int(&pp->stat->seq0, 1);
|
||||
if (idx >= 0) {
|
||||
/* Account the service time */
|
||||
dt = t1;
|
||||
@ -360,8 +360,8 @@ g_io_deliver(struct bio *bp, int error)
|
||||
bintime_add(&pp->stat->bt, &dt);
|
||||
pp->stat->wentbusy = t1;
|
||||
/* Mark the structures as consistent again */
|
||||
atomic_store_rel_int(&cp->stat->updating, 0);
|
||||
atomic_store_rel_int(&pp->stat->updating, 0);
|
||||
atomic_add_acq_int(&cp->stat->seq1, 1);
|
||||
atomic_add_acq_int(&pp->stat->seq1, 1);
|
||||
}
|
||||
cp->stat->nend++;
|
||||
pp->stat->nend++;
|
||||
|
@ -38,11 +38,10 @@
|
||||
* providers. See libgeom(3) for how to get hold of these.
|
||||
*/
|
||||
struct g_stat {
|
||||
int updating;
|
||||
int seq0;
|
||||
/*
|
||||
* If non-zero, the structure is being
|
||||
* updated by the kernel and the contents
|
||||
* should not be used.
|
||||
* Sequence number, used with seq1 to determine
|
||||
* if snapshot is consistent.
|
||||
*/
|
||||
|
||||
void *id;
|
||||
@ -81,6 +80,8 @@ struct g_stat {
|
||||
#define G_STAT_IDX_WRITE 1
|
||||
#define G_STAT_IDX_DELETE 2
|
||||
|
||||
int seq1;
|
||||
/* See seq0 */
|
||||
};
|
||||
|
||||
#endif /* _GEOM_GEOM_STATS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user