[Ocfs2-tools-devel] [PATCH 2/2] Modify the check in io_cache_disconnect.

Joel Becker Joel.Becker at oracle.com
Mon Oct 22 19:45:13 PDT 2007


On Mon, Oct 22, 2007 at 09:51:07AM +0800, tao.ma wrote:
> I have seen this happen in practice when I try to use it to speed up the 
> extent block iteration. ;)

	I'd like to reproduce it here.

> As for RB_ROOT, if you look at the definition of RB_ROOT and the how we use 
> rb_link_node, you will get that we will use ic->ic_lookup->rb_node as the 
> real rb-root which can be NULL during the insertion, not ic->ic_lookup.

	ic->ic_lookup->rb_node *is* RB_ROOT.  RB_ROOT is just a
structure containing a struct rb_node.
	An icb is a larger structure containing an rb_node.  If our
lookup functions ever return RB_ROOT instead of an icb, we have a
problem.  All icbs should be children of RB_ROOT somehow.

> In rb_erase, you can see that the code already handle the condition when 
> the removed entry's rb_parent is NULL.

	Hmm.  I can't quite figure out how that ever happens.  It's a
tree, nodes need parents.

> The test case should be very simple. You just need to erase the root. Maybe 
> you just need to initialize the cache,  call io_cache_insert, 
> io_cache_disconnect and io_cache_insert with the same block num. The second 
> insert should be fail since the disconnect will not remove the block and 
> you want to insert for a second time.

	Ok, that sounds like a worthwhile test case.  Let me see if I
can make it happen here.

Joel

-- 

#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)


Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list