/Documentation/security/

s/ctree.h?h=update_litmus_2019&id=9780c4976f5518f805b32fc00ed045b636fe8fa8'>blamecommitdiffstats
path: root/fs/btrfs/ctree.h
blob: eddc461fb9645651670dd71967df295184a3b669 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                    

                       
 

                          
                     
                        
                            
                             
                              
                       
                       
                          
                               
                           
                          
                        
                            
                           
                      
                       
                         
 
                          
                         
                              


                                                    
                                            
                                                  
                         
 





                                       
                                                                       
 
                           
 
                         
 

                                   
                                             
                                     

                                                                             
                                       
 



                                                                          
                                      




                                                                     






                                                      
 


                                             


                                            


                                                          


                                                     


                                                           



                                                 



                                            






                                             


                                        
  
                                                             



                                      


                                                  
  
                                          
   
                                        
                                        
                                              
 






                                                                   



                                         
                                    
 
  





                                                                   




                                                                         






                                                                    

                                     



                                 
                                      
 
                          
                              
 


                                                                             







                                 

                                 
 


                                                                    

                                                          

                                                 
  








                                                                           

                                                                 



                                                                     
   

                        
                
                      


                               
                     
                
                   

                               



                                        


















                                                  


                                             


                                                 

                                                         
                                                      


                            








                                                           
                                                  
                                 


                                             




                               
                                     


                               



                                                         
                     
 















                                                                              


                                                



                                        















                                       






                                                                  

                                                   



                     
                                         
                                         
                                         
                                         
 
                       


                                                   









                                                                              
 


                                                           
                     
                                                         
                                 
                                                        
                                                                         
                     


                                                                      
                          
                     
                       
                 

                               
                                                       

                                                                      
                                                                       
                                                                     

                                                                      

                                                                     
                                                                            


                                                               
 





                                                                
                            
 
  



























                                                                    
                            











                                 


                                                           
                          
                                 
                                                               
                                                           
                                              
                     

                                                                              
                     

                          
                          
                        


                                                                     

                           
                                 
                           

                          
                                 
                          
                                    
                                     


                               
                         
                      
                            
                          
                                       
 
                                     
 
                                
                                    
 
                              
                            
                                                          
                                                                     

                               
  


                                                                              
                                                           
                                                           
                                                           
                                                           












                                                               
 
                                                           
                                                           
                                                           
                                                           
 
                                                    

                                                    
                                                    


                                                    

                                                         
                                                         
                                                         
                                                         
                                                         
                                                         
                                                         

                                                         
 


                                                            

  
                                                                 

                                                                
                   
                                  
                      
                    

                               






                                                                      
                   
                                   
                                  

                               



                                                                     


                                  
                          

                               
                   
                                   
                                    

                               
  

                                                                        




                                                                 
                   
                                                     
                                   

                                                                          
                  
                                                   
                         




                                                                       



                                        
                                          
                                       
                                             
  
 



                                                                   
 
                          





                               
                    

                               










                                                                         





                                                                            

















                                  
                      



                               


                          
                     

                               
 

                                                                        
                                                                            

                         


                              
                      
                                            

                               
                        
                     



                               







                               
                       
                   


                               
                             

                                 


                                 
  
 
                         
                                         
                          

                                                  
                    
                      
                           



                     
                    
                     
 







                                                               



                                    

                               



                               
                       
                                       
                       
                        
                        


                               

                                                   





                                                                            
                        
                                      
                          
                          


                          
                             
                     
                    

                                            
                 





























                                                                                
                               
 








                                                       






                                                       











                                                                    




















                                                                      











                                                                              
 







                                                                      
















                                                                   


                                    
 
                               


                                                  
                          




















                                                                       
                
 


                                                                          

                                                                         
           

                              
          
                                                       






                                                                           

                                                                       
           
                         
 

                               
                        
                

                               







                                                                            



































                                                                         
















                                                                            
                                                  






                                                   

                                                   

                                                                         






                          

                         

                           






                                                                      

                                                                      

                                                                      


                                                                      








                                                                      





                                                                           














                                                                           

                               

                              

                               





                                                    




                                                           
                                                
   
                                                           



























                                                                  
                      




























                                                           





                                 
                         
                        
 

                                                                            
                                                    
                                                                            



                                                                             
                                                                       
                                                          

                                                                    



                                                                            








                                                                                
                                                              

                                                                          
 

                  
          










                                                                                
                              
                                               
                                
 
                                       
                                               
                                                           
                               

                            
                                                               

  







                                         


                        
                                            
                        


                                

  















                                                                         


                                                                






                                                                     

  


                                    

                                    
                                    

  




                                    

  



                               
                               




                                                    




                                
                            


                           

                    


                              


                                           
                                      
                            
                        
                   
                     
                           
                        
                  
                       
                             
 






                                                                          


                                                               
                        
                            
                                       
                               

                             
 
                                  
                   

                                                  
 


                                            
                                                    





                                                    


                         




                                                                       
 

                                                                                


                                        

                          


                                    


                                   
  
 





                              

                                                                                 




                                    








                                                                   



                                         



                                       

                                                             
             
                     
                    
                        
                             
                          
                      
                                 
                                            

                                       

                                      
                                   
                                     
                                      
                                     


                                                                         

                                       
                                              
 

                                          
                               

                                              



                                             

                                               
 


                                               



                                                                






                                                       

                                                      


                                               
                       
                                 
                                    





                                                                        
                                




                                                                             
                                      
                            





                                                                          
                       









                                                                               
                        
                                                      
                                               
                                           
                                                   
                                            
 










                                                                            

                                                   
                                    
                               
                                  
                                    
                                    

                                               
                                 
                                  
 





                                                                        





                                                                   







                                                                            
 
                                            
 
                                             
 
                                       

                                       
                              





                                                                
                                    
                                    
                                              
 

                                       
                                             
 

                                             
                                





                                           
                                  
                                       
                               
                                      
                                  
 
          
                                                                       
           
                                     

          


                                                                         


                                                                     
                                       
 
                                         


                                                               

          




                                                                            


                                                                           
           





                                                     
                                                     






                                                         
 




                                                                         

                                                


                                                                              

                                                
                             
 
                                        
                        
                    
                                
                 
 
                         
 

                                                                            
                                             
                                 

                           

                                             
                                            





                                                                             
                                    
 

                                            

                                        




                                                              
 




                                        

                                                                       




                                                                       


                                      
 


                                   

                                   
                                    
                                                  
                                         
 


                                        
                          
 






                                           
                                 


                                                            
                                                     
 


                                       















                                                                          
                                      
                               

                                  
 





                                                                             


                                                      


                                                                
                                                            
                       
 


                                                                         
                                                      
                                                   
                                             
 
                              
                               

                                                
 


                                          
 



                                            

                                                

                                                


                                             

                                                      
 


                                          
                                              
                                            


                                                                   


                                    
                                           
                                             


                                                  





                                                                          
  
 




                                        
  

















                                                       
                                         

  
                                                                              
                                            

                   
                                   
 
                                          
                                    
                                      
 
                            

                                         
                                      

                                              
                                    
 


                                          
                                  
                                                  


                                                
                                                     

                                      
 
                               

                                             
                                     

                               
                           
                        


                                                       
                            
                            
 

                       






                                                           

                       
                 

                             
 
                                                                        
                         
 
                               
                                         
                                    
                   


                                                                        
 

                                   


                                        
                               
                               
                                                 
                                 
 



                                                                 
          




                                                                       


                                                                         
                       
 
                                  
                      
 
                                    








                                                                            

                                          













                                                                         





                                                                     

                                                     


                                               

  































                                                                    




                                                                             
                                         
                                          
                                          

                                          
                                                           




                                                                         



                                  
  
                               
   
                                   
 
  

                                                                
   
                                   

  
                                                                  

                                                           














                                                                        



                                                                      
                                   
 





                                                                              








                                           




                                                                      
                                      
 


                                   
 























                                                             

                                   
  





                                                          





                                                                   












                                                                           


                                                                     

                                   




                                                                


                                                
                                                
                                                
                                                
                                                
                                                
                                                
                                                
                                                 
                                                 
                                                 
                                                 
                                                    
                                                  
                                                 
                                                 
                                                 
                                                 

                                                                   
                                                         
                                                 

                                                 
 
                                            
                                              
 

                                                                   
                                                                 

                                                                       
 













                                                                         











                                                                             
  






                                                                            

                                                   
                                                   
 































                                                                        

              


                                                
                                                
                                                





                                                 
                                                 
 

                                                 







                                                                       
                            

 



















                                                                         






















                                                                             
                                                                         























                                                                              



                                                                         
                                                                         
                                                                         
                                                                         



                                                                         
                                                                         
                                                                         
 
 







                                                                         

 




                                                                               

                                                              

                                                                               


                                                                            
                                                                             
 











                                                                             





                                                                        

                                                                        
 
                                                                       
 
                                                                        

 
                                                                       
 
                                                                        

 
                                                                 






                                                                           
                                                                           


                                                                   





                                                                             











                                                                           

                                                                     











                                                                               




                                                                           





                                                                       





                                                                       




                                                                         

                                                                           

                                                   




                                                                      
 

                                                                             
                                                                       
 






                                                                             

                                                                              
                                                                          
                                                                        
                                                                  
                                                                      




                                                                                
                                                                  
                                                                    
















                                                                                

                                                                   

                                                                               
 
                             





                                                                      

                                                                           
                                                                                          

                                                                               
                                        

 



                                                                      
 

















                                                                               
 




































                                                                              
 

                                                                     
                                                                         



                                                                    
 
                                                                       
 



                                                                   

 

                                                                    
 



                                                                     

 
















                                                                             
                                                             
 

                                                  

 


                                                             

                                                                              
 



                                                            

 


                                                               

                                                                           
 
                                                        
 

                                                   

 
                                                      
 
                                                             

 

                                                          
 
                                                                       

 
                                                                     
 
                                                     

 
                                                                        
 
                                                        

 
                                                                      
 
                                                      

 

                                                                   
 
                                                    
                                                                   

 

                                                                       
 
                                                    
                                                                    

 

                                                                    






                                                                           
                           
                                                                      

                                                                      
                                                                    






                                                                         
 


                                                                  
 
                                                                       

 


                                                                      
 
                                                                        

 




















                                                                              




                                                                             
 



                                                                     
                               






                                                                     
                               


                                                    

                                                                  
 


                                              

 

                                                                  
 


                                              

 


                                                                      
 


                                                

 
 
                                                      
 
                         

 
                                                                    
 
                        

 
                         
                                                                          



                                                                            
                                                                        
                                                                       





                                                                               
 


















                                                                             














                                                                         
                                                   
 
                                                   

 
                                                                                  
 
                                                              

 
                                                         
 
                                           

 
                            

                                                                
                                                                     

                                                                         
 

                                                                 

                                                                          

                                                                             
                                                                        

                                                                             

                                                                    









                                                                    
 

                                                               
                                                                                    

 




                                                                                  
















































                                                                            

                                                                        
 
























































                                                                             
                                              
















                                                                    
                                              


                              
                                                                             
                                                                           


                                                                         

                                                                             

                                                                              

                                                                    


                                                                          


                                                                  

                                                                          

                                                                        



                                                                     



                                                                    

                                                                    

                                                                  

                                                                     


                                                                         
                                              

                                                                        

                                                                   

                                                                          
                                                                           

                                                                              


                                                                    



                                               

                                   
 
                                                                    
 
                                                  

 

                                                                             







                                                                         



                                                                            
 

                                                                
 
                                                                      



                                                                  
                                                              

 

                                                                          

                                                                         

                                                                             

                                                                     

                                                                        








                                                                             







                                                                             
                                                                            
 
 

























                                                                                 























                                                                              






                                                                             

                                                                         

































                                                                               










































                                                                                
                                                                    



                             

                                                             
                                           




                                                  
 





                                                                              

                                                                         
                                                          

 
                   


                                                                        
                                                                         
                                                                    
 
                                                                          
                              








                                                                              
                                                            

 

                                                                        

                                                                        
                                                                  

                                                                         

                                                                
                                                                          

                                                                 
                                                                              

                                                        
                                                            
                                                               

                                                           
                                                           

                                                                


                                                                            
                                                                  
                                                                  
                                                                 


                                                                              
                                                                              
                                                                  


                                                            
                                                     


                                                                      

                                                               



                                                                            

                                                                           
                                                                           
                                                                            
                                                               
                                                                            
                                                               


                                                                     
                                                        

                                                       
                                                                               
                                             
 

                                                                           

                                                               

                                                                  
                                                                
                                                        
                                                          

                                                               
                                                                   
 

                                                                    

                                                                    

                                                             
                                                               

                                                        
                                                            

                                                                   
                                                                          
                                     
                                                                

                                                              
                                                              

                                                                      
                                                            

                                                                           

                                                                        
                                                               
                                                             











                                                                   
                                                                         
                                                                    
                                                                             

                                                                           

                                                                   
                                                                          


                                                                   


                                                                 
                                                                                


                                                                  

                                                                         

                                                                           


                                                                            

                                                       
                                                         
                                                

                                                                         
                                                  

                                                                             

                                                                               


                                                            


                                                                         


                                                               
                                                     
                                                                    
                                                      
                                                                     
                                                             
                                                                             

                                                           

                                                             

                                                               
                                                                       
 
                                                         

                                                                          
                                

                                                              

                                                         
                                        
             


                                                                     


                                                                  

                                                                   

                                                           
                                                        

                                                                    
                                                                         
                                                                
                                       
                                                                            
                                                 
                                        



                                   
                                










                                                                        


                                                                       
                                                    



                                                                             

                                                         
                                                                        
                                      
                                                                          
                                                     




                                                      



                                                          

                                                                              


                                                                             

                                                                         


                                                                           
                                                        
                                                                             
                                                     
                                                   
                                              

                                           
                                                   
                                                    
                                                                        

                                                           

                                                                              






                                                                     
                                                                             

                                                                      

                                                                               













                                                                                
                                                                      
                                                                      

                                                                         

                                                                         


                                                             
                                                              

                 



                                                                                
                                                                               


                                                                       



                                                        







                                                                 











                                                                          

                                                              
                                    





                                     
                                   
                                  

                                         
                                                        

                       
 




                                                          
                                                                
 
                 
                                                     

                                                 

                                                        




                                                                         
                                                       




                                                                             



                                                                    


                                                                               
                                                          

                                                      
                                                                  

                                                              
 






                                                                        


                                                                               
 
                

                                                                    

                                                                    
                                                          
                                                                          










                                                                              



                                                               



                                                               
                                                             



                                                                  




                                                                           


                                                     



                                                                         





                                                                  
                                                                
 
                  


                                                            
                                                                            


                                                          
                                                                             


                                                                    
                                                                          

                                                            
 












                                                                            
                 
                         

                                                                  
                                                                       
                                                     
                                                                           
                                                                   
                                                              




                                                                                


                                                                   
                                                  
                                                            
                                                   
                                                           
                                                                    
                                                                    

                                                                         





                                                                       
             












                                                                              


                                                                                  
                                                                        

                                                                   

                                                                        
                                                          




                                        







                                                                              

                                                                            






                                                                               



                                                         

                                                                     




                                                                 
                                                                         

                                                                             

                                                                      
                                                              


                                                            


                                                                         
                                                                         
                                                         
                                            
                                                                          

                                                        
                                          

                                
                                              
                                                                           
                                                                
                                                                           
                                                                         



                                                        

                                                                              
                                                                            
                                                  

                                                               
                                                                        
                                                      

                                                      


                                                                     



                                                                               
                                                  
                                                              


                                                   


                                                                         

                                                                  
                                  


                                                                  

                                                                      


                                                                       
 
            

                                  


                                                            
                                                                
                                                                               

                                                                     
                                                          


                                                                      



                                                       

                                                                               
                                                
                                                               
                                                                       
                                                               



                                                                   
                                                                          
 

                                                         
                                                 



                            
                                                           
                                                               
 

                                                                          
 
             
                                                                
                                                    


                    
                                                                             

                            
                                                                            



      













                                                       
 

















                                                              

















                                                                 
















                                                                   
            

                                                     

                                                            

                                                               

                                                                 


                                            

                                                   

                                                      

                                               
      
 






                                                         















                                                                 

                          
      

                                                            
                                                                 










                                                                     
              
      
                                                                           
                                                                         
 
                                          
 
      



                                                                             











                                                                          




                                                                             
                                                                        


                                                  


         


                                                                    
                                                                               





                                                                 



                                                                               

                                                                 








                                                                 
           
 
                                                                 


                                                                 
           
 
              
      


                                                                       



                                                                     

                                                                         

                                                                         
           

           
                                
                                                               
                                                                        

                                                           
     
                          
                          




                                                                        
      
 







                                                                         


                                                                             
                                                                     
                                                     
                                                               
                                                                      

             

                                                                        
                                                      
                                                
                                                   


                                                      

                                                                



                                                                    





                                                                       
 















                                                                              


                                               

                                                             


                         





                                                                       



                                                   
 








                                                                    
      
