Zheng Liu | c0677e6 | 2012-11-08 15:18:54 -0500 | [diff] [blame] | 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 | |
Zheng Liu | 654598b | 2012-11-08 21:57:20 -0500 | [diff] [blame] | 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 | |
Zheng Liu | c0677e6 | 2012-11-08 15:18:54 -0500 | [diff] [blame] | 23 | struct extent_status { |
| 24 | struct rb_node rb_node; |
Zheng Liu | 06b0c88 | 2013-02-18 00:26:51 -0500 | [diff] [blame^] | 25 | ext4_lblk_t es_lblk; /* first logical block extent covers */ |
| 26 | ext4_lblk_t es_len; /* length of extent in block */ |
Zheng Liu | c0677e6 | 2012-11-08 15:18:54 -0500 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | struct ext4_es_tree { |
| 30 | struct rb_root root; |
| 31 | struct extent_status *cache_es; /* recently accessed extent */ |
| 32 | }; |
| 33 | |
Zheng Liu | 654598b | 2012-11-08 21:57:20 -0500 | [diff] [blame] | 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 | |
Zheng Liu | 06b0c88 | 2013-02-18 00:26:51 -0500 | [diff] [blame^] | 38 | extern int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk, |
Zheng Liu | 654598b | 2012-11-08 21:57:20 -0500 | [diff] [blame] | 39 | ext4_lblk_t len); |
Zheng Liu | 06b0c88 | 2013-02-18 00:26:51 -0500 | [diff] [blame^] | 40 | extern int ext4_es_remove_extent(struct inode *inode, ext4_lblk_t lblk, |
Zheng Liu | 654598b | 2012-11-08 21:57:20 -0500 | [diff] [blame] | 41 | ext4_lblk_t len); |
| 42 | extern ext4_lblk_t ext4_es_find_extent(struct inode *inode, |
| 43 | struct extent_status *es); |
| 44 | |
Zheng Liu | c0677e6 | 2012-11-08 15:18:54 -0500 | [diff] [blame] | 45 | #endif /* _EXT4_EXTENTS_STATUS_H */ |