From patchwork Fri Apr 10 05:13:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 17537 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 n3A5DPMW014496 for ; Fri, 10 Apr 2009 05:13:26 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 8290C61A327; Fri, 10 Apr 2009 01:13:26 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n3A5DOeR013249 for ; Fri, 10 Apr 2009 01:13:24 -0400 Received: from hs20-bc2-1.build.redhat.com (hs20-bc2-1.build.redhat.com [10.10.28.34]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3A5DSIa020346; Fri, 10 Apr 2009 01:13:28 -0400 Received: from hs20-bc2-1.build.redhat.com (localhost.localdomain [127.0.0.1]) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1) with ESMTP id n3A5DL8E002131; Fri, 10 Apr 2009 01:13:21 -0400 Received: from localhost (mpatocka@localhost) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1/Submit) with ESMTP id n3A5DKHq002125; Fri, 10 Apr 2009 01:13:20 -0400 X-Authentication-Warning: hs20-bc2-1.build.redhat.com: mpatocka owned process doing -bs Date: Fri, 10 Apr 2009 01:13:20 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@hs20-bc2-1.build.redhat.com To: dm-devel@redhat.com In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-loop: dm-devel@redhat.com Cc: Alasdair G Kergon Subject: [dm-devel] [PATCH 6/11] bottom-layer barrier support 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 Introduce __clone_and_map_empty_barrier that will pass empty barrier to the targets. Each target receives as many requests as it set up in num_flush_requests. Signed-off-by: Mikulas Patocka --- drivers/md/dm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6.30-rc1-devel/drivers/md/dm.c =================================================================== --- linux-2.6.30-rc1-devel.orig/drivers/md/dm.c 2009-04-10 06:33:28.000000000 +0200 +++ linux-2.6.30-rc1-devel/drivers/md/dm.c 2009-04-10 06:33:31.000000000 +0200 @@ -747,6 +747,8 @@ static struct bio *clone_bio(struct bio return clone; } +static int __clone_and_map_empty_barrier(struct clone_info *ci); + static int __clone_and_map(struct clone_info *ci) { struct bio *clone, *bio = ci->bio; @@ -754,6 +756,9 @@ static int __clone_and_map(struct clone_ sector_t len = 0, max; struct dm_target_io *tio; + if (unlikely(bio_empty_barrier(bio))) + return __clone_and_map_empty_barrier(ci); + ti = dm_table_find_target(ci->map, ci->sector); if (!dm_target_is_valid(ti)) return -EIO; @@ -847,6 +852,31 @@ static int __clone_and_map(struct clone_ return 0; } +static int __clone_and_map_empty_barrier(struct clone_info *ci) +{ + unsigned i, j, n; + n = dm_table_get_num_targets(ci->map); + for (i = 0; i < n; i++) { + struct bio *clone; + struct dm_target *ti = dm_table_get_target(ci->map, i); + for (j = 0; j < ti->num_flush_requests; j++) { + struct dm_target_io *tio = alloc_tio(ci->md); + tio->io = ci->io; + tio->ti = ti; + memset(&tio->info, 0, sizeof(tio->info)); + tio->info.flush_request = j; + + clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs); + __bio_clone(clone, ci->bio); + clone->bi_destructor = dm_bio_destructor; + + __map_bio(ti, clone, tio); + } + } + ci->sector_count = 0; + return 0; +} + /* * Split the bio into several clones and submit it to targets. */ @@ -874,6 +904,8 @@ static void __split_and_process_bio(stru ci.io->md = md; ci.sector = bio->bi_sector; ci.sector_count = bio_sectors(bio); + if (unlikely(bio_empty_barrier(bio))) + ci.sector_count = 1; ci.idx = bio->bi_idx; start_io_acct(ci.io);