Re: [PATCH v2 1/3] btrfs: backref: Introduce the skeleton of btrfs_backref_iterator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux