trace_orangefs_early_setattr will be used to determine the cost of early attribute writes. Otherwise self explanatory. Signed-off-by: Martin Brandenburg <martin@xxxxxxxxxxxx> --- fs/orangefs/inode.c | 5 +++ fs/orangefs/orangefs-trace.h | 100 +++++++++++++++++++++++++++++++++++++++++++ fs/orangefs/orangefs-utils.c | 6 ++- 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 8c67cdab2b12..5286fa96dfc2 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -438,6 +438,8 @@ int __orangefs_setattr(struct inode *inode, struct iattr *iattr) ORANGEFS_I(inode)->attr_valid = iattr->ia_valid; } else { spin_unlock(&inode->i_lock); + trace_orangefs_early_setattr(inode, + ORANGEFS_I(inode)->attr_valid, iattr->ia_valid); write_inode_now(inode, 1); goto again; } @@ -446,6 +448,8 @@ int __orangefs_setattr(struct inode *inode, struct iattr *iattr) ORANGEFS_I(inode)->attr_uid = current_fsuid(); ORANGEFS_I(inode)->attr_gid = current_fsgid(); } + trace_orangefs_setattr(inode, ORANGEFS_I(inode)->attr_valid, + iattr->ia_valid); setattr_copy(inode, iattr); spin_unlock(&inode->i_lock); mark_inode_dirty(inode); @@ -492,6 +496,7 @@ int orangefs_getattr(const struct path *path, struct kstat *stat, gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_getattr: called on %pd mask %u\n", path->dentry, request_mask); + trace_orangefs_getattr(inode, request_mask); ret = orangefs_inode_getattr(inode, request_mask & STATX_SIZE ? ORANGEFS_GETATTR_SIZE : 0); diff --git a/fs/orangefs/orangefs-trace.h b/fs/orangefs/orangefs-trace.h index faf09b26d9ba..76b37e18d133 100644 --- a/fs/orangefs/orangefs-trace.h +++ b/fs/orangefs/orangefs-trace.h @@ -63,6 +63,32 @@ TRACE_EVENT(orangefs_devreq_write_iter, ) ); +TRACE_EVENT(orangefs_early_setattr, + TP_PROTO(struct inode *inode, int attr_valid, int ia_valid), + TP_ARGS(inode, attr_valid, ia_valid), + TP_STRUCT__entry( + __array(unsigned char, u, 16) + __field(__s32, fs_id) + __field(int, attr_valid) + __field(int, ia_valid) + ), + TP_fast_assign( + memcpy(__entry->u, ORANGEFS_I(inode)->refn.khandle.u, 16); + __entry->fs_id = ORANGEFS_I(inode)->refn.fs_id; + __entry->attr_valid = attr_valid; + __entry->ia_valid = ia_valid; + ), + TP_printk( + "khandle=%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x fs_id=%d attr_valid=%d ia_valid=%d", + __entry->u[0], __entry->u[1], __entry->u[2], __entry->u[3], + __entry->u[4], __entry->u[5], __entry->u[6], __entry->u[7], + __entry->u[8], __entry->u[9], __entry->u[10], __entry->u[11], + __entry->u[12], __entry->u[13], __entry->u[14], __entry->u[15], + __entry->fs_id, __entry->attr_valid, __entry->ia_valid + ) +); + TRACE_EVENT(orangefs_early_writeback, TP_PROTO(int reason), TP_ARGS(reason), @@ -78,6 +104,56 @@ TRACE_EVENT(orangefs_early_writeback, ) ); +TRACE_EVENT(orangefs_getattr, + TP_PROTO(struct inode *inode, int request_mask), + TP_ARGS(inode, request_mask), + TP_STRUCT__entry( + __array(unsigned char, u, 16) + __field(__s32, fs_id) + __field(int, request_mask) + ), + TP_fast_assign( + memcpy(__entry->u, ORANGEFS_I(inode)->refn.khandle.u, 16); + __entry->fs_id = ORANGEFS_I(inode)->refn.fs_id; + __entry->request_mask = request_mask; + ), + TP_printk( + "khandle=%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x fs_id=%d request_mask=%d", + __entry->u[0], __entry->u[1], __entry->u[2], __entry->u[3], + __entry->u[4], __entry->u[5], __entry->u[6], __entry->u[7], + __entry->u[8], __entry->u[9], __entry->u[10], __entry->u[11], + __entry->u[12], __entry->u[13], __entry->u[14], __entry->u[15], + __entry->fs_id, __entry->request_mask + ) +); + +TRACE_EVENT(orangefs_setattr, + TP_PROTO(struct inode *inode, int attr_valid, int ia_valid), + TP_ARGS(inode, attr_valid, ia_valid), + TP_STRUCT__entry( + __array(unsigned char, u, 16) + __field(__s32, fs_id) + __field(int, attr_valid) + __field(int, ia_valid) + ), + TP_fast_assign( + memcpy(__entry->u, ORANGEFS_I(inode)->refn.khandle.u, 16); + __entry->fs_id = ORANGEFS_I(inode)->refn.fs_id; + __entry->attr_valid = attr_valid; + __entry->ia_valid = ia_valid; + ), + TP_printk( + "khandle=%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x fs_id=%d attr_valid=%d ia_valid=%d", + __entry->u[0], __entry->u[1], __entry->u[2], __entry->u[3], + __entry->u[4], __entry->u[5], __entry->u[6], __entry->u[7], + __entry->u[8], __entry->u[9], __entry->u[10], __entry->u[11], + __entry->u[12], __entry->u[13], __entry->u[14], __entry->u[15], + __entry->fs_id, __entry->attr_valid, __entry->ia_valid + ) +); + TRACE_EVENT(orangefs_service_operation, TP_PROTO(struct orangefs_kernel_op_s *op, int flags), TP_ARGS(op, flags), @@ -113,6 +189,30 @@ TRACE_EVENT(orangefs_readpage, ) ); +TRACE_EVENT(orangefs_write_inode, + TP_PROTO(struct inode *inode, int attr_valid), + TP_ARGS(inode, attr_valid), + TP_STRUCT__entry( + __array(unsigned char, u, 16) + __field(__s32, fs_id) + __field(int, attr_valid) + ), + TP_fast_assign( + memcpy(__entry->u, ORANGEFS_I(inode)->refn.khandle.u, 16); + __entry->fs_id = ORANGEFS_I(inode)->refn.fs_id; + __entry->attr_valid = attr_valid; + ), + TP_printk( + "khandle=%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x fs_id=%d attr_valid=%d", + __entry->u[0], __entry->u[1], __entry->u[2], __entry->u[3], + __entry->u[4], __entry->u[5], __entry->u[6], __entry->u[7], + __entry->u[8], __entry->u[9], __entry->u[10], __entry->u[11], + __entry->u[12], __entry->u[13], __entry->u[14], __entry->u[15], + __entry->fs_id, __entry->attr_valid + ) +); + TRACE_EVENT(orangefs_writepage, TP_PROTO(loff_t off, size_t len, int mwrite), TP_ARGS(off, len, mwrite), diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c index 4d079635fa4b..24bd1c7d797a 100644 --- a/fs/orangefs/orangefs-utils.c +++ b/fs/orangefs/orangefs-utils.c @@ -8,6 +8,7 @@ #include <linux/kernel.h> #include "orangefs-kernel.h" #include "orangefs-bufmap.h" +#include "orangefs-trace.h" __s32 fsid_of_op(struct orangefs_kernel_op_s *op) { @@ -423,7 +424,7 @@ int orangefs_inode_setattr(struct inode *inode) { struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct orangefs_kernel_op_s *new_op; - int ret; + int attr_valid, ret; new_op = op_alloc(ORANGEFS_VFS_OP_SETATTR); if (!new_op) @@ -435,6 +436,7 @@ int orangefs_inode_setattr(struct inode *inode) new_op->upcall.req.setattr.refn = orangefs_inode->refn; copy_attributes_from_inode(inode, &new_op->upcall.req.setattr.attributes); + attr_valid = orangefs_inode->attr_valid; orangefs_inode->attr_valid = 0; if (!new_op->upcall.req.setattr.attributes.mask) { spin_unlock(&inode->i_lock); @@ -443,6 +445,8 @@ int orangefs_inode_setattr(struct inode *inode) } spin_unlock(&inode->i_lock); + trace_orangefs_write_inode(inode, attr_valid); + ret = service_operation(new_op, get_interruptible_flag(inode) | ORANGEFS_OP_WRITEBACK); gossip_debug(GOSSIP_UTILS_DEBUG, -- 2.16.2