diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-19 18:59:33 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-22 08:58:17 -0400 |
commit | f4ce1299b329e96bb247c95c4fee8809827d6931 (patch) | |
tree | b4056d4f78b0594f84c8e4b3beda565a05751993 /fs/nfs | |
parent | 1264a2f053a32376696e51184f086d35113e75ff (diff) |
NFS: Add event tracing for generic NFS events
Add tracepoints for inode attribute updates, attribute revalidation,
writeback start/end fsync start/end, attribute change start/end,
permission check start/end.
The intention is to enable performance tracing using 'perf'as well as
improving debugging.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/Makefile | 3 | ||||
-rw-r--r-- | fs/nfs/dir.c | 16 | ||||
-rw-r--r-- | fs/nfs/file.c | 5 | ||||
-rw-r--r-- | fs/nfs/inode.c | 29 | ||||
-rw-r--r-- | fs/nfs/nfstrace.c | 8 | ||||
-rw-r--r-- | fs/nfs/nfstrace.h | 166 | ||||
-rw-r--r-- | fs/nfs/write.c | 15 |
7 files changed, 231 insertions, 11 deletions
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile index e0bb048e9576..6bd483bde346 100644 --- a/fs/nfs/Makefile +++ b/fs/nfs/Makefile | |||
@@ -4,9 +4,10 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_NFS_FS) += nfs.o | 5 | obj-$(CONFIG_NFS_FS) += nfs.o |
6 | 6 | ||
7 | CFLAGS_nfstrace.o += -I$(src) | ||
7 | nfs-y := client.o dir.o file.o getroot.o inode.o super.o \ | 8 | nfs-y := client.o dir.o file.o getroot.o inode.o super.o \ |
8 | direct.o pagelist.o read.o symlink.o unlink.o \ | 9 | direct.o pagelist.o read.o symlink.o unlink.o \ |
9 | write.o namespace.o mount_clnt.o | 10 | write.o namespace.o mount_clnt.o nfstrace.o |
10 | nfs-$(CONFIG_ROOT_NFS) += nfsroot.o | 11 | nfs-$(CONFIG_ROOT_NFS) += nfsroot.o |
11 | nfs-$(CONFIG_SYSCTL) += sysctl.o | 12 | nfs-$(CONFIG_SYSCTL) += sysctl.o |
12 | nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o | 13 | nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 5d737bd52288..be3da6fe3ad4 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include "internal.h" | 43 | #include "internal.h" |
44 | #include "fscache.h" | 44 | #include "fscache.h" |
45 | 45 | ||
46 | #include "nfstrace.h" | ||
47 | |||
46 | /* #define NFS_DEBUG_VERBOSE 1 */ | 48 | /* #define NFS_DEBUG_VERBOSE 1 */ |
47 | 49 | ||
48 | static int nfs_opendir(struct inode *, struct file *); | 50 | static int nfs_opendir(struct inode *, struct file *); |
@@ -2178,9 +2180,11 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) | |||
2178 | struct nfs_access_entry cache; | 2180 | struct nfs_access_entry cache; |
2179 | int status; | 2181 | int status; |
2180 | 2182 | ||
2183 | trace_nfs_access_enter(inode); | ||
2184 | |||
2181 | status = nfs_access_get_cached(inode, cred, &cache); | 2185 | status = nfs_access_get_cached(inode, cred, &cache); |
2182 | if (status == 0) | 2186 | if (status == 0) |
2183 | goto out; | 2187 | goto out_cached; |
2184 | 2188 | ||
2185 | /* Be clever: ask server to check for all possible rights */ | 2189 | /* Be clever: ask server to check for all possible rights */ |
2186 | cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ; | 2190 | cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ; |
@@ -2193,13 +2197,15 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) | |||
2193 | if (!S_ISDIR(inode->i_mode)) | 2197 | if (!S_ISDIR(inode->i_mode)) |
2194 | set_bit(NFS_INO_STALE, &NFS_I(inode)->flags); | 2198 | set_bit(NFS_INO_STALE, &NFS_I(inode)->flags); |
2195 | } | 2199 | } |
2196 | return status; | 2200 | goto out; |
2197 | } | 2201 | } |
2198 | nfs_access_add_cache(inode, &cache); | 2202 | nfs_access_add_cache(inode, &cache); |
2203 | out_cached: | ||
2204 | if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0) | ||
2205 | status = -EACCES; | ||
2199 | out: | 2206 | out: |
2200 | if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) | 2207 | trace_nfs_access_exit(inode, status); |
2201 | return 0; | 2208 | return status; |
2202 | return -EACCES; | ||
2203 | } | 2209 | } |
2204 | 2210 | ||
2205 | static int nfs_open_permission_mask(int openflags) | 2211 | static int nfs_open_permission_mask(int openflags) |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 94e94bd11aae..d6a9db0a8545 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include "iostat.h" | 37 | #include "iostat.h" |
38 | #include "fscache.h" | 38 | #include "fscache.h" |
39 | 39 | ||
40 | #include "nfstrace.h" | ||
41 | |||
40 | #define NFSDBG_FACILITY NFSDBG_FILE | 42 | #define NFSDBG_FACILITY NFSDBG_FILE |
41 | 43 | ||
42 | static const struct vm_operations_struct nfs_file_vm_ops; | 44 | static const struct vm_operations_struct nfs_file_vm_ops; |
@@ -294,6 +296,8 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
294 | int ret; | 296 | int ret; |
295 | struct inode *inode = file_inode(file); | 297 | struct inode *inode = file_inode(file); |
296 | 298 | ||
299 | trace_nfs_fsync_enter(inode); | ||
300 | |||
297 | do { | 301 | do { |
298 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 302 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
299 | if (ret != 0) | 303 | if (ret != 0) |
@@ -310,6 +314,7 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
310 | end = LLONG_MAX; | 314 | end = LLONG_MAX; |
311 | } while (ret == -EAGAIN); | 315 | } while (ret == -EAGAIN); |
312 | 316 | ||
317 | trace_nfs_fsync_exit(inode, ret); | ||
313 | return ret; | 318 | return ret; |
314 | } | 319 | } |
315 | 320 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 9a98b04c4445..4bcb00ae30ae 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -51,6 +51,8 @@ | |||
51 | #include "nfs.h" | 51 | #include "nfs.h" |
52 | #include "netns.h" | 52 | #include "netns.h" |
53 | 53 | ||
54 | #include "nfstrace.h" | ||
55 | |||
54 | #define NFSDBG_FACILITY NFSDBG_VFS | 56 | #define NFSDBG_FACILITY NFSDBG_VFS |
55 | 57 | ||
56 | #define NFS_64_BIT_INODE_NUMBERS_ENABLED 1 | 58 | #define NFS_64_BIT_INODE_NUMBERS_ENABLED 1 |
@@ -503,6 +505,8 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
503 | if ((attr->ia_valid & ~(ATTR_FILE|ATTR_OPEN)) == 0) | 505 | if ((attr->ia_valid & ~(ATTR_FILE|ATTR_OPEN)) == 0) |
504 | return 0; | 506 | return 0; |
505 | 507 | ||
508 | trace_nfs_setattr_enter(inode); | ||
509 | |||
506 | /* Write all dirty data */ | 510 | /* Write all dirty data */ |
507 | if (S_ISREG(inode->i_mode)) { | 511 | if (S_ISREG(inode->i_mode)) { |
508 | nfs_inode_dio_wait(inode); | 512 | nfs_inode_dio_wait(inode); |
@@ -522,6 +526,7 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
522 | error = nfs_refresh_inode(inode, fattr); | 526 | error = nfs_refresh_inode(inode, fattr); |
523 | nfs_free_fattr(fattr); | 527 | nfs_free_fattr(fattr); |
524 | out: | 528 | out: |
529 | trace_nfs_setattr_exit(inode, error); | ||
525 | return error; | 530 | return error; |
526 | } | 531 | } |
527 | EXPORT_SYMBOL_GPL(nfs_setattr); | 532 | EXPORT_SYMBOL_GPL(nfs_setattr); |
@@ -591,6 +596,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
591 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; | 596 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; |
592 | int err; | 597 | int err; |
593 | 598 | ||
599 | trace_nfs_getattr_enter(inode); | ||
594 | /* Flush out writes to the server in order to update c/mtime. */ | 600 | /* Flush out writes to the server in order to update c/mtime. */ |
595 | if (S_ISREG(inode->i_mode)) { | 601 | if (S_ISREG(inode->i_mode)) { |
596 | nfs_inode_dio_wait(inode); | 602 | nfs_inode_dio_wait(inode); |
@@ -621,6 +627,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
621 | stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); | 627 | stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); |
622 | } | 628 | } |
623 | out: | 629 | out: |
630 | trace_nfs_getattr_exit(inode, err); | ||
624 | return err; | 631 | return err; |
625 | } | 632 | } |
626 | EXPORT_SYMBOL_GPL(nfs_getattr); | 633 | EXPORT_SYMBOL_GPL(nfs_getattr); |
@@ -875,6 +882,8 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
875 | dfprintk(PAGECACHE, "NFS: revalidating (%s/%Ld)\n", | 882 | dfprintk(PAGECACHE, "NFS: revalidating (%s/%Ld)\n", |
876 | inode->i_sb->s_id, (long long)NFS_FILEID(inode)); | 883 | inode->i_sb->s_id, (long long)NFS_FILEID(inode)); |
877 | 884 | ||
885 | trace_nfs_revalidate_inode_enter(inode); | ||
886 | |||
878 | if (is_bad_inode(inode)) | 887 | if (is_bad_inode(inode)) |
879 | goto out; | 888 | goto out; |
880 | if (NFS_STALE(inode)) | 889 | if (NFS_STALE(inode)) |
@@ -925,6 +934,7 @@ err_out: | |||
925 | nfs4_label_free(label); | 934 | nfs4_label_free(label); |
926 | out: | 935 | out: |
927 | nfs_free_fattr(fattr); | 936 | nfs_free_fattr(fattr); |
937 | trace_nfs_revalidate_inode_exit(inode, status); | ||
928 | return status; | 938 | return status; |
929 | } | 939 | } |
930 | 940 | ||
@@ -975,6 +985,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map | |||
975 | spin_unlock(&inode->i_lock); | 985 | spin_unlock(&inode->i_lock); |
976 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | 986 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); |
977 | nfs_fscache_wait_on_invalidate(inode); | 987 | nfs_fscache_wait_on_invalidate(inode); |
988 | |||
978 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", | 989 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", |
979 | inode->i_sb->s_id, (long long)NFS_FILEID(inode)); | 990 | inode->i_sb->s_id, (long long)NFS_FILEID(inode)); |
980 | return 0; | 991 | return 0; |
@@ -1008,8 +1019,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
1008 | if (ret < 0) | 1019 | if (ret < 0) |
1009 | goto out; | 1020 | goto out; |
1010 | } | 1021 | } |
1011 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | 1022 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { |
1023 | trace_nfs_invalidate_mapping_enter(inode); | ||
1012 | ret = nfs_invalidate_mapping(inode, mapping); | 1024 | ret = nfs_invalidate_mapping(inode, mapping); |
1025 | trace_nfs_invalidate_mapping_exit(inode, ret); | ||
1026 | } | ||
1027 | |||
1013 | out: | 1028 | out: |
1014 | return ret; | 1029 | return ret; |
1015 | } | 1030 | } |
@@ -1268,9 +1283,17 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n | |||
1268 | 1283 | ||
1269 | static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr) | 1284 | static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr) |
1270 | { | 1285 | { |
1286 | int ret; | ||
1287 | |||
1288 | trace_nfs_refresh_inode_enter(inode); | ||
1289 | |||
1271 | if (nfs_inode_attrs_need_update(inode, fattr)) | 1290 | if (nfs_inode_attrs_need_update(inode, fattr)) |
1272 | return nfs_update_inode(inode, fattr); | 1291 | ret = nfs_update_inode(inode, fattr); |
1273 | return nfs_check_inode_attributes(inode, fattr); | 1292 | else |
1293 | ret = nfs_check_inode_attributes(inode, fattr); | ||
1294 | |||
1295 | trace_nfs_refresh_inode_exit(inode, ret); | ||
1296 | return ret; | ||
1274 | } | 1297 | } |
1275 | 1298 | ||
1276 | /** | 1299 | /** |
diff --git a/fs/nfs/nfstrace.c b/fs/nfs/nfstrace.c new file mode 100644 index 000000000000..cc9146134848 --- /dev/null +++ b/fs/nfs/nfstrace.c | |||
@@ -0,0 +1,8 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com> | ||
3 | */ | ||
4 | #include <linux/nfs_fs.h> | ||
5 | #include "internal.h" | ||
6 | |||
7 | #define CREATE_TRACE_POINTS | ||
8 | #include "nfstrace.h" | ||
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h new file mode 100644 index 000000000000..73c8e1edeef4 --- /dev/null +++ b/fs/nfs/nfstrace.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com> | ||
3 | */ | ||
4 | #undef TRACE_SYSTEM | ||
5 | #define TRACE_SYSTEM nfs | ||
6 | |||
7 | #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ) | ||
8 | #define _TRACE_NFS_H | ||
9 | |||
10 | #include <linux/tracepoint.h> | ||
11 | |||
12 | #define nfs_show_file_type(ftype) \ | ||
13 | __print_symbolic(ftype, \ | ||
14 | { DT_UNKNOWN, "UNKNOWN" }, \ | ||
15 | { DT_FIFO, "FIFO" }, \ | ||
16 | { DT_CHR, "CHR" }, \ | ||
17 | { DT_DIR, "DIR" }, \ | ||
18 | { DT_BLK, "BLK" }, \ | ||
19 | { DT_REG, "REG" }, \ | ||
20 | { DT_LNK, "LNK" }, \ | ||
21 | { DT_SOCK, "SOCK" }, \ | ||
22 | { DT_WHT, "WHT" }) | ||
23 | |||
24 | #define nfs_show_cache_validity(v) \ | ||
25 | __print_flags(v, "|", \ | ||
26 | { NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \ | ||
27 | { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \ | ||
28 | { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \ | ||
29 | { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \ | ||
30 | { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \ | ||
31 | { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \ | ||
32 | { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \ | ||
33 | { NFS_INO_INVALID_LABEL, "INVALID_LABEL" }) | ||
34 | |||
35 | #define nfs_show_nfsi_flags(v) \ | ||
36 | __print_flags(v, "|", \ | ||
37 | { 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \ | ||
38 | { 1 << NFS_INO_STALE, "STALE" }, \ | ||
39 | { 1 << NFS_INO_FLUSHING, "FLUSHING" }, \ | ||
40 | { 1 << NFS_INO_FSCACHE, "FSCACHE" }, \ | ||
41 | { 1 << NFS_INO_COMMIT, "COMMIT" }, \ | ||
42 | { 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \ | ||
43 | { 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" }) | ||
44 | |||
45 | DECLARE_EVENT_CLASS(nfs_inode_event, | ||
46 | TP_PROTO( | ||
47 | const struct inode *inode | ||
48 | ), | ||
49 | |||
50 | TP_ARGS(inode), | ||
51 | |||
52 | TP_STRUCT__entry( | ||
53 | __field(dev_t, dev) | ||
54 | __field(u32, fhandle) | ||
55 | __field(u64, fileid) | ||
56 | __field(u64, version) | ||
57 | ), | ||
58 | |||
59 | TP_fast_assign( | ||
60 | const struct nfs_inode *nfsi = NFS_I(inode); | ||
61 | __entry->dev = inode->i_sb->s_dev; | ||
62 | __entry->fileid = nfsi->fileid; | ||
63 | __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); | ||
64 | __entry->version = inode->i_version; | ||
65 | ), | ||
66 | |||
67 | TP_printk( | ||
68 | "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ", | ||
69 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
70 | (unsigned long long)__entry->fileid, | ||
71 | __entry->fhandle, | ||
72 | (unsigned long long)__entry->version | ||
73 | ) | ||
74 | ); | ||
75 | |||
76 | DECLARE_EVENT_CLASS(nfs_inode_event_done, | ||
77 | TP_PROTO( | ||
78 | const struct inode *inode, | ||
79 | int error | ||
80 | ), | ||
81 | |||
82 | TP_ARGS(inode, error), | ||
83 | |||
84 | TP_STRUCT__entry( | ||
85 | __field(int, error) | ||
86 | __field(dev_t, dev) | ||
87 | __field(u32, fhandle) | ||
88 | __field(unsigned char, type) | ||
89 | __field(u64, fileid) | ||
90 | __field(u64, version) | ||
91 | __field(loff_t, size) | ||
92 | __field(unsigned long, nfsi_flags) | ||
93 | __field(unsigned long, cache_validity) | ||
94 | ), | ||
95 | |||
96 | TP_fast_assign( | ||
97 | const struct nfs_inode *nfsi = NFS_I(inode); | ||
98 | __entry->error = error; | ||
99 | __entry->dev = inode->i_sb->s_dev; | ||
100 | __entry->fileid = nfsi->fileid; | ||
101 | __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); | ||
102 | __entry->type = nfs_umode_to_dtype(inode->i_mode); | ||
103 | __entry->version = inode->i_version; | ||
104 | __entry->size = i_size_read(inode); | ||
105 | __entry->nfsi_flags = nfsi->flags; | ||
106 | __entry->cache_validity = nfsi->cache_validity; | ||
107 | ), | ||
108 | |||
109 | TP_printk( | ||
110 | "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " | ||
111 | "type=%u (%s) version=%llu size=%lld " | ||
112 | "cache_validity=%lu (%s) nfs_flags=%ld (%s)", | ||
113 | __entry->error, | ||
114 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
115 | (unsigned long long)__entry->fileid, | ||
116 | __entry->fhandle, | ||
117 | __entry->type, | ||
118 | nfs_show_file_type(__entry->type), | ||
119 | (unsigned long long)__entry->version, | ||
120 | (long long)__entry->size, | ||
121 | __entry->cache_validity, | ||
122 | nfs_show_cache_validity(__entry->cache_validity), | ||
123 | __entry->nfsi_flags, | ||
124 | nfs_show_nfsi_flags(__entry->nfsi_flags) | ||
125 | ) | ||
126 | ); | ||
127 | |||
128 | #define DEFINE_NFS_INODE_EVENT(name) \ | ||
129 | DEFINE_EVENT(nfs_inode_event, name, \ | ||
130 | TP_PROTO( \ | ||
131 | const struct inode *inode \ | ||
132 | ), \ | ||
133 | TP_ARGS(inode)) | ||
134 | #define DEFINE_NFS_INODE_EVENT_DONE(name) \ | ||
135 | DEFINE_EVENT(nfs_inode_event_done, name, \ | ||
136 | TP_PROTO( \ | ||
137 | const struct inode *inode, \ | ||
138 | int error \ | ||
139 | ), \ | ||
140 | TP_ARGS(inode, error)) | ||
141 | DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter); | ||
142 | DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit); | ||
143 | DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter); | ||
144 | DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit); | ||
145 | DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter); | ||
146 | DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit); | ||
147 | DEFINE_NFS_INODE_EVENT(nfs_getattr_enter); | ||
148 | DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit); | ||
149 | DEFINE_NFS_INODE_EVENT(nfs_setattr_enter); | ||
150 | DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit); | ||
151 | DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter); | ||
152 | DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit); | ||
153 | DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter); | ||
154 | DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit); | ||
155 | DEFINE_NFS_INODE_EVENT(nfs_fsync_enter); | ||
156 | DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit); | ||
157 | DEFINE_NFS_INODE_EVENT(nfs_access_enter); | ||
158 | DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit); | ||
159 | |||
160 | #endif /* _TRACE_NFS_H */ | ||
161 | |||
162 | #undef TRACE_INCLUDE_PATH | ||
163 | #define TRACE_INCLUDE_PATH . | ||
164 | #define TRACE_INCLUDE_FILE nfstrace | ||
165 | /* This part must be outside protection */ | ||
166 | #include <trace/define_trace.h> | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index f1bdb7254776..d37e8ca9ab86 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "fscache.h" | 31 | #include "fscache.h" |
32 | #include "pnfs.h" | 32 | #include "pnfs.h" |
33 | 33 | ||
34 | #include "nfstrace.h" | ||
35 | |||
34 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE | 36 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE |
35 | 37 | ||
36 | #define MIN_POOL_WRITE (32) | 38 | #define MIN_POOL_WRITE (32) |
@@ -1732,8 +1734,14 @@ int nfs_wb_all(struct inode *inode) | |||
1732 | .range_start = 0, | 1734 | .range_start = 0, |
1733 | .range_end = LLONG_MAX, | 1735 | .range_end = LLONG_MAX, |
1734 | }; | 1736 | }; |
1737 | int ret; | ||
1738 | |||
1739 | trace_nfs_writeback_inode_enter(inode); | ||
1740 | |||
1741 | ret = sync_inode(inode, &wbc); | ||
1735 | 1742 | ||
1736 | return sync_inode(inode, &wbc); | 1743 | trace_nfs_writeback_inode_exit(inode, ret); |
1744 | return ret; | ||
1737 | } | 1745 | } |
1738 | EXPORT_SYMBOL_GPL(nfs_wb_all); | 1746 | EXPORT_SYMBOL_GPL(nfs_wb_all); |
1739 | 1747 | ||
@@ -1781,6 +1789,8 @@ int nfs_wb_page(struct inode *inode, struct page *page) | |||
1781 | }; | 1789 | }; |
1782 | int ret; | 1790 | int ret; |
1783 | 1791 | ||
1792 | trace_nfs_writeback_page_enter(inode); | ||
1793 | |||
1784 | for (;;) { | 1794 | for (;;) { |
1785 | wait_on_page_writeback(page); | 1795 | wait_on_page_writeback(page); |
1786 | if (clear_page_dirty_for_io(page)) { | 1796 | if (clear_page_dirty_for_io(page)) { |
@@ -1789,14 +1799,15 @@ int nfs_wb_page(struct inode *inode, struct page *page) | |||
1789 | goto out_error; | 1799 | goto out_error; |
1790 | continue; | 1800 | continue; |
1791 | } | 1801 | } |
1802 | ret = 0; | ||
1792 | if (!PagePrivate(page)) | 1803 | if (!PagePrivate(page)) |
1793 | break; | 1804 | break; |
1794 | ret = nfs_commit_inode(inode, FLUSH_SYNC); | 1805 | ret = nfs_commit_inode(inode, FLUSH_SYNC); |
1795 | if (ret < 0) | 1806 | if (ret < 0) |
1796 | goto out_error; | 1807 | goto out_error; |
1797 | } | 1808 | } |
1798 | return 0; | ||
1799 | out_error: | 1809 | out_error: |
1810 | trace_nfs_writeback_page_exit(inode, ret); | ||
1800 | return ret; | 1811 | return ret; |
1801 | } | 1812 | } |
1802 | 1813 | ||