From patchwork Fri Dec 10 23:24:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 399782 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBANQWFI001817 for ; Fri, 10 Dec 2010 23:26:52 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oBANOeKS012629; Fri, 10 Dec 2010 18:24:40 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oBANOchO006620 for ; Fri, 10 Dec 2010 18:24:38 -0500 Received: from hydrogen.msp.redhat.com (hydrogen.msp.redhat.com [10.15.80.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBANOWtq007380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Dec 2010 18:24:33 -0500 Received: from hydrogen.msp.redhat.com ([127.0.0.1]) by hydrogen.msp.redhat.com (8.14.1/8.14.1) with ESMTP id oBANOW8d019837; Fri, 10 Dec 2010 17:24:32 -0600 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id oBANOVOm019836; Fri, 10 Dec 2010 17:24:31 -0600 Date: Fri, 10 Dec 2010 17:24:31 -0600 From: Jonathan Brassow Message-Id: <201012102324.oBANOVOm019836@hydrogen.msp.redhat.com> To: dm-devel@redhat.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: agk@redhat.com Subject: [dm-devel] [PATCH 6 of 8] dm unplug callback X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 10 Dec 2010 23:26:52 +0000 (UTC) Index: linux-2.6/drivers/md/dm-raid.c =================================================================== --- linux-2.6.orig/drivers/md/dm-raid.c +++ linux-2.6/drivers/md/dm-raid.c @@ -330,6 +330,14 @@ static int raid_is_congested(void *v, in callbacks); return md_raid5_congested(&rs->md, bits); } +static void raid_unplug(void *v) +{ + struct target_callbacks *cb = v; + struct raid_set *rs = container_of(cb, struct raid_set, + callbacks); + md_raid5_unplug_device(rs->md.private); +} + /* * Construct a RAID4/5/6 mapping: * Args: @@ -413,6 +421,7 @@ static int raid_ctr(struct dm_target *ti if (errnum) goto err; + rs->callbacks.unplug_fn = raid_unplug; rs->callbacks.congested_fn = raid_is_congested; dm_table_add_callbacks(ti->table, &rs->callbacks); Index: linux-2.6/drivers/md/dm-table.c =================================================================== --- linux-2.6.orig/drivers/md/dm-table.c +++ linux-2.6/drivers/md/dm-table.c @@ -1283,6 +1283,7 @@ void dm_table_unplug_all(struct dm_table { struct dm_dev_internal *dd; struct list_head *devices = dm_table_get_devices(t); + struct target_callbacks *cb; list_for_each_entry(dd, devices, list) { struct request_queue *q = bdev_get_queue(dd->dm_dev.bdev); @@ -1295,6 +1296,9 @@ void dm_table_unplug_all(struct dm_table dm_device_name(t->md), bdevname(dd->dm_dev.bdev, b)); } + list_for_each_entry(cb, &t->target_callbacks, list) + if (cb->unplug_fn) + cb->unplug_fn(cb); } struct mapped_device *dm_table_get_md(struct dm_table *t) Index: linux-2.6/include/linux/device-mapper.h =================================================================== --- linux-2.6.orig/include/linux/device-mapper.h +++ linux-2.6/include/linux/device-mapper.h @@ -197,6 +197,7 @@ struct dm_target { struct target_callbacks { struct list_head list; congested_fn *congested_fn; + void (*unplug_fn)(void *); }; int dm_register_target(struct target_type *t);