Re: [PATCH] btrfs: Simplify offset calculation method for ctree.h

From: sniper
Date: Thu Dec 17 2009 - 23:40:01 EST

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

> Â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;
> Â}
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at