linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Noah Massey <noah.massey@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] btrfs-progs: read_tree_block() and read_node_slot() cleanup.
Date: Wed, 28 Jan 2015 10:07:30 +0800	[thread overview]
Message-ID: <54C84462.1030408@cn.fujitsu.com> (raw)
In-Reply-To: <CADfjVrgL1XcV9=4hhGzhK5cB-sFWmMG5OUwjXZOuNnrzvauaiw@mail.gmail.com>


-------- Original Message --------
Subject: Re: [PATCH 1/2] btrfs-progs: read_tree_block() and 
read_node_slot() cleanup.
From: Noah Massey <noah.massey@gmail.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Date: 2015年01月28日 00:48
> On Mon, Jan 26, 2015 at 10:12 PM, Qu Wenruo <quwenruo@cn.fujitsu.com> wrote:
>> Allow read_tree_block() and read_node_slot() to return error pointer.
>> This should help caller to get more specified error number.
>>
>> For existing callers, change (!eb) judgmentt to
>> (!extent_buffer_uptodate(eb)) to keep the compatibility, and for caller
>> missing the check, use PTR_ERR(eb) if possible.
>>
>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>> [...snipped...]
>> @@ -2962,6 +2962,12 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
>>                          next = read_tree_block(root, bytenr, blocksize,
>>                                                 ptr_gen);
>>                          mutex_lock(&root->fs_info->fs_mutex);
>> +                       if (!extent_buffer_uptodate(next)) {
>> +                               if (IS_ERR(next))
>> +                                       ret = PTR_ERR(next);
> + else
Oh, my fault.
Thanks for pointing it out.

Thanks,
Qu
>
>
>> +                               ret = -EIO;
>> +                               break;
>> +                       }
>>                  }
>>                  WARN_ON(*level <= 0);
>>                  if (path->nodes[*level-1])
>> diff --git a/extent_io.c b/extent_io.c
>> index 9c982f9..3a8f96b 100644
>> --- a/extent_io.c
>> +++ b/extent_io.c
>> @@ -845,9 +845,8 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
>>
>>   int extent_buffer_uptodate(struct extent_buffer *eb)
>>   {
>> -       if (!eb)
>> +       if (!eb || IS_ERR(eb))
>>                  return 0;
>> -
>>          if (eb->flags & EXTENT_UPTODATE)
>>                  return 1;
>>          return 0;
>> diff --git a/print-tree.c b/print-tree.c
>> index 70a7acc..3a7c13c 100644
>> --- a/print-tree.c
>> +++ b/print-tree.c
>> @@ -1060,7 +1060,7 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *eb, int fol
>>                                               btrfs_node_blockptr(eb, i),
>>                                               size,
>>                                               btrfs_node_ptr_generation(eb, i));
>> -               if (!next) {
>> +               if (!extent_buffer_uptodate(next)) {
>>                          fprintf(stderr, "failed to read %llu in tree %llu\n",
>>                                  (unsigned long long)btrfs_node_blockptr(eb, i),
>>                                  (unsigned long long)btrfs_header_owner(eb));
>> diff --git a/qgroup-verify.c b/qgroup-verify.c
>> index c98c751..f7a94bf 100644
>> --- a/qgroup-verify.c
>> +++ b/qgroup-verify.c
>> @@ -513,7 +513,7 @@ static int travel_tree(struct btrfs_fs_info *info, struct btrfs_root *root,
>>   //            bytenr, num_bytes, ref_parent);
>>
>>          eb = read_tree_block(root, bytenr, num_bytes, 0);
>> -       if (!eb)
>> +       if (!extent_buffer_uptodate(eb))
>>                  return -EIO;
>>
>>          ret = 0;
>> --
>> 2.2.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2015-01-28  2:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27  3:12 [PATCH 1/2] btrfs-progs: read_tree_block() and read_node_slot() cleanup Qu Wenruo
2015-01-27  3:12 ` [PATCH 2/2] btrfs-progs: Move (set/clear_)extent_buffer_uptodate() to extent_io.h Qu Wenruo
2015-02-27 16:45   ` David Sterba
2015-01-27 16:48 ` [PATCH 1/2] btrfs-progs: read_tree_block() and read_node_slot() cleanup Noah Massey
2015-01-28  2:07   ` Qu Wenruo [this message]

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=54C84462.1030408@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=noah.massey@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;
as well as URLs for NNTP newsgroup(s).