aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2014-02-23 15:18:59 -0500
committerTheodore Ts'o <tytso@mit.edu>2014-02-23 15:18:59 -0500
commit9eb79482a97152930b113b51dff530aba9e28c8e (patch)
treef6a7c5c7c3de4cae54c9453d3457a0504e9aa070 /include/trace
parenta633f5a319cf4116d977e25fea2830dce23a8e74 (diff)
ext4: Add support FALLOC_FL_COLLAPSE_RANGE for fallocate
This patch implements fallocate's FALLOC_FL_COLLAPSE_RANGE for Ext4. The semantics of this flag are following: 1) It collapses the range lying between offset and length by removing any data blocks which are present in this range and than updates all the logical offsets of extents beyond "offset + len" to nullify the hole created by removing blocks. In short, it does not leave a hole. 2) It should be used exclusively. No other fallocate flag in combination. 3) Offset and length supplied to fallocate should be fs block size aligned in case of xfs and ext4. 4) Collaspe range does not work beyond i_size. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Tested-by: Dongsu Park <dongsu.park@profitbricks.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/ext4.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 451e0202aa69..e9d7ee77d3a1 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -16,6 +16,11 @@ struct mpage_da_data;
16struct ext4_map_blocks; 16struct ext4_map_blocks;
17struct extent_status; 17struct extent_status;
18 18
19/* shim until we merge in the xfs_collapse_range branch */
20#ifndef FALLOC_FL_COLLAPSE_RANGE
21#define FALLOC_FL_COLLAPSE_RANGE 0x08
22#endif
23
19#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode)) 24#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
20 25
21#define show_mballoc_flags(flags) __print_flags(flags, "|", \ 26#define show_mballoc_flags(flags) __print_flags(flags, "|", \
@@ -71,7 +76,8 @@ struct extent_status;
71#define show_falloc_mode(mode) __print_flags(mode, "|", \ 76#define show_falloc_mode(mode) __print_flags(mode, "|", \
72 { FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \ 77 { FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \
73 { FALLOC_FL_PUNCH_HOLE, "PUNCH_HOLE"}, \ 78 { FALLOC_FL_PUNCH_HOLE, "PUNCH_HOLE"}, \
74 { FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"}) 79 { FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"}, \
80 { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"})
75 81
76 82
77TRACE_EVENT(ext4_free_inode, 83TRACE_EVENT(ext4_free_inode,
@@ -2415,6 +2421,31 @@ TRACE_EVENT(ext4_es_shrink_exit,
2415 __entry->shrunk_nr, __entry->cache_cnt) 2421 __entry->shrunk_nr, __entry->cache_cnt)
2416); 2422);
2417 2423
2424TRACE_EVENT(ext4_collapse_range,
2425 TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2426
2427 TP_ARGS(inode, offset, len),
2428
2429 TP_STRUCT__entry(
2430 __field(dev_t, dev)
2431 __field(ino_t, ino)
2432 __field(loff_t, offset)
2433 __field(loff_t, len)
2434 ),
2435
2436 TP_fast_assign(
2437 __entry->dev = inode->i_sb->s_dev;
2438 __entry->ino = inode->i_ino;
2439 __entry->offset = offset;
2440 __entry->len = len;
2441 ),
2442
2443 TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2444 MAJOR(__entry->dev), MINOR(__entry->dev),
2445 (unsigned long) __entry->ino,
2446 __entry->offset, __entry->len)
2447);
2448
2418#endif /* _TRACE_EXT4_H */ 2449#endif /* _TRACE_EXT4_H */
2419 2450
2420/* This part must be outside protection */ 2451/* This part must be outside protection */