[Tux3] Design note: Atomic filesystem changes
Daniel Phillips
phillips at phunq.net
Mon Jan 5 14:23:18 PST 2009
A gross typo I just noticed:
> void end_change(struct sb *sb, unsigned delta)
> {
> down_read(&sb->delta_lock);
> if (need_delta(sb)) {
> unsigned delta = atomic_read(&sb->delta);
> up_read(&sb->delta_lock);
> down_write(&sb->delta_lock);
> if (sb->delta == atomic_read(&delta)) {
> atomic_inc(&sb->delta);
> up_write(&sb->delta_lock);
> stage_delta(sb, delta);
> commit_delta(sb, delta);
> } else
> up_write(&sb->delta_lock);
> } else
> up_read(&sb->delta_lock);
> }
should be:
void end_change(struct sb *sb, unsigned delta)
{
if (need_delta(sb)) {
unsigned delta = atomic_read(&sb->delta);
up_read(&sb->delta_lock);
down_write(&sb->delta_lock);
if (sb->delta == atomic_read(&delta)) {
atomic_inc(&sb->delta);
up_write(&sb->delta_lock);
stage_delta(sb, delta);
commit_delta(sb, delta);
} else
up_write(&sb->delta_lock);
} else
up_read(&sb->delta_lock);
}
That is, the end_change already has the sb->delta read lock.
Regards,
Daniel
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list