All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/18] btrfs: Simplify btrfs_item_ptr macro
@ 2010-03-25 12:29 Miao Xie
  0 siblings, 0 replies; only message in thread
From: Miao Xie @ 2010-03-25 12:29 UTC (permalink / raw)
  To: Chris Mason; +Cc: Linux Btrfs

From: Zhao Lei <zhaolei@cn.fujitsu.com>

btrfs_item_ptr is just a type_cast wrapper of btrfs_item_ptr_offset().

We can use btrfs_item_ptr_offset() in btrfs_item_ptr() to avoid code
duplication.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/ctree.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 1111584..72228b2 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1947,13 +1947,11 @@ static inline u32 btrfs_level_size(struct btrfs_root *root, int level)
 }
 
 /* helper function to cast into the data area of the leaf. */
-#define btrfs_item_ptr(leaf, slot, type) \
-	((type *)(btrfs_leaf_data(leaf) + \
-	btrfs_item_offset_nr(leaf, slot)))
-
 #define btrfs_item_ptr_offset(leaf, slot) \
 	((unsigned long)(btrfs_leaf_data(leaf) + \
 	btrfs_item_offset_nr(leaf, slot)))
+#define btrfs_item_ptr(leaf, slot, type) \
+	((type *)btrfs_item_ptr_offset(leaf, slot))
 
 static inline struct dentry *fdentry(struct file *file)
 {
-- 
1.6.5.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-25 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 12:29 [PATCH 04/18] btrfs: Simplify btrfs_item_ptr macro Miao Xie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.