From patchwork Mon Feb 23 19:22:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 8495 X-Patchwork-Delegate: agk@redhat.com 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 n1NJMgvg030019 for ; Mon, 23 Feb 2009 19:22:42 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 25067619F2F; Mon, 23 Feb 2009 14:22:40 -0500 (EST) 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 n1NJMdfK011704 for ; Mon, 23 Feb 2009 14:22:39 -0500 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 n1NJMdrx030342 for ; Mon, 23 Feb 2009 14:22:39 -0500 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 n1NJMaHI025508 for ; Mon, 23 Feb 2009 14:22:36 -0500 Received: from localhost (mpatocka@localhost) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1/Submit) with ESMTP id n1NJMaNJ025502 for ; Mon, 23 Feb 2009 14:22:36 -0500 X-Authentication-Warning: hs20-bc2-1.build.redhat.com: mpatocka owned process doing -bs Date: Mon, 23 Feb 2009 14:22:36 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@hs20-bc2-1.build.redhat.com To: dm-devel@redhat.com Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 12/14] barriers 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 >From mbroz@redhat.com Thu Jan 8 11:14:02 2009 Date: Thu, 08 Jan 2009 17:13:12 +0100 From: Milan Broz Reply-To: device-mapper development To: device-mapper development Subject: [dm-devel] [PATCH 1/4] dm-core: remove current partial barrier implementation Prepare for full barrier implementation - remove the simple one Signed-off-by: Milan Broz --- drivers/md/dm-linear.c | 1 - drivers/md/dm-table.c | 19 ------------------- drivers/md/dm.c | 15 ++++++++++----- drivers/md/dm.h | 1 - include/linux/device-mapper.h | 1 - 5 files changed, 10 insertions(+), 27 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6.29-rc3-devel/drivers/md/dm-linear.c =================================================================== --- linux-2.6.29-rc3-devel.orig/drivers/md/dm-linear.c 2009-02-05 05:33:47.000000000 +0100 +++ linux-2.6.29-rc3-devel/drivers/md/dm-linear.c 2009-02-05 05:33:52.000000000 +0100 @@ -142,7 +142,6 @@ static struct target_type linear_target .status = linear_status, .ioctl = linear_ioctl, .merge = linear_merge, - .features = DM_TARGET_SUPPORTS_BARRIERS, }; int __init dm_linear_init(void) Index: linux-2.6.29-rc3-devel/drivers/md/dm-table.c =================================================================== --- linux-2.6.29-rc3-devel.orig/drivers/md/dm-table.c 2009-02-05 05:33:48.000000000 +0100 +++ linux-2.6.29-rc3-devel/drivers/md/dm-table.c 2009-02-05 05:33:52.000000000 +0100 @@ -52,8 +52,6 @@ struct dm_table { sector_t *highs; struct dm_target *targets; - unsigned barriers_supported:1; - /* * Indicates the rw permissions for the new logical * device. This should be a combination of FMODE_READ @@ -240,7 +238,6 @@ int dm_table_create(struct dm_table **re INIT_LIST_HEAD(&t->devices); atomic_set(&t->holders, 0); - t->barriers_supported = 1; if (!num_targets) num_targets = KEYS_PER_NODE; @@ -741,10 +738,6 @@ int dm_table_add_target(struct dm_table /* FIXME: the plan is to combine high here and then have * the merge fn apply the target level restrictions. */ combine_restrictions_low(&t->limits, &tgt->limits); - - if (!(tgt->type->features & DM_TARGET_SUPPORTS_BARRIERS)) - t->barriers_supported = 0; - return 0; bad: @@ -789,12 +782,6 @@ int dm_table_complete(struct dm_table *t check_for_valid_limits(&t->limits); - /* - * We only support barriers if there is exactly one underlying device. - */ - if (!list_is_singular(&t->devices)) - t->barriers_supported = 0; - /* how many indexes will the btree have ? */ leaf_nodes = dm_div_up(t->num_targets, KEYS_PER_NODE); t->depth = 1 + int_log(leaf_nodes, CHILDREN_PER_NODE); @@ -1008,12 +995,6 @@ struct mapped_device *dm_table_get_md(st return t->md; } -int dm_table_barrier_ok(struct dm_table *t) -{ - return t->barriers_supported; -} -EXPORT_SYMBOL(dm_table_barrier_ok); - EXPORT_SYMBOL(dm_vcalloc); EXPORT_SYMBOL(dm_get_device); EXPORT_SYMBOL(dm_put_device); Index: linux-2.6.29-rc3-devel/drivers/md/dm.c =================================================================== --- linux-2.6.29-rc3-devel.orig/drivers/md/dm.c 2009-02-05 05:33:51.000000000 +0100 +++ linux-2.6.29-rc3-devel/drivers/md/dm.c 2009-02-05 05:33:52.000000000 +0100 @@ -831,11 +831,7 @@ static void __process_bio(struct mapped_ bio_io_error(bio); return; } - if (unlikely(bio_barrier(bio) && !dm_table_barrier_ok(ci.map))) { - dm_table_put(ci.map); - bio_endio(bio, -EOPNOTSUPP); - return; - } + ci.md = md; ci.bio = bio; ci.io = alloc_io(md); @@ -917,6 +913,15 @@ static int dm_request(struct request_que struct mapped_device *md = q->queuedata; int cpu; + /* + * There is no use in forwarding any barrier request since we can't + * guarantee it is (or can be) handled by the targets correctly. + */ + if (unlikely(bio_barrier(bio))) { + bio_endio(bio, -EOPNOTSUPP); + return 0; + } + down_read(&md->io_lock); cpu = part_stat_lock(); Index: linux-2.6.29-rc3-devel/drivers/md/dm.h =================================================================== --- linux-2.6.29-rc3-devel.orig/drivers/md/dm.h 2009-02-05 05:33:48.000000000 +0100 +++ linux-2.6.29-rc3-devel/drivers/md/dm.h 2009-02-05 05:33:52.000000000 +0100 @@ -52,7 +52,6 @@ int dm_table_any_congested(struct dm_tab * To check the return value from dm_table_find_target(). */ #define dm_target_is_valid(t) ((t)->table) -int dm_table_barrier_ok(struct dm_table *t); /*----------------------------------------------------------------- * A registry of target types. Index: linux-2.6.29-rc3-devel/include/linux/device-mapper.h =================================================================== --- linux-2.6.29-rc3-devel.orig/include/linux/device-mapper.h 2009-02-05 05:33:48.000000000 +0100 +++ linux-2.6.29-rc3-devel/include/linux/device-mapper.h 2009-02-05 05:33:52.000000000 +0100 @@ -116,7 +116,6 @@ void dm_put_device(struct dm_target *ti, /* * Target features */ -#define DM_TARGET_SUPPORTS_BARRIERS 0x00000001 struct target_type { uint64_t features;