storage: split index table create code

It seems that we should create a class for the operation. But we don't
have time... Oh... :<