linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Qu Wenruo <wqu@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] btrfs: backref: Introduce the skeleton of btrfs_backref_iterator
Date: Fri, 14 Feb 2020 08:53:40 +0000	[thread overview]
Message-ID: <SN4PR0401MB3598D637DBFE9DC79FB1A4419B150@SN4PR0401MB3598.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200214081354.56605-2-wqu@suse.com

On 14/02/2020 09:14, Qu Wenruo wrote:
> Due to the complex nature of btrfs extent tree, when we want to iterate
> all backrefs of one extent, it involves quite a lot of works, like
                                                 Nit: work ^

> search the EXTENT_ITEM/METADATA_ITEM, iteration through inline and keyed
   ^ searching I think but a native English speaker might want to double 
check on that.

[...]

> The idea of btrfs_backref_iterator is to avoid such complex and hard to
> read code structure, but something like the following:
> 
>    iterator = btrfs_backref_iterator_alloc();
>    ret = btrfs_backref_iterator_start(iterator, bytenr);
>    if (ret < 0)
> 	goto out;
>    for (; ; ret = btrfs_backref_iterator_next(iterator)) {
> 	/* REAL WORK HERE */
>    }
>    out:
>    btrfs_backref_iterator_free(iterator);


I personally like for each style macros to wrap these a lot, but seeing 
the loop is only used once in your patchset I'm not sure it's worth 
adding it.

  reply	other threads:[~2020-02-14  8:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  8:13 [PATCH v2 0/3] Btrfs: relocation: Refactor build_backref_tree() using btrfs_backref_iterator infrastructure Qu Wenruo
2020-02-14  8:13 ` [PATCH v2 1/3] btrfs: backref: Introduce the skeleton of btrfs_backref_iterator Qu Wenruo
2020-02-14  8:53   ` Johannes Thumshirn [this message]
2020-02-14  9:19   ` Nikolay Borisov
2020-02-14  9:33     ` Qu Wenruo
2020-02-14  9:36       ` Nikolay Borisov
2020-02-14  9:24   ` Nikolay Borisov
2020-02-14  9:34     ` Qu Wenruo
2020-02-14  8:13 ` [PATCH v2 2/3] btrfs: backref: Implement btrfs_backref_iterator_next() Qu Wenruo
2020-02-14  9:25   ` Nikolay Borisov
2020-02-14  9:28     ` Nikolay Borisov
2020-02-14  9:35     ` Qu Wenruo
2020-02-14  8:13 ` [PATCH v2 3/3] btrfs: relocation: Use btrfs_backref_iterator infrastructure Qu Wenruo
2020-02-14  9:00   ` Johannes Thumshirn
2020-02-14  9:36     ` Qu Wenruo
2020-02-14  9:29   ` Nikolay Borisov

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=SN4PR0401MB3598D637DBFE9DC79FB1A4419B150@SN4PR0401MB3598.namprd04.prod.outlook.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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).