From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <mwilck@arcor.de>, <linux-btrfs@vger.kernel.org>
Cc: David Sterba <dsterba@suse.cz>
Subject: Re: [PATCH 05/18] btrfs-progs: ctree.h: fix btrfs_inode_[amc]time
Date: Thu, 11 Dec 2014 16:16:13 +0800 [thread overview]
Message-ID: <548952CD.9000804@cn.fujitsu.com> (raw)
In-Reply-To: <54894EF2.4070808@cn.fujitsu.com>
-------- Original Message --------
Subject: Re: [PATCH 05/18] btrfs-progs: ctree.h: fix btrfs_inode_[amc]time
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: mwilck@arcor.de, linux-btrfs@vger.kernel.org
Date: 2014年12月11日 15:59
>
> -------- Original Message --------
> Subject: [PATCH 05/18] btrfs-progs: ctree.h: fix btrfs_inode_[amc]time
> From: <mwilck@arcor.de>
> To: <linux-btrfs@vger.kernel.org>
> Date: 2014年12月11日 04:51
>> From: Martin Wilck <mwilck@arcor.de>
>>
>> make btrfs_inode_[amc]time work like the other btrfs_inode_xxx
>> functions. The current definition appears broken to me; it never
>> returns valid pointer unless an extent buffer address is added.
> The original method returns the ptr in the way just like
> btrfs_item_ptr(), which you should call
> read_extent_buffer() to read them into a struct of btrfs_timespec.
> That's the same in kernel codes.
>
> If just want to read the timespec, you could try
> btrfs_stack_timespec_[n]spec() marco.
Oh, sorry, for your case, it is btrfs_timespec_[n]spec() marcro, not the
stack ones.
And that one uses the timespec returned by btrfs_inode_[amc]time() marcor.
Thanks,
Qu
>
> Thanks,
> Qu
>> Signed-off-by: Martin Wilck <mwilck@arcor.de>
>> ---
>> ctree.h | 15 +++++++++------
>> 1 files changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/ctree.h b/ctree.h
>> index 89036de..1d5a5fc 100644
>> --- a/ctree.h
>> +++ b/ctree.h
>> @@ -1414,27 +1414,30 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_flags,
>> struct btrfs_inode_item, flags, 64);
>> static inline struct btrfs_timespec *
>> -btrfs_inode_atime(struct btrfs_inode_item *inode_item)
>> +btrfs_inode_atime(struct extent_buffer *eb,
>> + struct btrfs_inode_item *inode_item)
>> {
>> unsigned long ptr = (unsigned long)inode_item;
>> ptr += offsetof(struct btrfs_inode_item, atime);
>> - return (struct btrfs_timespec *)ptr;
>> + return (struct btrfs_timespec *)(ptr + eb->data);
>> }
>> static inline struct btrfs_timespec *
>> -btrfs_inode_mtime(struct btrfs_inode_item *inode_item)
>> +btrfs_inode_mtime(struct extent_buffer *eb,
>> + 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 (struct btrfs_timespec *)(ptr + eb->data);
>> }
>> static inline struct btrfs_timespec *
>> -btrfs_inode_ctime(struct btrfs_inode_item *inode_item)
>> +btrfs_inode_ctime(struct extent_buffer *eb,
>> + struct btrfs_inode_item *inode_item)
>> {
>> unsigned long ptr = (unsigned long)inode_item;
>> ptr += offsetof(struct btrfs_inode_item, ctime);
>> - return (struct btrfs_timespec *)ptr;
>> + return (struct btrfs_timespec *)(ptr + eb->data);
>> }
>> static inline struct btrfs_timespec *
>
next prev parent reply other threads:[~2014-12-11 8:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 20:51 [PATCH 00/18] Patch series related to my btrfs recovery mwilck
2014-12-10 20:51 ` [PATCH 01/18] btrfs-progs: btrfs-debug-tree: add option -f for "block only" mwilck
2014-12-11 7:42 ` Qu Wenruo
2014-12-10 20:51 ` [PATCH 02/18] btrfs-progs: btrfs-debug-tree: add option -B (backup root) mwilck
2014-12-10 20:51 ` [PATCH 03/18] btrfs-progs: btrfs-debug-tree: fix usage message mwilck
2014-12-10 20:51 ` [PATCH 04/18] btrfs-progs: btrfs-debug-tree: handle corruption more gracefully mwilck
2014-12-10 20:51 ` [PATCH 05/18] btrfs-progs: ctree.h: fix btrfs_inode_[amc]time mwilck
2014-12-11 7:59 ` Qu Wenruo
2014-12-11 8:16 ` Qu Wenruo [this message]
2014-12-10 20:51 ` [PATCH 06/18] btrfs restore: set uid/gid/mode/times mwilck
2014-12-10 20:51 ` [PATCH 07/18] btrfs restore: better output readability mwilck
2014-12-10 20:51 ` [PATCH 08/18] btrfs restore: track number of bytes restored mwilck
2014-12-10 20:51 ` [PATCH 09/18] btrfs restore: more graceful error handling in copy_file mwilck
2014-12-11 8:37 ` Qu Wenruo
2014-12-10 20:51 ` [PATCH 10/18] btrfs restore: hide "offset is X" messages mwilck
2014-12-10 20:51 ` [PATCH 11/18] btrfs restore: print progress marks for big files mwilck
2014-12-10 20:51 ` [PATCH 12/18] btrfs restore: check progress of file restoration mwilck
2014-12-11 8:44 ` Qu Wenruo
2014-12-10 20:51 ` [PATCH 13/18] btrfs restore: improve user-asking logic for files with many extents mwilck
2014-12-10 20:51 ` [PATCH 14/18] btrfs restore: report mismatch in file size mwilck
2014-12-10 20:51 ` [PATCH 15/18] btrfs-progs: NEW: btrfs-raw mwilck
2014-12-10 20:51 ` [PATCH 16/18] btrfs-progs: NEW: brtfs-search-metadata mwilck
2014-12-10 20:51 ` [PATCH 17/18] btrfs-progs: ctree.c: make bin_search non-static mwilck
2014-12-10 20:51 ` [PATCH 18/18] btrfs-progs: documentation for btrfs-raw and btrfs-search-metadata mwilck
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=548952CD.9000804@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=mwilck@arcor.de \
/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;
as well as URLs for NNTP newsgroup(s).