Thank you Jan, Hugo & Lio, for taking time answering my questions. Alex. P.S.: I have dug in some more, so probably more questions will arrive:)
On Tue, May 29, 2012 at 12:13 PM, Jan Schmidt <[email protected]> wrote: > On Mon, May 28, 2012 at 20:45 (+0200), Alex Lyakas wrote: >> I have re-looked at btrfs_search_slot, and don't see how it would end >> up in leaf B. The bin_search() function will clearly return the slot >> *after* the slot of N that has key==5 (which is the parent slot of A). >> So then the following code: >> if (level != 0) { >> int dec = 0; >> if (ret && slot > 0) { >> dec = 1; >> slot -= 1; >> } >> will bring us back into the slot of N with key=5. And we will go to >> leaf A. While if key(N) of that slot was 10, we would never have ended >> up in that slot, unless there is no lesser key in the tree. > > Yes, that's right. As already said in my previous mail (in the paragraph > you didn't quote), the key in the leaf must be an exact match. The key > in N pointing to A will be 10. > >> Actually, it looks like "no lesser key" is the only case when we can >> get ret==1 and slot==0. > > Correct. > >> Except perhaps an empty leaf, which I am not sure can happen. > > It can't. > > -Jan -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
