From patchwork Thu Jun 23 13:30:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9195141 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 E44C4608A7 for ; Thu, 23 Jun 2016 13:29:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4DDD28456 for ; Thu, 23 Jun 2016 13:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C31112845B; Thu, 23 Jun 2016 13:29:58 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C88B28457 for ; Thu, 23 Jun 2016 13:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbcFWN3b (ORCPT ); Thu, 23 Jun 2016 09:29:31 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:61937 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752268AbcFWN33 (ORCPT ); Thu, 23 Jun 2016 09:29:29 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0MeMIx-1b0uNJ1g35-00QALY; Thu, 23 Jun 2016 15:28:10 +0200 From: Arnd Bergmann To: Jens Axboe Cc: "Nicholas A . Bellinger" , Mike Christie , Andy Grover , Hannes Reinecke , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Davidlohr Bueso , linux-efi@vger.kernel.org, linux-block@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 2/3] partition/efi: use bdev_logical_block_count() Date: Thu, 23 Jun 2016 15:30:15 +0200 Message-Id: <20160623133016.3781907-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160623133016.3781907-1-arnd@arndb.de> References: <20160623133016.3781907-1-arnd@arndb.de> X-Provags-ID: V03:K0:T8tsdDkpHXjp+ft+It1HdnqELWUC/L6jTUHxMLBkuxskNUiHyfU l0t05XZvPAbXI3a9/SiJTPByAMbP1AyX5os3MDjIb6SiY0nS1uhZwu/vGHZGWhOmdYmTCDY fvjWtZkODmwp11VCPMjfLnMuPTjwUR5Gy8NgDX/9VU/achULb+1LguUX3xhKM/nkfKl7BdO TrSGxq4d+SevsuZRr9qvw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Kt03CZKSCMU=:5e8BAjnR4SmvYMWM9+JEeZ miwgOCa2pE4TuHjIl9w++X0PvPOd4yNr2eDELsSAJO+WzgQt2vIXKeCMCKkDIyQt2c2Gks+T1 GhXhxHtmablKIqaLeYNmAJDztyLxwibzl5O7VFJKnMM8yD77gkwo7H+oORtSVy0XXLXC4fYJR sESBKS9mHWzJ7+/Kouqq/Mv9NK1xuxGxtPiwtsPL29wQ+Xhi+3bePyX3Rg0vk4iKpFTctvtAK xSPM/hZEFkR8YL8A3eG7KoSVNofBE7qtvHA/GxcWe4wPumTeR/VFE0PdwjS5QK1j7485XlLc9 XJokREuXAxe1kfApD99yTbTOBop8UDnqmEAnQMCGCebKegeET4LC3WWqjRpI7c2Jf1G/gd+dN h43JZoB8YWCLJVpZwqL8T0EUpjfASIpAq+G3HZTepTqwUqViQEpaCuoxguUIGSL5lJRut+OD7 UoXRrTVaukvRH7vLzWrfq1Pl9HNg/OsxhisBYuNH0xwY6Z95GwEOnvnlfKVijd5UFkYrxfQwM 2h+8bQNGYLy08Q+AVTAKq5+RcVP0oj148Yvh9LgRAZmOP5a1CqjaShTDcP5Foq5nyGdF0/ODL QeVoNFkArSAFG9jYS9HI77YluG5Lbjjiejk3tZ7oPD/gVJO901e7OoNVdIzdZ3J6LzJ7wYTOL UrgtM0yDBSuZthXOVJuPmu98MX/QgmBps/rMfFWX/QxLkJZWOUpsf50z9QfI2QBb+Gpg= Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enabling CONFIG_UBSAN_SANITIZE_ALL on ARM caused a link error: last_lba.part.0': :(.text+0xc3440): undefined reference to `____ilog2_NaN' :(.text+0xc3538): undefined reference to `__aeabi_uldivmod' :(.text+0xc38e8): undefined reference to `__aeabi_uldivmod' This is caused by gcc not behaving in the expected ways with __builtin_constant_p(), but it also points to somewhat inefficient code based on a 64-bit division. I have introduced a better bdev_logical_block_count() now, so we can use that here. Signed-off-by: Arnd Bergmann --- block/partitions/efi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/partitions/efi.c b/block/partitions/efi.c index bcd86e5cd546..7b1a62073d34 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c @@ -149,8 +149,8 @@ static u64 last_lba(struct block_device *bdev) { if (!bdev || !bdev->bd_inode) return 0; - return div_u64(bdev->bd_inode->i_size, - bdev_logical_block_size(bdev)) - 1ULL; + + return bdev_logical_block_count(bdev) - 1; } static inline int pmbr_part_valid(gpt_mbr_record *part)