[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] Re: [PATCH v4 06/13] dm snapshot: merge target should not allocate new exceptions




On Fri, 20 Nov 2009, Mike Snitzer wrote:

> On Fri, Nov 20 2009 at  3:27pm -0500,
> Mike Snitzer <snitzer redhat com> wrote:
> 
> > If a write request to a merging snapshot device is to be dispatched
> > directly to the origin (because the chunk is not remapped or was already
> > merged), snapshot_merge_map() must make exceptions in other snapshots.
> ...
> > +static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
> > +			      union map_info *map_context)
> > +{
> > +	struct dm_exception *e;
> > +	struct dm_snapshot *s = ti->private;
> > +	int r = DM_MAPIO_REMAPPED;
> > +	chunk_t chunk;
> > +
> > +	chunk = sector_to_chunk(s->store, bio->bi_sector);
> > +
> > +	down_read(&s->lock);
> > +
> > +	/* Full snapshots are not usable */
> > +	if (!s->valid) {
> > +		r = -EIO;
> > +		goto out_unlock;
> > +	}
> > +
> > +	/* If the block is already remapped - use that */
> > +	e = dm_lookup_exception(&s->complete, chunk);
> > +	if (e) {
> > +		remap_exception(s, e, bio, chunk);
> > +		goto out_unlock;
> > +	}
> > +
> > +	bio->bi_bdev = s->origin->bdev;
> > +
> > +	if (bio_rw(bio) == WRITE) {
> > +		up_write(&s->lock);
> > +		return do_origin(s->origin, bio);
> > +	}
> 
> OK, I caught this in review but clearly didn't refresh the patch; the
> above up_write() should be up_read().
> 
> Mike

Right.

BTW, this will be converted to a single lock (non-read-write) anyway, when 
those clustering patches will be applied.

Mikulas


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]