From patchwork Tue Mar 11 08:31:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 3809591 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78F0B9F369 for ; Tue, 11 Mar 2014 08:36:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8A16201F0 for ; Tue, 11 Mar 2014 08:36:31 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id D64A9201B6 for ; Tue, 11 Mar 2014 08:36:30 +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 s2B8Vf3Z003146; Tue, 11 Mar 2014 04:31:42 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s2B8Ve0f021165 for ; Tue, 11 Mar 2014 04:31:40 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s2B8VeXG031535; Tue, 11 Mar 2014 04:31:40 -0400 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.130]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2B8Vdc4002747; Tue, 11 Mar 2014 04:31:39 -0400 Received: from wuerfel.localnet (HSI-KBW-134-3-135-108.hsi14.kabel-badenwuerttemberg.de [134.3.135.108]) by mrelayeu.kundenserver.de (node=mreue004) with ESMTP (Nemesis) id 0MOVOL-1WI5R50NiH-005nob; Tue, 11 Mar 2014 09:31:34 +0100 From: Arnd Bergmann To: Mike Snitzer Date: Tue, 11 Mar 2014 09:31:33 +0100 Message-ID: <3014967.i7OXqBNQ5E@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.11.0-18-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V02:K0:BRnHBFzfnWqyniqmYnKKDCi2LHPStSTJJIPs5OqV5q3 6U3Zd7ESTPDqXbbcHVWaya2o/DQN3DZGYMh9n6Bm5vte8hFfVG u3Os1HwTsPNRXMQ0aoY9HnxewV1xNqQZJFafPx3qwIg/3aWgVa A0Puea1EvS2x5qrupWr5SSLH+8xxF4fWH7+PPb68KtGAu2TJVs XpXlfeRByXkBkLWcKolgTUjWsAf/HLOinirCPdXqHu/d6LeUMD Jk0kk2fNYbD83+zcQaTwvps0BtjOIMQTl5ug8HATRGInz7lv5/ jnUxynqN9oQIl/CKkl+Nzo8V9mmUgIboCY8u9Br1e6E4HDzBwr 6/x3xr/q5GGx9K/r6utw= X-RedHat-Spam-Score: -1.911 (BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Joe Thornber , Alasdair Kergon , linux-kernel@vger.kernel.org Subject: [dm-devel] [PATCH] dm: era: use do_div for 64-bit division 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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 983043be0c1de "dm era: support non power-of-2 blocksize" introduced the use of sector_div to divide a variable of type dm_block_t by an integer. This fails on 32-bit machines when CONFIG_LBDAF is not set, because that assumes that the first argument is a 32-bit number. To allow building this driver in all configurations, we either have to cast the dm_block_t to sector_t or use do_div(), which always takes a 64-bit argument. This patch uses the second approach in order to cope with theoretical configurations where dm_block_t contains a number that does not fit into sector_t. Signed-off-by: Arnd Bergmann Cc: Mike Snitzer Cc: Joe Thornber Cc: Alasdair Kergon Cc: dm-devel@redhat.com --- This currently only occurs in linux-next. Please apply. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c index d7bd7b3..3383423 100644 --- a/drivers/md/dm-era-target.c +++ b/drivers/md/dm-era-target.c @@ -1123,7 +1123,7 @@ static dm_block_t get_block(struct era *era, struct bio *bio) dm_block_t block_nr = bio->bi_iter.bi_sector; if (!block_size_is_power_of_two(era)) - (void) sector_div(block_nr, era->sectors_per_block); + (void) do_div(block_nr, era->sectors_per_block); else block_nr >>= era->sectors_per_block_shift;