/*
 * Copyright (C) 2007 Oracle.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License v2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 021110-1307, USA.
 */

#ifndef __BTRFS_CTREE__
#define __BTRFS_CTREE__

#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/fs.h>
#include <linux/rwsem.h>
#include <linux/semaphore.h>
#include <linux/completion.h>
#include <linux/backing-dev.h>
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/kobject.h>
#include <trace/events/btrfs.h>
#include <asm/kmap_types.h>
#include <linux/pagemap.h>
#include <linux/btrfs.h>
#include <linux/workqueue.h>
#include <linux/security.h>
#include "extent_io.h"
#include "extent_map.h"
#include "async-thread.h"

struct btrfs_trans_handle;
struct btrfs_transaction;
struct btrfs_pending_snapshot;
extern struct kmem_cache *btrfs_trans_handle_cachep;
extern struct kmem_cache *btrfs_transaction_cachep;
extern struct kmem_cache *btrfs_bit_radix_cachep;
extern struct kmem_cache *btrfs_path_cachep;
extern struct kmem_cache *btrfs_free_space_cachep;
struct btrfs_ordered_sum;

#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
#define STATIC noinline
#else
#define STATIC static noinline
#endif

#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */

#define BTRFS_MAX_MIRRORS 3

#define BTRFS_MAX_LEVEL 8

