aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--include/trace/events/ext4.h101
2 files changed, 103 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3e8afd969236..1a3d7b232cd7 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1061,6 +1061,7 @@ void ext4_da_update_reserve_space(struct inode *inode,
1061 int mdb_free = 0, allocated_meta_blocks = 0; 1061 int mdb_free = 0, allocated_meta_blocks = 0;
1062 1062
1063 spin_lock(&ei->i_block_reservation_lock); 1063 spin_lock(&ei->i_block_reservation_lock);
1064 trace_ext4_da_update_reserve_space(inode, used);
1064 if (unlikely(used > ei->i_reserved_data_blocks)) { 1065 if (unlikely(used > ei->i_reserved_data_blocks)) {
1065 ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d " 1066 ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d "
1066 "with only %d reserved data blocks\n", 1067 "with only %d reserved data blocks\n",
@@ -1846,6 +1847,7 @@ repeat:
1846 spin_lock(&ei->i_block_reservation_lock); 1847 spin_lock(&ei->i_block_reservation_lock);
1847 md_reserved = ei->i_reserved_meta_blocks; 1848 md_reserved = ei->i_reserved_meta_blocks;
1848 md_needed = ext4_calc_metadata_amount(inode, lblock); 1849 md_needed = ext4_calc_metadata_amount(inode, lblock);
1850 trace_ext4_da_reserve_space(inode, md_needed);
1849 spin_unlock(&ei->i_block_reservation_lock); 1851 spin_unlock(&ei->i_block_reservation_lock);
1850 1852
1851 /* 1853 /*
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index d0b6cd3afb2f..2aa6aa3e8f61 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -874,6 +874,107 @@ TRACE_EVENT(ext4_forget,
874 __entry->mode, __entry->is_metadata, __entry->block) 874 __entry->mode, __entry->is_metadata, __entry->block)
875); 875);
876 876
877TRACE_EVENT(ext4_da_update_reserve_space,
878 TP_PROTO(struct inode *inode, int used_blocks),
879
880 TP_ARGS(inode, used_blocks),
881
882 TP_STRUCT__entry(
883 __field( dev_t, dev )
884 __field( ino_t, ino )
885 __field( umode_t, mode )
886 __field( __u64, i_blocks )
887 __field( int, used_blocks )
888 __field( int, reserved_data_blocks )
889 __field( int, reserved_meta_blocks )
890 __field( int, allocated_meta_blocks )
891 ),
892
893 TP_fast_assign(
894 __entry->dev = inode->i_sb->s_dev;
895 __entry->ino = inode->i_ino;
896 __entry->mode = inode->i_mode;
897 __entry->i_blocks = inode->i_blocks;
898 __entry->used_blocks = used_blocks;
899 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
900 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
901 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
902 ),
903
904 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
905 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
906 __entry->mode, (unsigned long long) __entry->i_blocks,
907 __entry->used_blocks, __entry->reserved_data_blocks,
908 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
909);
910
911TRACE_EVENT(ext4_da_reserve_space,
912 TP_PROTO(struct inode *inode, int md_needed),
913
914 TP_ARGS(inode, md_needed),
915
916 TP_STRUCT__entry(
917 __field( dev_t, dev )
918 __field( ino_t, ino )
919 __field( umode_t, mode )
920 __field( __u64, i_blocks )
921 __field( int, md_needed )
922 __field( int, reserved_data_blocks )
923 __field( int, reserved_meta_blocks )
924 ),
925
926 TP_fast_assign(
927 __entry->dev = inode->i_sb->s_dev;
928 __entry->ino = inode->i_ino;
929 __entry->mode = inode->i_mode;
930 __entry->i_blocks = inode->i_blocks;
931 __entry->md_needed = md_needed;
932 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
933 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
934 ),
935
936 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d",
937 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
938 __entry->mode, (unsigned long long) __entry->i_blocks,
939 __entry->md_needed, __entry->reserved_data_blocks,
940 __entry->reserved_meta_blocks)
941);
942
943TRACE_EVENT(ext4_da_release_space,
944 TP_PROTO(struct inode *inode, int freed_blocks),
945
946 TP_ARGS(inode, freed_blocks),
947
948 TP_STRUCT__entry(
949 __field( dev_t, dev )
950 __field( ino_t, ino )
951 __field( umode_t, mode )
952 __field( __u64, i_blocks )
953 __field( int, freed_blocks )
954 __field( int, reserved_data_blocks )
955 __field( int, reserved_meta_blocks )
956 __field( int, allocated_meta_blocks )
957 ),
958
959 TP_fast_assign(
960 __entry->dev = inode->i_sb->s_dev;
961 __entry->ino = inode->i_ino;
962 __entry->mode = inode->i_mode;
963 __entry->i_blocks = inode->i_blocks;
964 __entry->freed_blocks = freed_blocks;
965 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
966 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
967 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
968 ),
969
970 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
971 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
972 __entry->mode, (unsigned long long) __entry->i_blocks,
973 __entry->freed_blocks, __entry->reserved_data_blocks,
974 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
975);
976
977
877#endif /* _TRACE_EXT4_H */ 978#endif /* _TRACE_EXT4_H */
878 979
879/* This part must be outside protection */ 980/* This part must be outside protection */