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

2013-08-31 Thread Miao Xie
On fri, 30 Aug 2013 15:46:43 +0100, Filipe David Borba Manana wrote: When the binary search returns 0 (exact match), the target key will necessarily be at slot 0 of all nodes below the current one, so in this case the binary search is not needed because it will always return 0, and we

[PATCH v5] Btrfs: optimize key searches in btrfs_search_slot

2013-08-30 Thread Filipe David Borba Manana
When the binary search returns 0 (exact match), the target key will necessarily be at slot 0 of all nodes below the current one, so in this case the binary search is not needed because it will always return 0, and we waste time doing it, holding node locks for longer than necessary, etc. Below