[PATCH 02/18] btrfs: Calculate member variant's address directly for btrfs_##name
- Subject: [PATCH 02/18] btrfs: Calculate member variant's address directly for btrfs_##name
- From: Miao Xie <miaox@xxxxxxxxxxxxxx>
- Date: Thu, 25 Mar 2010 20:28:18 +0800
- Cc: Linux Btrfs <linux-btrfs@xxxxxxxxxxxxxxx>
- Reply-to: miaox@xxxxxxxxxxxxxx
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
From: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
It can decrease a additional address calculation and increase little speed.
Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
Signed-off-by: Miao Xie <miaox@xxxxxxxxxxxxxx>
---
fs/btrfs/struct-funcs.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
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; \
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux NFS]
[Linux NILFS]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]