From patchwork Sat Oct 1 07:44:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9360089 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99EAE601C0 for ; Mon, 3 Oct 2016 07:13:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 830C2289A3 for ; Mon, 3 Oct 2016 07:13:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7735E289B3; Mon, 3 Oct 2016 07:13:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1080B289A3 for ; Mon, 3 Oct 2016 07:13:46 +0000 (UTC) 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 u937BFsw005870; Mon, 3 Oct 2016 03:11:15 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u917imog024452 for ; Sat, 1 Oct 2016 03:44:48 -0400 Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u917ilb1020092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 1 Oct 2016 03:44:47 -0400 Received: from mout.web.de (mout.web.de [217.72.192.78]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7AB78553D; Sat, 1 Oct 2016 07:44:46 +0000 (UTC) Received: from [192.168.1.3] ([92.228.150.161]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LilJB-1bDbIk0hen-00d0EJ; Sat, 01 Oct 2016 09:44:43 +0200 To: dm-devel@redhat.com, linux-raid@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Shaohua Li References: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net> From: SF Markus Elfring Message-ID: <18a48c67-962d-2e61-7d24-dc145ec90935@users.sourceforge.net> Date: Sat, 1 Oct 2016 09:44:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net> X-Provags-ID: V03:K0:ILJ0ZVF6w2nnF0ijFXRTNGfHHJznN7i3dxpZ6kyUvUdjPY1Zhjp M9STaR2eE6pktUxj5c1Wdptyaqqahb87BToVPx+hU13rpjvnNnKTPpAdcQllOwBJZQSfZYt /f5apdvPOu1P4WGGlp/6HAE0JJdyxRN1ontCHCbUnzN6kVf7C1PZ3MiZZeUvbFL64e23ItV AcYgt8F4ChGXTyUi6toGA== X-UI-Out-Filterresults: notjunk:1; V01:K0:UZM1uBO+9W0=:Irig1Ze4uNT4sDYOyTqKKV STCssuMz1uBWC77KVkZvaeEpN1Kt6s1f0K80pOed1Sl1YX4hLoAfPOyjTQUvZC4TIx4E1MR33 VbC+SnbR9onMu1SVbGrax0N4wmisd1btVumzLm13IuCuuZd/ayv1TO8g3PpEcAXu66Erd2n51 i0JXlA0Ln3eqIw5w//9LpsXhuZtvjpKDEYIPQ6iDQTy2uTntkKTSXLroRSBuPa/T8Z5gv2hiZ EzxXOLhL1503jwSsFw6RPU/evdio8HJuCX1lx6mV/Jcs8SefJ6kV9UVS/fE81ZHhJ4VJGmWni lAO000lZ5vOsoRdt8dZFo0hCzt8qs9K1psnLw87AOURgq++jASKpC1DcPLPA+lYl6WAe0KWCC mLa1cncBquGi85qnoh6auzZqaVaQrdyAd1hYhoFeQuDZNzrcIGFth2Dr9BKktRUkohr4ZffRd r92o9OJ3docXUmdvBqVWy15sKZGrwKmKWksann75WQHZj4z/rVy28U77EukqByxbKbB0ZhYPU EEi16esOhYmTZegK88D4MEsDhCmHQ+MF6P4hm4EqokQyOHW2dq5abPw5INEpVYe/Ejt53eUDz AFTTnQg/dIKK1iZuUtVMMSh72vnY//z1sEVJtl9Zhg3QiU2bG0PTzDzVSAbQQ97Cz3T77YeeF zUfNJGdqcQzmay0NYAUPkxg2QdXNZfOgJvZ8CAe4y3l0VGsDB1apiTVbZfzZ8DPR2AI3c88qc xt8zRd+FtRHa3uJmf+i/qms5mpX71/8Oy2fmqhlPnVH4N6jX5KSHtIl9LuqHdkazSz6D/Anyp 4NC/7Q6 X-Greylist: Sender IP whitelisted by DNSRBL, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 01 Oct 2016 07:44:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 01 Oct 2016 07:44:47 +0000 (UTC) for IP:'217.72.192.78' DOMAIN:'mout.web.de' HELO:'mout.web.de' FROM:'elfring@users.sourceforge.net' RCPT:'' X-RedHat-Spam-Score: 0.079 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 217.72.192.78 mout.web.de 217.72.192.78 mout.web.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 03 Oct 2016 03:10:51 -0400 Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Subject: [dm-devel] [PATCH 2/9] md/dm-table: Reduce the scope for a variable in dm_table_verify_integrity() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk 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-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 1 Oct 2016 07:10:43 +0200 Move the definition for the variable "template_disk" into an if branch so that an extra initialisation can be avoided at the beginning by this refactoring. Signed-off-by: Markus Elfring --- drivers/md/dm-table.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index f6b817c..73d38d0 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1391,14 +1391,13 @@ int dm_calculate_queue_limits(struct dm_table *table, */ static void dm_table_verify_integrity(struct dm_table *t) { - struct gendisk *template_disk = NULL; - if (t->integrity_supported) { /* * Verify that the original integrity profile * matches all the devices in this table. */ - template_disk = dm_table_get_integrity_disk(t); + struct gendisk *template_disk = dm_table_get_integrity_disk(t); + if (template_disk && blk_integrity_compare(dm_disk(t->md), template_disk) >= 0) return;