#define BTRFS_COMPAT_EXTENT_TREE_V0

/* holds pointers to all of the tree roots */
#define BTRFS_ROOT_TREE_OBJECTID 1ULL

/* stores information about which extents are in use, and reference counts */
#define BTRFS_EXTENT_TREE_OBJECTID 2ULL

/*
 * chunk tree stores translations from logical -> physical block numbering
 * the super block points to the chunk tree
 */
#define BTRFS_CHUNK_TREE_OBJECTID 3ULL

/*
 * stores information about which areas of a given device are in use.
 * one per device.  The tree of tree roots points to the device tree
 */
#define BTRFS_DEV_TREE_OBJECTID 4ULL

/* one per subvolume, storing files and directories */
#define BTRFS_FS_TREE_OBJECTID 5ULL

/* directory objectid inside the root tree */
#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL

/* holds checksums of all the data extents */
#define BTRFS_CSUM_TREE_OBJECTID 7ULL

/* holds quota configuration and tracking */
#define BTRFS_QUOTA_TREE_OBJECTID 8ULL

/* for storing items that use the BTRFS_UUID_KEY* types */
#define BTRFS_UUID_TREE_OBJECTID 9ULL

/* for storing balance parameters in the root tree */
#define BTRFS_BALANCE_OBJECTID -4ULL

