From patchwork Thu Mar 31 09:45:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liubo X-Patchwork-Id: 678781 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2V9sSal018834 for ; Thu, 31 Mar 2011 09:54:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756413Ab1CaJyY (ORCPT ); Thu, 31 Mar 2011 05:54:24 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:60244 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754251Ab1CaJyY (ORCPT ); Thu, 31 Mar 2011 05:54:24 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 5801F170118 for ; Thu, 31 Mar 2011 17:54:21 +0800 (CST) Received: from mailserver.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p2V9m8DU005277 for ; Thu, 31 Mar 2011 17:48:08 +0800 Received: from localhost.localdomain ([10.167.225.27]) by mailserver.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011033117402175-160147 ; Thu, 31 Mar 2011 17:40:21 +0800 Message-ID: <4D944D30.4050900@cn.fujitsu.com> Date: Thu, 31 Mar 2011 17:45:20 +0800 From: liubo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: Linux Btrfs Subject: [PATCH] Btrfs: fix compile warning from __btrfs_map_block References: <4D944235.7020408@cn.fujitsu.com> In-Reply-To: <4D944235.7020408@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-03-31 17:40:21, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-03-31 17:52:49, Serialize complete at 2011-03-31 17:52:49 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 31 Mar 2011 09:54:28 +0000 (UTC) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 41afd50..7b23d0f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3076,16 +3076,19 @@ again: multi->stripes[i].dev = map->stripes[stripe_index].dev; if (map->type & BTRFS_BLOCK_GROUP_RAID0) { - u64 stripes; - int last_stripe = (stripe_nr_end - 1) % - map->num_stripes; + u64 stripes = stripe_nr_end - 1; + int last_stripe = do_div(stripes, + map->num_stripes); int j; for (j = 0; j < map->num_stripes; j++) { - if ((stripe_nr_end - 1 - j) % - map->num_stripes == stripe_index) + stripes = stripe_nr_end - 1 - j; + + if (do_div(stripes, map->num_stripes) == + stripe_index) break; } + stripes = stripe_nr_end - 1 - j; do_div(stripes, map->num_stripes); multi->stripes[i].length = map->stripe_len * @@ -3100,18 +3103,22 @@ again: multi->stripes[i].length -= stripe_end_offset; } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) { - u64 stripes; + u64 stripes = stripe_nr_end - 1; int j; int factor = map->num_stripes / map->sub_stripes; - int last_stripe = (stripe_nr_end - 1) % factor; + int last_stripe = do_div(stripes, factor); + last_stripe *= map->sub_stripes; for (j = 0; j < factor; j++) { - if ((stripe_nr_end - 1 - j) % factor == + stripes = stripe_nr_end - 1 - j; + + if (do_div(stripes, factor) == stripe_index / map->sub_stripes) break; } + stripes = stripe_nr_end - 1 - j; do_div(stripes, factor); multi->stripes[i].length = map->stripe_len *