Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755847AbZKTUyP (ORCPT ); Fri, 20 Nov 2009 15:54:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755758AbZKTUyO (ORCPT ); Fri, 20 Nov 2009 15:54:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8399 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754918AbZKTUyL (ORCPT ); Fri, 20 Nov 2009 15:54:11 -0500 Date: Fri, 20 Nov 2009 15:54:16 -0500 From: Mike Snitzer To: dm-devel@redhat.com Cc: Mikulas Patocka , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 06/13] dm snapshot: merge target should not allocate new exceptions Message-ID: <20091120205416.GB9458@redhat.com> References: <1258748873-24185-1-git-send-email-snitzer@redhat.com> <1258748873-24185-7-git-send-email-snitzer@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1258748873-24185-7-git-send-email-snitzer@redhat.com> User-Agent: Mutt/1.5.20 (2009-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 48 On Fri, Nov 20 2009 at 3:27pm -0500, Mike Snitzer 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/