NFS: Add offset to nfs_aop_readahead tracepoint

Add the byte offset of the readahead request to the tracepoint output
so we know where the read starts.

Before this patch:
cat-8104    [002] .....   813.168775: nfs_aop_readahead: fileid=00:31:141 fhandle=0xe55807f6 version=1756509392533525500 nr_pages=256
cat-8104    [002] .....   813.174973: nfs_aop_readahead_done: fileid=00:31:141 fhandle=0xe55807f6 version=1756509392533525500 nr_pages=256 ret=0
cat-8104    [002] .....   813.175963: nfs_aop_readahead: fileid=00:31:141 fhandle=0xe55807f6 version=1756509392533525500 nr_pages=256
cat-8104    [002] .....   813.183742: nfs_aop_readahead_done: fileid=00:31:141 fhandle=0xe55807f6 version=1756509392533525500 nr_pages=1 ret=0

After this patch:
cat-6392    [001] .....    73.107782: nfs_aop_readahead: fileid=00:31:141 fhandle=0xed22403f version=1756511950029502774 offset=5242880 nr_pages=256
cat-6392    [001] .....    73.112466: nfs_aop_readahead_done: fileid=00:31:141 fhandle=0xed22403f version=1756511950029502774 nr_pages=256 ret=0
cat-6392    [001] .....    73.115692: nfs_aop_readahead: fileid=00:31:141 fhandle=0xed22403f version=1756511950029502774 offset=6291456 nr_pages=256
cat-6392    [001] .....    73.123283: nfs_aop_readahead_done: fileid=00:31:141 fhandle=0xed22403f version=1756511950029502774 nr_pages=256 ret=0

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Dave Wysochanski 2021-11-02 15:51:55 -04:00 коммит произвёл Trond Myklebust
Родитель cb5a967f7c
Коммит edfa0b16bf
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -889,16 +889,18 @@ TRACE_EVENT(nfs_aop_readpage_done,
TRACE_EVENT(nfs_aop_readahead, TRACE_EVENT(nfs_aop_readahead,
TP_PROTO( TP_PROTO(
const struct inode *inode, const struct inode *inode,
struct page *page,
unsigned int nr_pages unsigned int nr_pages
), ),
TP_ARGS(inode, nr_pages), TP_ARGS(inode, page, nr_pages),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
__field(u32, fhandle) __field(u32, fhandle)
__field(u64, fileid) __field(u64, fileid)
__field(u64, version) __field(u64, version)
__field(loff_t, offset)
__field(unsigned int, nr_pages) __field(unsigned int, nr_pages)
), ),
@ -909,15 +911,16 @@ TRACE_EVENT(nfs_aop_readahead,
__entry->fileid = nfsi->fileid; __entry->fileid = nfsi->fileid;
__entry->fhandle = nfs_fhandle_hash(&nfsi->fh); __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
__entry->version = inode_peek_iversion_raw(inode); __entry->version = inode_peek_iversion_raw(inode);
__entry->offset = page_index(page) << PAGE_SHIFT;
__entry->nr_pages = nr_pages; __entry->nr_pages = nr_pages;
), ),
TP_printk( TP_printk(
"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u", "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid, (unsigned long long)__entry->fileid,
__entry->fhandle, __entry->version, __entry->fhandle, __entry->version,
__entry->nr_pages __entry->offset, __entry->nr_pages
) )
); );
@ -936,6 +939,7 @@ TRACE_EVENT(nfs_aop_readahead_done,
__field(int, ret) __field(int, ret)
__field(u64, fileid) __field(u64, fileid)
__field(u64, version) __field(u64, version)
__field(loff_t, offset)
__field(unsigned int, nr_pages) __field(unsigned int, nr_pages)
), ),

Просмотреть файл

@ -404,7 +404,7 @@ int nfs_readpages(struct file *file, struct address_space *mapping,
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
int ret; int ret;
trace_nfs_aop_readahead(inode, nr_pages); trace_nfs_aop_readahead(inode, lru_to_page(pages), nr_pages);
nfs_inc_stats(inode, NFSIOS_VFSREADPAGES); nfs_inc_stats(inode, NFSIOS_VFSREADPAGES);
ret = -ESTALE; ret = -ESTALE;