From patchwork Tue Nov 17 20:35:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 60779 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAHKZgv6004656 for ; Tue, 17 Nov 2009 20:35:43 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id BCA998E05A7; Tue, 17 Nov 2009 15:35:41 -0500 (EST) Received: from int-mx08.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nAHKZc9I002018 for ; Tue, 17 Nov 2009 15:35:38 -0500 Received: from localhost (dhcp-100-19-150.bos.redhat.com [10.16.19.150]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAHKZbXe027624 for ; Tue, 17 Nov 2009 15:35:38 -0500 Date: Tue, 17 Nov 2009 15:35:37 -0500 From: Mike Snitzer To: dm-devel@redhat.com Message-ID: <20091117203537.GA18929@redhat.com> References: <1258474344-10886-1-git-send-email-snitzer@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1258474344-10886-1-git-send-email-snitzer@redhat.com> User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH v3 13/12] dm snapshot: avoid __minimum_chunk_size() during merge X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 34d8c3f..f91ee08 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -730,20 +730,25 @@ static void snapshot_merge_process(struct dm_snapshot *s) test_again: /* Reallocate other snapshots; must account for all 'linear_chunks' */ - down_read(&_origins_lock); - o = __lookup_origin(s->origin->bdev); must_wait = 0; - min_chunksize = __minimum_chunk_size(o); + /* + * Merging snapshot already has the origin's __minimum_chunk_size() + * stored in split_io (see: snapshot_merge_resume); avoid rediscovery + */ + min_chunksize = s->ti->split_io; if (min_chunksize) { chunk_t n; + + down_read(&_origins_lock); + o = __lookup_origin(s->origin->bdev); for (n = 0; n < io_size; n += min_chunksize) { r = __origin_write(&o->snapshots, dest.sector + n, NULL); if (r == DM_MAPIO_SUBMITTED) must_wait = 1; } + up_read(&_origins_lock); } - up_read(&_origins_lock); if (must_wait) { sleep_on_timeout(&_pending_exception_done, HZ / 100 + 1); goto test_again;