Re: [PATCH v7] Btrfs: optimize key searches in btrfs_search_slot

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

 



On Mon, Sep 2, 2013 at 2:39 PM, David Sterba <dsterba@xxxxxxx> wrote:
> On Sun, Sep 01, 2013 at 11:39:28AM +0100, Filipe David Borba Manana wrote:
>> +#ifdef CONFIG_BTRFS_ASSERT
>> +static int key_search_validate(struct extent_buffer *b,
>> +                            struct btrfs_key *key,
>> +                            int level)
>> +{
> ...
>> +}
>> +#endif
>> +
>> +static int key_search(struct extent_buffer *b, struct btrfs_key *key,
>> +                   int level, int *prev_cmp, int *slot)
>> +{
>> +     if (*prev_cmp != 0) {
>> +             *prev_cmp = bin_search(b, key, level, slot);
>> +             return *prev_cmp;
>> +     }
>> +
>> +     ASSERT(key_search_validate(b, key, level));
>
> But what if I want to use key_search_validate out of the context of an
> ASSERT ?

Right. But right now nothing else uses it. Shall the need for it come,
it's trivial to address.

> I don't see a reason why the function needs to be under #ifdef
> BTRFS_ASSERT / #endif at all.

To avoid the compiler warning, as mentioned before.

Between patch versions v5 to v7, I don't have any strong preference.
All have correct, small and simple code.

>
>> +     *slot = 0;
>> +
>> +     return 0;
>> +}



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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