aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2014-03-18 18:05:35 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-03-18 18:05:35 -0400
commitb8a8684502a0fc852afa0056c6bb2a9273f6fcc0 (patch)
tree3b7c2058c86f5247a31e02e1a04182c40775e268 /include/trace
parent0e8b6879f3c234036181526683be2b0231892ae4 (diff)
ext4: Introduce FALLOC_FL_ZERO_RANGE flag for fallocate
Introduce new FALLOC_FL_ZERO_RANGE flag for fallocate. This has the same functionality as xfs ioctl XFS_IOC_ZERO_RANGE. It can be used to convert a range of file to zeros preferably without issuing data IO. Blocks should be preallocated for the regions that span holes in the file, and the entire range is preferable converted to unwritten extents This can be also used to preallocate blocks past EOF in the same way as with fallocate. Flag FALLOC_FL_KEEP_SIZE which should cause the inode size to remain the same. Also add appropriate tracepoints. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/ext4.h68
1 files changed, 35 insertions, 33 deletions
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index e9d7ee77d3a1..010ea89eeb0e 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -21,6 +21,10 @@ struct extent_status;
21#define FALLOC_FL_COLLAPSE_RANGE 0x08 21#define FALLOC_FL_COLLAPSE_RANGE 0x08
22#endif 22#endif
23 23
24#ifndef FALLOC_FL_ZERO_RANGE
25#define FALLOC_FL_ZERO_RANGE 0x10
26#endif
27
24#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode)) 28#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
25 29
26#define show_mballoc_flags(flags) __print_flags(flags, "|", \ 30#define show_mballoc_flags(flags) __print_flags(flags, "|", \
@@ -77,7 +81,8 @@ struct extent_status;
77 { FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \ 81 { FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \
78 { FALLOC_FL_PUNCH_HOLE, "PUNCH_HOLE"}, \ 82 { FALLOC_FL_PUNCH_HOLE, "PUNCH_HOLE"}, \
79 { FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"}, \ 83 { FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"}, \
80 { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"}) 84 { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"}, \
85 { FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"})
81 86
82 87
83TRACE_EVENT(ext4_free_inode, 88TRACE_EVENT(ext4_free_inode,
@@ -1339,7 +1344,7 @@ TRACE_EVENT(ext4_direct_IO_exit,
1339 __entry->rw, __entry->ret) 1344 __entry->rw, __entry->ret)
1340); 1345);
1341 1346
1342TRACE_EVENT(ext4_fallocate_enter, 1347DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1343 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode), 1348 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1344 1349
1345 TP_ARGS(inode, offset, len, mode), 1350 TP_ARGS(inode, offset, len, mode),
@@ -1347,23 +1352,45 @@ TRACE_EVENT(ext4_fallocate_enter,
1347 TP_STRUCT__entry( 1352 TP_STRUCT__entry(
1348 __field( dev_t, dev ) 1353 __field( dev_t, dev )
1349 __field( ino_t, ino ) 1354 __field( ino_t, ino )
1350 __field( loff_t, pos ) 1355 __field( loff_t, offset )
1351 __field( loff_t, len ) 1356 __field( loff_t, len )
1352 __field( int, mode ) 1357 __field( int, mode )
1353 ), 1358 ),
1354 1359
1355 TP_fast_assign( 1360 TP_fast_assign(
1356 __entry->dev = inode->i_sb->s_dev; 1361 __entry->dev = inode->i_sb->s_dev;
1357 __entry->ino = inode->i_ino; 1362 __entry->ino = inode->i_ino;
1358 __entry->pos = offset; 1363 __entry->offset = offset;
1359 __entry->len = len; 1364 __entry->len = len;
1360 __entry->mode = mode; 1365 __entry->mode = mode;
1361 ), 1366 ),
1362 1367
1363 TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %s", 1368 TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1364 MAJOR(__entry->dev), MINOR(__entry->dev), 1369 MAJOR(__entry->dev), MINOR(__entry->dev),
1365 (unsigned long) __entry->ino, __entry->pos, 1370 (unsigned long) __entry->ino,
1366 __entry->len, show_falloc_mode(__entry->mode)) 1371 __entry->offset, __entry->len,
1372 show_falloc_mode(__entry->mode))
1373);
1374
1375DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1376
1377 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1378
1379 TP_ARGS(inode, offset, len, mode)
1380);
1381
1382DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1383
1384 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1385
1386 TP_ARGS(inode, offset, len, mode)
1387);
1388
1389DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1390
1391 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1392
1393 TP_ARGS(inode, offset, len, mode)
1367); 1394);
1368 1395
1369TRACE_EVENT(ext4_fallocate_exit, 1396TRACE_EVENT(ext4_fallocate_exit,
@@ -1395,31 +1422,6 @@ TRACE_EVENT(ext4_fallocate_exit,
1395 __entry->ret) 1422 __entry->ret)
1396); 1423);
1397 1424
1398TRACE_EVENT(ext4_punch_hole,
1399 TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
1400
1401 TP_ARGS(inode, offset, len),
1402
1403 TP_STRUCT__entry(
1404 __field( dev_t, dev )
1405 __field( ino_t, ino )
1406 __field( loff_t, offset )
1407 __field( loff_t, len )
1408 ),
1409
1410 TP_fast_assign(
1411 __entry->dev = inode->i_sb->s_dev;
1412 __entry->ino = inode->i_ino;
1413 __entry->offset = offset;
1414 __entry->len = len;
1415 ),
1416
1417 TP_printk("dev %d,%d ino %lu offset %lld len %lld",
1418 MAJOR(__entry->dev), MINOR(__entry->dev),
1419 (unsigned long) __entry->ino,
1420 __entry->offset, __entry->len)
1421);
1422
1423TRACE_EVENT(ext4_unlink_enter, 1425TRACE_EVENT(ext4_unlink_enter,
1424 TP_PROTO(struct inode *parent, struct dentry *dentry), 1426 TP_PROTO(struct inode *parent, struct dentry *dentry),
1425 1427