From patchwork Wed Jul 8 08:44:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikanth Karthikesan X-Patchwork-Id: 34578 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 n688mVSh012353 for ; Wed, 8 Jul 2009 08:48:31 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 5C98C618A84; Wed, 8 Jul 2009 04:48:30 -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 n688mTGT032087 for ; Wed, 8 Jul 2009 04:48:29 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n688mSim027713; Wed, 8 Jul 2009 04:48:28 -0400 Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n688mEG2024476; Wed, 8 Jul 2009 04:48:14 -0400 Received: from relay1.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id AB4BF8D893; Wed, 8 Jul 2009 10:48:13 +0200 (CEST) From: Nikanth Karthikesan Organization: suse.de To: Alasdair G Kergon Date: Wed, 8 Jul 2009 14:14:50 +0530 User-Agent: KMail/1.11.1 (Linux/2.6.31-rc2-0.1-default; KDE/4.2.1; x86_64; ; ) MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200907081414.50698.knikanth@suse.de> X-RedHat-Spam-Score: -5.839 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.31 X-loop: dm-devel@redhat.com Cc: device-mapper development Subject: [dm-devel] [PATCH] Emulate BLKRRPART on device-mapper 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: Hannes Reinecke Subject: Emulate BLKRRPART on device-mapper Partitions on device-mapper devices are managed by kpartx (if at all). So if we were just to send out a 'change' event if someone called BLKRRPART on these devices, kpartx will be triggered via udev and can manage the partitions accordingly. Signed-off-by: Hannes Reinecke Signed-off-by: Nikanth Karthikesan --- -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6-dm/drivers/md/dm.c =================================================================== --- linux-2.6-dm.orig/drivers/md/dm.c +++ linux-2.6-dm/drivers/md/dm.c @@ -394,19 +394,25 @@ static int dm_blk_ioctl(struct block_dev if (!map || !dm_table_get_size(map)) goto out; - /* We only support devices that have a single target */ - if (dm_table_get_num_targets(map) != 1) - goto out; - - tgt = dm_table_get_target(map, 0); - if (dm_suspended(md)) { r = -EAGAIN; goto out; } - if (tgt->type->ioctl) - r = tgt->type->ioctl(tgt, cmd, arg); + if (cmd == BLKRRPART) { + /* Emulate Re-read partitions table */ + kobject_uevent(&disk_to_dev(md->disk)->kobj, KOBJ_CHANGE); + r = 0; + } else { + /* We only support devices that have a single target */ + if (dm_table_get_num_targets(map) != 1) + goto out; + + tgt = dm_table_get_target(map, 0); + + if (tgt->type->ioctl) + r = tgt->type->ioctl(tgt, cmd, arg); + } out: dm_table_put(map);