/* orhpan objectid for tracking unlinked/truncated files */
#define BTRFS_ORPHAN_OBJECTID -5ULL

/* does write ahead logging to speed up fsyncs */
#define BTRFS_TREE_LOG_OBJECTID -6ULL
#define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL

/* for space balancing */
#define BTRFS_TREE_RELOC_OBJECTID -8ULL
#define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL

/*
 * extent checksums all have this objectid
 * this allows them to share the logging tree
 * for fsyncs
 */
#define BTRFS_EXTENT_CSUM_OBJECTID -10ULL

/* For storing free space cache */
#define BTRFS_FREE_SPACE_OBJECTID -11ULL

/*
 * The inode number assigned to the special inode for storing
 * free ino cache
 */
#define BTRFS_FREE_INO_OBJECTID -12ULL

/* dummy objectid represents multiple objectids */
#define BTRFS_MULTIPLE_OBJECTIDS -255ULL

/*
 * All files have objectids in this range.
 */
#define BTRFS_FIRST_FREE_OBJECTID 256ULL
#define BTRFS_LAST_FREE_OBJECTID -256ULL
#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL


/*
 * the device items go into the chunk tree.  The key is in the form
 * [ 1 BTRFS_DEV_ITEM_KEY device_id ]
 */
#define BTRFS_DEV_ITEMS_OBJECTID 1ULL

