@@ -179,6 +179,7 @@ static void cachefiles_update_object(struct fscache_object *_object)
.dentry = object->dentry
};
_debug("trunc %llx -> %llx", i_size, object_size);
+ trace_cachefiles_trunc(object, inode, i_size, object_size);
ret = vfs_truncate(&path, object_size);
if (ret < 0) {
cachefiles_io_error_obj(object, "Trunc-to-size failed");
@@ -190,6 +191,7 @@ static void cachefiles_update_object(struct fscache_object *_object)
i_size = i_size_read(inode);
_debug("trunc %llx -> %llx", i_size, object_size);
if (i_size < object_size) {
+ trace_cachefiles_trunc(object, inode, i_size, object_size);
ret = vfs_truncate(&path, object_size);
if (ret < 0) {
cachefiles_io_error_obj(object, "Trunc-to-dio-size failed");
@@ -139,6 +139,7 @@ int cachefiles_read(struct fscache_op_resources *opr,
cachefiles_grab_object(&object->fscache, fscache_obj_get_ioreq);
+ trace_cachefiles_read(object, file_inode(file), ki->iocb.ki_pos, len - skipped);
old_nofs = memalloc_nofs_save();
ret = call_read_iter(file, &ki->iocb, iter);
memalloc_nofs_restore(old_nofs);
@@ -267,6 +268,7 @@ int cachefiles_write(struct fscache_op_resources *opr,
cachefiles_grab_object(&object->fscache, fscache_obj_get_ioreq);
+ trace_cachefiles_write(object, inode, ki->iocb.ki_pos, len);
old_nofs = memalloc_nofs_save();
ret = call_write_iter(file, &ki->iocb, iter);
memalloc_nofs_restore(old_nofs);
@@ -351,6 +351,131 @@ TRACE_EVENT(cachefiles_coherency,
__entry->content)
);
+TRACE_EVENT(cachefiles_read,
+ TP_PROTO(struct cachefiles_object *obj,
+ struct inode *backer,
+ loff_t start,
+ size_t len),
+
+ TP_ARGS(obj, backer, start, len),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, obj )
+ __field(unsigned int, backer )
+ __field(size_t, len )
+ __field(loff_t, start )
+ ),
+
+ TP_fast_assign(
+ __entry->obj = obj->fscache.debug_id;
+ __entry->backer = backer->i_ino;
+ __entry->start = start;
+ __entry->len = len;
+ ),
+
+ TP_printk("o=%08x b=%08x s=%llx l=%zx",
+ __entry->obj,
+ __entry->backer,
+ __entry->start,
+ __entry->len)
+ );
+
+TRACE_EVENT(cachefiles_write,
+ TP_PROTO(struct cachefiles_object *obj,
+ struct inode *backer,
+ loff_t start,
+ size_t len),
+
+ TP_ARGS(obj, backer, start, len),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, obj )
+ __field(unsigned int, backer )
+ __field(size_t, len )
+ __field(loff_t, start )
+ ),
+
+ TP_fast_assign(
+ __entry->obj = obj->fscache.debug_id;
+ __entry->backer = backer->i_ino;
+ __entry->start = start;
+ __entry->len = len;
+ ),
+
+ TP_printk("o=%08x b=%08x s=%llx l=%zx",
+ __entry->obj,
+ __entry->backer,
+ __entry->start,
+ __entry->len)
+ );
+
+TRACE_EVENT(cachefiles_trunc,
+ TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
+ loff_t from, loff_t to),
+
+ TP_ARGS(obj, backer, from, to),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, obj )
+ __field(unsigned int, backer )
+ __field(loff_t, from )
+ __field(loff_t, to )
+ ),
+
+ TP_fast_assign(
+ __entry->obj = obj->fscache.debug_id;
+ __entry->backer = backer->i_ino;
+ __entry->from = from;
+ __entry->to = to;
+ ),
+
+ TP_printk("o=%08x b=%08x l=%llx->%llx",
+ __entry->obj,
+ __entry->backer,
+ __entry->from,
+ __entry->to)
+ );
+
+TRACE_EVENT(cachefiles_tmpfile,
+ TP_PROTO(struct cachefiles_object *obj, struct inode *backer),
+
+ TP_ARGS(obj, backer),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, obj )
+ __field(unsigned int, backer )
+ ),
+
+ TP_fast_assign(
+ __entry->obj = obj->fscache.debug_id;
+ __entry->backer = backer->i_ino;
+ ),
+
+ TP_printk("o=%08x b=%08x",
+ __entry->obj,
+ __entry->backer)
+ );
+
+TRACE_EVENT(cachefiles_link,
+ TP_PROTO(struct cachefiles_object *obj, struct inode *backer),
+
+ TP_ARGS(obj, backer),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, obj )
+ __field(unsigned int, backer )
+ ),
+
+ TP_fast_assign(
+ __entry->obj = obj->fscache.debug_id;
+ __entry->backer = backer->i_ino;
+ ),
+
+ TP_printk("o=%08x b=%08x",
+ __entry->obj,
+ __entry->backer)
+ );
+
#endif /* _TRACE_CACHEFILES_H */
/* This part must be outside protection */
Add some cache I/O tracepoints. Signed-off-by: David Howells <dhowells@redhat.com> --- fs/cachefiles/interface.c | 2 + fs/cachefiles/io.c | 2 + include/trace/events/cachefiles.h | 125 +++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+)