1 /* 2 * fs/ext4/extents_status.h 3 * 4 * Written by Yongqiang Yang <xiaoqiangnk@gmail.com> 5 * Modified by 6 * Allison Henderson <achender@linux.vnet.ibm.com> 7 * Zheng Liu <wenqing.lz@taobao.com> 8 * 9 */ 10 11 #ifndef _EXT4_EXTENTS_STATUS_H 12 #define _EXT4_EXTENTS_STATUS_H 13 14 /* 15 * Turn on ES_DEBUG__ to get lots of info about extent status operations. 16 */ 17 #ifdef ES_DEBUG__ 18 #define es_debug(fmt, ...) printk(fmt, ##__VA_ARGS__) 19 #else 20 #define es_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) 21 #endif 22 23 struct extent_status { 24 struct rb_node rb_node; 25 ext4_lblk_t start; /* first block extent covers */ 26 ext4_lblk_t len; /* length of extent in block */ 27 }; 28 29 struct ext4_es_tree { 30 struct rb_root root; 31 struct extent_status *cache_es; /* recently accessed extent */ 32 }; 33 34 extern int __init ext4_init_es(void); 35 extern void ext4_exit_es(void); 36 extern void ext4_es_init_tree(struct ext4_es_tree *tree); 37 38 extern int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t start, 39 ext4_lblk_t len); 40 extern int ext4_es_remove_extent(struct inode *inode, ext4_lblk_t start, 41 ext4_lblk_t len); 42 extern ext4_lblk_t ext4_es_find_extent(struct inode *inode, 43 struct extent_status *es); 44 45 #endif /* _EXT4_EXTENTS_STATUS_H */ 46