#define BTRFS_BTREE_INODE_OBJECTID 1

#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2

#define BTRFS_DEV_REPLACE_DEVID 0ULL

/*
 * the max metadata block size.  This limit is somewhat artificial,
 * but the memmove costs go through the roof for larger blocks.
 */
#define BTRFS_MAX_METADATA_BLOCKSIZE 65536

/*
 * we can actually store much bigger names, but lets not confuse the rest
 * of linux
 */
#define BTRFS_NAME_LEN 255

/*
 * Theoretical limit is larger, but we keep this down to a sane
 * value. That should limit greatly the possibility of collisions on
 * inode ref items.
 */
#define BTRFS_LINK_MAX 65535U

/* 32 bytes in various csum fields */
#define BTRFS_CSUM_SIZE 32

/* csum types */
#define BTRFS_CSUM_TYPE_CRC32	0

static int btrfs_csum_sizes[] = { 4 };

/* four bytes for CRC32 */
#define BTRFS_EMPTY_DIR_SIZE 0

/* spefic to btrfs_map_block(), therefore not in include/linux/blk_types.h */
#define REQ_GET_READ_MIRRORS	(1 << 30)

#define BTRFS_FT_UNKNOWN	0
#define BTRFS_FT_REG_FILE	1
#define BTRFS_FT_DIR		2
#define BTRFS_FT_CHRDEV		3
#define BTRFS_FT_BLKDEV		4
#define BTRFS_FT_FIFO		5
#define BTRFS_FT_SOCK		6
#define BTRFS_FT_SYMLINK	7
#define BTRFS_FT_XATTR		8
#define BTRFS_FT_MAX		9

/* ioprio of readahead is set to idle */
#define BTRFS_IOPRIO_READA (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0))

#define BTRFS_DIRTY_METADATA_THRESH	(32 * 1024 * 1024)

#define BTRFS_MAX_EXTENT_SIZE (128 * 1024 * 1024)

/*
 * The key defines the order in the tree, and so it also defines (optimal)
 * block layout.
 *
 * objectid corresponds to the inode number.
 *
 * type tells us things about the object, and is a kind of stream selector.
 * so for a given inode, keys with type of 1 might refer to the inode data,
 * type of 2 may point to file data in the btree and type == 3 may point to
 * extents.
 *
 * offset is the starting byte offset for this key in the stream.
 *
 * btrfs_disk_key is in disk byte order.  struct btrfs_key is always
 * in cpu native order.  Otherwise they are identical and their sizes
 * should be the same (ie both packed)
 */
struct btrfs_disk_key {
	__le64 objectid;
	u8 type;
	__le64 offset;
} __attribute__ ((__packed__));

struct btrfs_key {
	u64 objectid;
	u8 type;
	u64 offset;
} __attribute__ ((__packed__));

struct btrfs_mapping_tree {
	struct extent_map_tree map_tree;
};

struct btrfs_dev_item {
	/* the internal btrfs device id */
	__le64 devid;

	/* size of the device */
	__le64 total_bytes;

	/* bytes used */
	__le64 bytes_used;

	/* optimal io alignment for this device */
	__le32 io_align;

	/* optimal io width for this device */
	__le32 io_width;

	/* minimal io size for this device */
	__le32 sector_size;

	/* type and info about this device */
	__le64 type;

	/* expected generation for this device */
	__le64 generation;

	/*
	 * starting byte of this partition on the device,
	 * to allow for stripe alignment in the future
	 */
	__le64 start_offset;

	/* grouping information for allocation decisions */
	__le32 dev_group;

	/* seek speed 0-100 where 100 is fastest */
	u8 seek_speed;

	/* bandwidth 0-100 where 100 is fastest */
	u8 bandwidth;

	/* btrfs generated uuid for this device */
	u8 uuid[BTRFS_UUID_SIZE];

	/* uuid of FS who owns this device */
	u8 fsid[BTRFS_UUID_SIZE];
} __attribute__ ((__packed__));

struct btrfs_stripe {
	__le64 devid;
	__le64 offset;
	u8 dev_uuid[BTRFS_UUID_SIZE];
} __attribute__ ((__packed__));

struct btrfs_chunk {
	/* size of this chunk in bytes */
	__le64 length;

	/* objectid of the root referencing this chunk */