Messages in this thread | | | Date | Fri, 18 Dec 2009 13:51:14 +0800 | From | Zhaolei <> | Subject | Re: Re: [PATCH] btrfs: Simplify offset calculation method for ctree.h |
| |
sniper wrote: > No, many pointers in btrfs function arguments are not pointing to an > absolute address, but relative to the start address of extent. > Take following function as example, argument inode_item is an offset > value to the beginning of leaf. So we can't reach its member with > &inode_item->xxx
Notice that we are not reach its member, we are getting pointer of its member with &inode_item->mtime. This operation have same effect as old one.
Thanks Zhaolei
> >> static inline struct btrfs_timespec * >> btrfs_inode_mtime(struct btrfs_inode_item *inode_item) >> { >> - unsigned long ptr = (unsigned long)inode_item; >> - ptr += offsetof(struct btrfs_inode_item, mtime); >> - return (struct btrfs_timespec *)ptr; >> + return &inode_item->mtime; >> }
| |