Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFS: Replace dfprintks with tracepoints in fscache read and write page functions

Most of fscache and other NFS IO paths are now using tracepoints.
Remove the dfprintks in the NFS fscache read/write page functions
and replace with tracepoints at the begin and end of the functions.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Dave Wysochanski and committed by
Trond Myklebust
e3f0a7fe fc1c5abf

+102 -18
+11 -18
fs/nfs/fscache.c
··· 19 19 #include "internal.h" 20 20 #include "iostat.h" 21 21 #include "fscache.h" 22 + #include "nfstrace.h" 22 23 23 24 #define NFSDBG_FACILITY NFSDBG_FSCACHE 24 25 ··· 322 321 { 323 322 int ret; 324 323 325 - dfprintk(FSCACHE, 326 - "NFS: readpage_from_fscache(fsc:%p/p:%p(i:%lx f:%lx)/0x%p)\n", 327 - nfs_i_fscache(inode), page, page->index, page->flags, inode); 328 - 324 + trace_nfs_fscache_read_page(inode, page); 329 325 if (PageChecked(page)) { 330 - dfprintk(FSCACHE, "NFS: readpage_from_fscache: PageChecked\n"); 331 326 ClearPageChecked(page); 332 - return 1; 327 + ret = 1; 328 + goto out; 333 329 } 334 330 335 331 ret = fscache_fallback_read_page(inode, page); 336 332 if (ret < 0) { 337 333 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL); 338 - dfprintk(FSCACHE, 339 - "NFS: readpage_from_fscache failed %d\n", ret); 340 334 SetPageChecked(page); 341 - return ret; 335 + goto out; 342 336 } 343 337 344 338 /* Read completed synchronously */ 345 - dfprintk(FSCACHE, "NFS: readpage_from_fscache: read successful\n"); 346 339 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK); 347 340 SetPageUptodate(page); 348 - return 0; 341 + ret = 0; 342 + out: 343 + trace_nfs_fscache_read_page_exit(inode, page, ret); 344 + return ret; 349 345 } 350 346 351 347 /* ··· 353 355 { 354 356 int ret; 355 357 356 - dfprintk(FSCACHE, 357 - "NFS: readpage_to_fscache(fsc:%p/p:%p(i:%lx f:%lx))\n", 358 - nfs_i_fscache(inode), page, page->index, page->flags); 358 + trace_nfs_fscache_write_page(inode, page); 359 359 360 360 ret = fscache_fallback_write_page(inode, page, true); 361 - 362 - dfprintk(FSCACHE, 363 - "NFS: nfs_fscache_write_page: p:%p(i:%lu f:%lx) ret %d\n", 364 - page, page->index, page->flags, ret); 365 361 366 362 if (ret != 0) { 367 363 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL); ··· 363 371 } else { 364 372 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_WRITTEN_OK); 365 373 } 374 + trace_nfs_fscache_write_page_exit(inode, page, ret); 366 375 }
+91
fs/nfs/nfstrace.h
··· 1215 1215 ) 1216 1216 ); 1217 1217 1218 + DECLARE_EVENT_CLASS(nfs_fscache_page_event, 1219 + TP_PROTO( 1220 + const struct inode *inode, 1221 + struct page *page 1222 + ), 1223 + 1224 + TP_ARGS(inode, page), 1225 + 1226 + TP_STRUCT__entry( 1227 + __field(dev_t, dev) 1228 + __field(u32, fhandle) 1229 + __field(u64, fileid) 1230 + __field(loff_t, offset) 1231 + ), 1232 + 1233 + TP_fast_assign( 1234 + const struct nfs_inode *nfsi = NFS_I(inode); 1235 + const struct nfs_fh *fh = &nfsi->fh; 1236 + 1237 + __entry->offset = page_index(page) << PAGE_SHIFT; 1238 + __entry->dev = inode->i_sb->s_dev; 1239 + __entry->fileid = nfsi->fileid; 1240 + __entry->fhandle = nfs_fhandle_hash(fh); 1241 + ), 1242 + 1243 + TP_printk( 1244 + "fileid=%02x:%02x:%llu fhandle=0x%08x " 1245 + "offset=%lld", 1246 + MAJOR(__entry->dev), MINOR(__entry->dev), 1247 + (unsigned long long)__entry->fileid, 1248 + __entry->fhandle, 1249 + (long long)__entry->offset 1250 + ) 1251 + ); 1252 + DECLARE_EVENT_CLASS(nfs_fscache_page_event_done, 1253 + TP_PROTO( 1254 + const struct inode *inode, 1255 + struct page *page, 1256 + int error 1257 + ), 1258 + 1259 + TP_ARGS(inode, page, error), 1260 + 1261 + TP_STRUCT__entry( 1262 + __field(int, error) 1263 + __field(dev_t, dev) 1264 + __field(u32, fhandle) 1265 + __field(u64, fileid) 1266 + __field(loff_t, offset) 1267 + ), 1268 + 1269 + TP_fast_assign( 1270 + const struct nfs_inode *nfsi = NFS_I(inode); 1271 + const struct nfs_fh *fh = &nfsi->fh; 1272 + 1273 + __entry->offset = page_index(page) << PAGE_SHIFT; 1274 + __entry->dev = inode->i_sb->s_dev; 1275 + __entry->fileid = nfsi->fileid; 1276 + __entry->fhandle = nfs_fhandle_hash(fh); 1277 + __entry->error = error; 1278 + ), 1279 + 1280 + TP_printk( 1281 + "fileid=%02x:%02x:%llu fhandle=0x%08x " 1282 + "offset=%lld error=%d", 1283 + MAJOR(__entry->dev), MINOR(__entry->dev), 1284 + (unsigned long long)__entry->fileid, 1285 + __entry->fhandle, 1286 + (long long)__entry->offset, __entry->error 1287 + ) 1288 + ); 1289 + #define DEFINE_NFS_FSCACHE_PAGE_EVENT(name) \ 1290 + DEFINE_EVENT(nfs_fscache_page_event, name, \ 1291 + TP_PROTO( \ 1292 + const struct inode *inode, \ 1293 + struct page *page \ 1294 + ), \ 1295 + TP_ARGS(inode, page)) 1296 + #define DEFINE_NFS_FSCACHE_PAGE_EVENT_DONE(name) \ 1297 + DEFINE_EVENT(nfs_fscache_page_event_done, name, \ 1298 + TP_PROTO( \ 1299 + const struct inode *inode, \ 1300 + struct page *page, \ 1301 + int error \ 1302 + ), \ 1303 + TP_ARGS(inode, page, error)) 1304 + DEFINE_NFS_FSCACHE_PAGE_EVENT(nfs_fscache_read_page); 1305 + DEFINE_NFS_FSCACHE_PAGE_EVENT_DONE(nfs_fscache_read_page_exit); 1306 + DEFINE_NFS_FSCACHE_PAGE_EVENT(nfs_fscache_write_page); 1307 + DEFINE_NFS_FSCACHE_PAGE_EVENT_DONE(nfs_fscache_write_page_exit); 1308 + 1218 1309 TRACE_EVENT(nfs_pgio_error, 1219 1310 TP_PROTO( 1220 1311 const struct nfs_pgio_header *hdr,