[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9bd6b5360912172039y432361fu243d0f05bf75b7b7@mail.gmail.com>
Date: Fri, 18 Dec 2009 12:39:50 +0800
From: sniper <s3c24xx@...il.com>
To: Zhaolei <zhaolei@...fujitsu.com>
Cc: "linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] btrfs: Simplify offset calculation method for ctree.h
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
> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists