Commit cc668ab30b8a5505c1651b073882c1a67c802a48
1 parent
b5f875a925
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
NFSv4: Add tracepoints for debugging reads and writes
Set up tracepoints to track read, write and commit, as well as pNFS reads and writes and commits to the data server. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 5 changed files with 169 additions and 0 deletions Side-by-side Diff
fs/nfs/nfs4filelayout.c
... | ... | @@ -39,6 +39,7 @@ |
39 | 39 | #include "internal.h" |
40 | 40 | #include "delegation.h" |
41 | 41 | #include "nfs4filelayout.h" |
42 | +#include "nfs4trace.h" | |
42 | 43 | |
43 | 44 | #define NFSDBG_FACILITY NFSDBG_PNFS_LD |
44 | 45 | |
... | ... | @@ -247,6 +248,7 @@ |
247 | 248 | struct nfs_pgio_header *hdr = data->header; |
248 | 249 | int err; |
249 | 250 | |
251 | + trace_nfs4_pnfs_read(data, task->tk_status); | |
250 | 252 | err = filelayout_async_handle_error(task, data->args.context->state, |
251 | 253 | data->ds_clp, hdr->lseg); |
252 | 254 | |
... | ... | @@ -363,6 +365,7 @@ |
363 | 365 | struct nfs_pgio_header *hdr = data->header; |
364 | 366 | int err; |
365 | 367 | |
368 | + trace_nfs4_pnfs_write(data, task->tk_status); | |
366 | 369 | err = filelayout_async_handle_error(task, data->args.context->state, |
367 | 370 | data->ds_clp, hdr->lseg); |
368 | 371 | |
... | ... | @@ -395,6 +398,7 @@ |
395 | 398 | { |
396 | 399 | int err; |
397 | 400 | |
401 | + trace_nfs4_pnfs_commit_ds(data, task->tk_status); | |
398 | 402 | err = filelayout_async_handle_error(task, NULL, data->ds_clp, |
399 | 403 | data->lseg); |
400 | 404 |
fs/nfs/nfs4proc.c
... | ... | @@ -3881,6 +3881,7 @@ |
3881 | 3881 | { |
3882 | 3882 | struct nfs_server *server = NFS_SERVER(data->header->inode); |
3883 | 3883 | |
3884 | + trace_nfs4_read(data, task->tk_status); | |
3884 | 3885 | if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { |
3885 | 3886 | rpc_restart_call_prepare(task); |
3886 | 3887 | return -EAGAIN; |
... | ... | @@ -3942,6 +3943,7 @@ |
3942 | 3943 | { |
3943 | 3944 | struct inode *inode = data->header->inode; |
3944 | 3945 | |
3946 | + trace_nfs4_write(data, task->tk_status); | |
3945 | 3947 | if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) { |
3946 | 3948 | rpc_restart_call_prepare(task); |
3947 | 3949 | return -EAGAIN; |
... | ... | @@ -4033,6 +4035,7 @@ |
4033 | 4035 | { |
4034 | 4036 | struct inode *inode = data->inode; |
4035 | 4037 | |
4038 | + trace_nfs4_commit(data, task->tk_status); | |
4036 | 4039 | if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL) == -EAGAIN) { |
4037 | 4040 | rpc_restart_call_prepare(task); |
4038 | 4041 | return -EAGAIN; |
fs/nfs/nfs4trace.c
fs/nfs/nfs4trace.h
... | ... | @@ -742,6 +742,160 @@ |
742 | 742 | DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name); |
743 | 743 | DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group); |
744 | 744 | |
745 | +DECLARE_EVENT_CLASS(nfs4_read_event, | |
746 | + TP_PROTO( | |
747 | + const struct nfs_read_data *data, | |
748 | + int error | |
749 | + ), | |
750 | + | |
751 | + TP_ARGS(data, error), | |
752 | + | |
753 | + TP_STRUCT__entry( | |
754 | + __field(dev_t, dev) | |
755 | + __field(u32, fhandle) | |
756 | + __field(u64, fileid) | |
757 | + __field(loff_t, offset) | |
758 | + __field(size_t, count) | |
759 | + __field(int, error) | |
760 | + ), | |
761 | + | |
762 | + TP_fast_assign( | |
763 | + const struct inode *inode = data->header->inode; | |
764 | + __entry->dev = inode->i_sb->s_dev; | |
765 | + __entry->fileid = NFS_FILEID(inode); | |
766 | + __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); | |
767 | + __entry->offset = data->args.offset; | |
768 | + __entry->count = data->args.count; | |
769 | + __entry->error = error; | |
770 | + ), | |
771 | + | |
772 | + TP_printk( | |
773 | + "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " | |
774 | + "offset=%lld count=%zu", | |
775 | + __entry->error, | |
776 | + show_nfsv4_errors(__entry->error), | |
777 | + MAJOR(__entry->dev), MINOR(__entry->dev), | |
778 | + (unsigned long long)__entry->fileid, | |
779 | + __entry->fhandle, | |
780 | + (long long)__entry->offset, | |
781 | + __entry->count | |
782 | + ) | |
783 | +); | |
784 | +#define DEFINE_NFS4_READ_EVENT(name) \ | |
785 | + DEFINE_EVENT(nfs4_read_event, name, \ | |
786 | + TP_PROTO( \ | |
787 | + const struct nfs_read_data *data, \ | |
788 | + int error \ | |
789 | + ), \ | |
790 | + TP_ARGS(data, error)) | |
791 | +DEFINE_NFS4_READ_EVENT(nfs4_read); | |
792 | +#ifdef CONFIG_NFS_V4_1 | |
793 | +DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read); | |
794 | +#endif /* CONFIG_NFS_V4_1 */ | |
795 | + | |
796 | +DECLARE_EVENT_CLASS(nfs4_write_event, | |
797 | + TP_PROTO( | |
798 | + const struct nfs_write_data *data, | |
799 | + int error | |
800 | + ), | |
801 | + | |
802 | + TP_ARGS(data, error), | |
803 | + | |
804 | + TP_STRUCT__entry( | |
805 | + __field(dev_t, dev) | |
806 | + __field(u32, fhandle) | |
807 | + __field(u64, fileid) | |
808 | + __field(loff_t, offset) | |
809 | + __field(size_t, count) | |
810 | + __field(int, error) | |
811 | + ), | |
812 | + | |
813 | + TP_fast_assign( | |
814 | + const struct inode *inode = data->header->inode; | |
815 | + __entry->dev = inode->i_sb->s_dev; | |
816 | + __entry->fileid = NFS_FILEID(inode); | |
817 | + __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); | |
818 | + __entry->offset = data->args.offset; | |
819 | + __entry->count = data->args.count; | |
820 | + __entry->error = error; | |
821 | + ), | |
822 | + | |
823 | + TP_printk( | |
824 | + "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " | |
825 | + "offset=%lld count=%zu", | |
826 | + __entry->error, | |
827 | + show_nfsv4_errors(__entry->error), | |
828 | + MAJOR(__entry->dev), MINOR(__entry->dev), | |
829 | + (unsigned long long)__entry->fileid, | |
830 | + __entry->fhandle, | |
831 | + (long long)__entry->offset, | |
832 | + __entry->count | |
833 | + ) | |
834 | +); | |
835 | + | |
836 | +#define DEFINE_NFS4_WRITE_EVENT(name) \ | |
837 | + DEFINE_EVENT(nfs4_write_event, name, \ | |
838 | + TP_PROTO( \ | |
839 | + const struct nfs_write_data *data, \ | |
840 | + int error \ | |
841 | + ), \ | |
842 | + TP_ARGS(data, error)) | |
843 | +DEFINE_NFS4_WRITE_EVENT(nfs4_write); | |
844 | +#ifdef CONFIG_NFS_V4_1 | |
845 | +DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write); | |
846 | +#endif /* CONFIG_NFS_V4_1 */ | |
847 | + | |
848 | +DECLARE_EVENT_CLASS(nfs4_commit_event, | |
849 | + TP_PROTO( | |
850 | + const struct nfs_commit_data *data, | |
851 | + int error | |
852 | + ), | |
853 | + | |
854 | + TP_ARGS(data, error), | |
855 | + | |
856 | + TP_STRUCT__entry( | |
857 | + __field(dev_t, dev) | |
858 | + __field(u32, fhandle) | |
859 | + __field(u64, fileid) | |
860 | + __field(loff_t, offset) | |
861 | + __field(size_t, count) | |
862 | + __field(int, error) | |
863 | + ), | |
864 | + | |
865 | + TP_fast_assign( | |
866 | + const struct inode *inode = data->inode; | |
867 | + __entry->dev = inode->i_sb->s_dev; | |
868 | + __entry->fileid = NFS_FILEID(inode); | |
869 | + __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); | |
870 | + __entry->offset = data->args.offset; | |
871 | + __entry->count = data->args.count; | |
872 | + __entry->error = error; | |
873 | + ), | |
874 | + | |
875 | + TP_printk( | |
876 | + "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " | |
877 | + "offset=%lld count=%zu", | |
878 | + __entry->error, | |
879 | + show_nfsv4_errors(__entry->error), | |
880 | + MAJOR(__entry->dev), MINOR(__entry->dev), | |
881 | + (unsigned long long)__entry->fileid, | |
882 | + __entry->fhandle, | |
883 | + (long long)__entry->offset, | |
884 | + __entry->count | |
885 | + ) | |
886 | +); | |
887 | +#define DEFINE_NFS4_COMMIT_EVENT(name) \ | |
888 | + DEFINE_EVENT(nfs4_commit_event, name, \ | |
889 | + TP_PROTO( \ | |
890 | + const struct nfs_commit_data *data, \ | |
891 | + int error \ | |
892 | + ), \ | |
893 | + TP_ARGS(data, error)) | |
894 | +DEFINE_NFS4_COMMIT_EVENT(nfs4_commit); | |
895 | +#ifdef CONFIG_NFS_V4_1 | |
896 | +DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds); | |
897 | +#endif /* CONFIG_NFS_V4_1 */ | |
898 | + | |
745 | 899 | #endif /* _TRACE_NFS4_H */ |
746 | 900 | |
747 | 901 | #undef TRACE_INCLUDE_PATH |
fs/nfs/pnfs.c
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | #include "internal.h" |
34 | 34 | #include "pnfs.h" |
35 | 35 | #include "iostat.h" |
36 | +#include "nfs4trace.h" | |
36 | 37 | |
37 | 38 | #define NFSDBG_FACILITY NFSDBG_PNFS |
38 | 39 | #define PNFS_LAYOUTGET_RETRY_TIMEOUT (120*HZ) |
... | ... | @@ -1526,6 +1527,7 @@ |
1526 | 1527 | { |
1527 | 1528 | struct nfs_pgio_header *hdr = data->header; |
1528 | 1529 | |
1530 | + trace_nfs4_pnfs_write(data, hdr->pnfs_error); | |
1529 | 1531 | if (!hdr->pnfs_error) { |
1530 | 1532 | pnfs_set_layoutcommit(data); |
1531 | 1533 | hdr->mds_ops->rpc_call_done(&data->task, data); |
... | ... | @@ -1680,6 +1682,7 @@ |
1680 | 1682 | { |
1681 | 1683 | struct nfs_pgio_header *hdr = data->header; |
1682 | 1684 | |
1685 | + trace_nfs4_pnfs_read(data, hdr->pnfs_error); | |
1683 | 1686 | if (likely(!hdr->pnfs_error)) { |
1684 | 1687 | __nfs4_read_done_cb(data); |
1685 | 1688 | hdr->mds_ops->rpc_call_done(&data->task, data); |