From patchwork Mon Feb 1 04:24:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiyoshi Ueda X-Patchwork-Id: 76029 X-Patchwork-Delegate: agk@redhat.com Received: from mx01.util.phx2.redhat.com (mx1-phx2.redhat.com [209.132.183.26]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o114QsJ3011801 for ; Mon, 1 Feb 2010 04:27:29 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.util.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o114P7PF021274; Sun, 31 Jan 2010 23:25:07 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o114P5Bk004573 for ; Sun, 31 Jan 2010 23:25:05 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.6]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o114P0Fv031943; Sun, 31 Jan 2010 23:25:00 -0500 Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o114OiXD005421; Sun, 31 Jan 2010 23:24:45 -0500 Received: from mailgate4.nec.co.jp ([10.7.69.184]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id o114Oie6017611; Mon, 1 Feb 2010 13:24:44 +0900 (JST) Received: (from root@localhost) by mailgate4.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id o114OiF13765; Mon, 1 Feb 2010 13:24:44 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id o114OhDw024946; Mon, 1 Feb 2010 13:24:43 +0900 (JST) Received: from yonosuke.jp.nec.com ([10.26.220.15] [10.26.220.15]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-252591; Mon, 1 Feb 2010 13:24:08 +0900 Received: from elcondor.linux.bs1.fc.nec.co.jp ([10.34.125.195] [10.34.125.195]) by mail.jp.nec.com with ESMTP; Mon, 1 Feb 2010 13:24:08 +0900 Message-ID: <4B665768.40307@ct.jp.nec.com> Date: Mon, 01 Feb 2010 13:24:08 +0900 From: Kiyoshi Ueda User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: device-mapper development , Alasdair Kergon References: <4B665507.8080205@ct.jp.nec.com> In-Reply-To: <4B665507.8080205@ct.jp.nec.com> X-RedHat-Spam-Score: 0 () X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.6 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 4/4] dm-mpath: move initial pg-init kick into __switch_pg() 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: , 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 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 04:27:30 +0000 (UTC) Index: 2.6.33-rc6/drivers/md/dm-mpath.c =================================================================== --- 2.6.33-rc6.orig/drivers/md/dm-mpath.c +++ 2.6.33-rc6/drivers/md/dm-mpath.c @@ -256,14 +256,22 @@ static void __switch_pg(struct multipath /* Must we initialise the PG first, and queue I/O till it's ready? */ if (m->hw_handler_name) { - m->pg_init_required = 1; m->queue_io = 1; + + /* Reset pg_init_count in 0 anyway to start a new pg-init */ + m->pg_init_count = 0; + if (!m->pg_init_in_progress) + __pg_init(m); + else + /* + * Mark to start a pg-init again when the current one + * completes. + */ + m->pg_init_required = 1; } else { m->pg_init_required = 0; m->queue_io = 0; } - - m->pg_init_count = 0; } static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg, @@ -365,9 +373,7 @@ static int map_io(struct multipath *m, s /* Queue for the daemon to resubmit */ list_add_tail(&clone->queuelist, &m->queued_ios); m->queue_size++; - if (m->pg_init_required && !m->pg_init_in_progress && pgpath) - __pg_init(m); - else if (!m->queue_io) + if (!m->queue_io) queue_work(kmultipathd, &m->process_queued_ios); pgpath = NULL; r = DM_MAPIO_SUBMITTED; @@ -473,9 +479,6 @@ static void process_queued_ios(struct wo (!pgpath && !m->queue_if_no_path)) must_queue = 0; - if (m->pg_init_required && !m->pg_init_in_progress && pgpath) - __pg_init(m); - out: spin_unlock_irqrestore(&m->lock, flags); if (!must_queue)