diff options
author | Zheng Liu <wenqing.lz@taobao.com> | 2013-02-18 00:29:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-02-18 00:29:59 -0500 |
commit | d100eef2440fea13e4f09e88b1c8bcbca64beb9f (patch) | |
tree | 2451dc4582b43a30b414c89108b75148d48c9b57 /include | |
parent | f7fec032aa782d3fd7e51fbdf08aa3a296c01500 (diff) |
ext4: lookup block mapping in extent status tree
After tracking all extent status, we already have a extent cache in
memory. Every time we want to lookup a block mapping, we can first
try to lookup it in extent status tree to avoid a potential disk I/O.
A new function called ext4_es_lookup_extent is defined to finish this
work. When we try to lookup a block mapping, we always call
ext4_map_blocks and/or ext4_da_map_blocks. So in these functions we
first try to lookup a block mapping in extent status tree.
A new flag EXT4_GET_BLOCKS_NO_PUT_HOLE is used in ext4_da_map_blocks
in order not to put a hole into extent status tree because this hole
will be converted to delayed extent in the tree immediately.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Jan kara <jack@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/trace/events/ext4.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index c121cdf55ab3..1e590b68cec4 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -2199,6 +2199,62 @@ TRACE_EVENT(ext4_es_find_delayed_extent_exit, | |||
2199 | __entry->pblk, __entry->status) | 2199 | __entry->pblk, __entry->status) |
2200 | ); | 2200 | ); |
2201 | 2201 | ||
2202 | TRACE_EVENT(ext4_es_lookup_extent_enter, | ||
2203 | TP_PROTO(struct inode *inode, ext4_lblk_t lblk), | ||
2204 | |||
2205 | TP_ARGS(inode, lblk), | ||
2206 | |||
2207 | TP_STRUCT__entry( | ||
2208 | __field( dev_t, dev ) | ||
2209 | __field( ino_t, ino ) | ||
2210 | __field( ext4_lblk_t, lblk ) | ||
2211 | ), | ||
2212 | |||
2213 | TP_fast_assign( | ||
2214 | __entry->dev = inode->i_sb->s_dev; | ||
2215 | __entry->ino = inode->i_ino; | ||
2216 | __entry->lblk = lblk; | ||
2217 | ), | ||
2218 | |||
2219 | TP_printk("dev %d,%d ino %lu lblk %u", | ||
2220 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
2221 | (unsigned long) __entry->ino, __entry->lblk) | ||
2222 | ); | ||
2223 | |||
2224 | TRACE_EVENT(ext4_es_lookup_extent_exit, | ||
2225 | TP_PROTO(struct inode *inode, struct extent_status *es, | ||
2226 | int found), | ||
2227 | |||
2228 | TP_ARGS(inode, es, found), | ||
2229 | |||
2230 | TP_STRUCT__entry( | ||
2231 | __field( dev_t, dev ) | ||
2232 | __field( ino_t, ino ) | ||
2233 | __field( ext4_lblk_t, lblk ) | ||
2234 | __field( ext4_lblk_t, len ) | ||
2235 | __field( ext4_fsblk_t, pblk ) | ||
2236 | __field( unsigned long long, status ) | ||
2237 | __field( int, found ) | ||
2238 | ), | ||
2239 | |||
2240 | TP_fast_assign( | ||
2241 | __entry->dev = inode->i_sb->s_dev; | ||
2242 | __entry->ino = inode->i_ino; | ||
2243 | __entry->lblk = es->es_lblk; | ||
2244 | __entry->len = es->es_len; | ||
2245 | __entry->pblk = ext4_es_pblock(es); | ||
2246 | __entry->status = ext4_es_status(es); | ||
2247 | __entry->found = found; | ||
2248 | ), | ||
2249 | |||
2250 | TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %llx", | ||
2251 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
2252 | (unsigned long) __entry->ino, __entry->found, | ||
2253 | __entry->lblk, __entry->len, | ||
2254 | __entry->found ? __entry->pblk : 0, | ||
2255 | __entry->found ? __entry->status : 0) | ||
2256 | ); | ||
2257 | |||
2202 | #endif /* _TRACE_EXT4_H */ | 2258 | #endif /* _TRACE_EXT4_H */ |
2203 | 2259 | ||
2204 | /* This part must be outside protection */ | 2260 | /* This part must be outside protection */ |