public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhaolei <zhaolei@cn.fujitsu.com>
To: sniper <s3c24xx@gmail.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH] btrfs: Simplify offset calculation method for ctree.h
Date: Fri, 18 Dec 2009 13:51:14 +0800	[thread overview]
Message-ID: <4B2B1852.6080105@cn.fujitsu.com> (raw)
In-Reply-To: <9bd6b5360912172039y432361fu243d0f05bf75b7b7@mail.gmail.com>

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;
>>  }



  reply	other threads:[~2009-12-18  5:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-18  1:30 [PATCH] btrfs: Simplify offset calculation method for ctree.h Zhaolei
2009-12-18  4:39 ` sniper
2009-12-18  5:51   ` Zhaolei [this message]
2009-12-18  6:59     ` sniper
2009-12-18 14:10     ` Chris Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B2B1852.6080105@cn.fujitsu.com \
    --to=zhaolei@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s3c24xx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox