From patchwork Fri Sep 19 17:30:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 4939091 Return-Path: X-Original-To: patchwork-linux-nfs@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 07EAC9F2EC for ; Fri, 19 Sep 2014 17:31:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 927F420121 for ; Fri, 19 Sep 2014 17:31:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45FCC2010E for ; Fri, 19 Sep 2014 17:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757661AbaISRbB (ORCPT ); Fri, 19 Sep 2014 13:31:01 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.226]:61215 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757349AbaISRas (ORCPT ); Fri, 19 Sep 2014 13:30:48 -0400 Received: from [67.246.153.56] ([67.246.153.56:51148] helo=gandalf.local.home) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 9D/D3-17817-6486C145; Fri, 19 Sep 2014 17:30:46 +0000 Date: Fri, 19 Sep 2014 13:30:46 -0400 From: Steven Rostedt To: LKML , linux-nfs@vger.kernel.org Cc: Trond Myklebust , Christoph Hellwig Subject: [PATCH][linux-next] pnfs/blocklayout: Use do_div for 64 bit divide operations Message-ID: <20140919133046.7d5ad943@gandalf.local.home> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.24; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 5c83746a0cf2 "pnfs/blocklayout: in-kernel GETDEVICEINFO XDR parsing" added some open coded 64 bit divisions which caused the following error on 32 bit builds: fs/built-in.o: In function `bl_map_stripe': fs/nfs/blocklayout/dev.c:153: undefined reference to `__udivdi3' fs/nfs/blocklayout/dev.c:154: undefined reference to `__umoddi3' fs/nfs/blocklayout/dev.c:168: undefined reference to `__udivdi3' Signed-off-by: Steven Rostedt --- fs/nfs/blocklayout/dev.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c index 00f159da06ee..05d32e2175db 100644 --- a/fs/nfs/blocklayout/dev.c +++ b/fs/nfs/blocklayout/dev.c @@ -150,10 +150,18 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset, struct pnfs_block_dev_map *map) { struct pnfs_block_dev *child; - u64 chunk = (offset / dev->chunk_size); - int chunk_idx = chunk % dev->nr_children; + u64 chunk; + u64 chunk_tmp; + int chunk_idx; u64 disk_offset; + chunk = offset; + /* chunk = offset / dev->chunk_size */ + do_div(chunk, dev->chunk_size); + chunk_tmp = chunk; + /* chunk_idx = chunk % dev->nr_children) */ + chunk_idx = do_div(chunk_tmp, dev->nr_children); + if (chunk_idx > dev->nr_children) { dprintk("%s: invalid chunk idx %d (%lld/%lld)\n", __func__, chunk_idx, offset, dev->chunk_size); @@ -165,7 +173,9 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset, offset = chunk * dev->chunk_size; /* disk offset of the stripe */ - disk_offset = offset / dev->nr_children; + disk_offset = offset; + /* disk_offset = offset / dev->nr_children */ + do_div(disk_offset, dev->nr_children); child = &dev->children[chunk_idx]; child->map(child, disk_offset, map);