From patchwork Thu Mar 25 12:28:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 88207 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2PCS6ba028446 for ; Thu, 25 Mar 2010 12:28:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751664Ab0CYM2F (ORCPT ); Thu, 25 Mar 2010 08:28:05 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:57372 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751983Ab0CYM2E (ORCPT ); Thu, 25 Mar 2010 08:28:04 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 37E89170080; Thu, 25 Mar 2010 20:28:02 +0800 (CST) Received: from 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 o2PCQhuI005888; Thu, 25 Mar 2010 20:26:43 +0800 Received: from [127.0.0.1] (unknown [10.167.141.211]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 7F024DC220; Thu, 25 Mar 2010 20:30:28 +0800 (CST) Message-ID: <4BAB56E2.6050809@cn.fujitsu.com> Date: Thu, 25 Mar 2010 20:28:18 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Chris Mason CC: Linux Btrfs Subject: [PATCH 02/18] btrfs: Calculate member variant's address directly for btrfs_##name 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 25 Mar 2010 12:28:06 +0000 (UTC) diff --git a/fs/btrfs/struct-funcs.c b/fs/btrfs/struct-funcs.c index c0f7eca..b0f80c0 100644 --- a/fs/btrfs/struct-funcs.c +++ b/fs/btrfs/struct-funcs.c @@ -49,13 +49,13 @@ u##bits btrfs_##name(struct extent_buffer *eb, \ { \ unsigned long part_offset = (unsigned long)s; \ unsigned long offset = part_offset + offsetof(type, member); \ - type *p; \ + u##bits *p; \ /* ugly, but we want the fast path here */ \ if (eb->map_token && offset >= eb->map_start && \ offset + sizeof(((type *)0)->member) <= eb->map_start + \ eb->map_len) { \ - p = (type *)(eb->kaddr + part_offset - eb->map_start); \ - return le##bits##_to_cpu(p->member); \ + p = (u##bits *)(eb->kaddr + offset - eb->map_start); \ + return le##bits##_to_cpu(*p); \ } \ { \ int err; \ @@ -74,8 +74,8 @@ u##bits btrfs_##name(struct extent_buffer *eb, \ read_eb_member(eb, s, type, member, &leres); \ return le##bits##_to_cpu(leres); \ } \ - p = (type *)(kaddr + part_offset - map_start); \ - res = le##bits##_to_cpu(p->member); \ + p = (u##bits *)(kaddr + offset - map_start); \ + res = le##bits##_to_cpu(*p); \ if (unmap_on_exit) \ unmap_extent_buffer(eb, map_token, KM_USER1); \ return res; \