scoutfs: add some basic tracepoints

I added these tracepoints to verify that file data isn't reachable after
mount because we're not writing out the inode with the current i_size.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-03-26 22:24:00 -07:00
parent 402dd2969f
commit 059212d50e
4 changed files with 132 additions and 1 deletions

View File

@@ -19,6 +19,7 @@
#include "inode.h"
#include "key.h"
#include "filerw.h"
#include "scoutfs_trace.h"
/*
* File data is stored in items just like everything else. This is very
@@ -167,9 +168,12 @@ static int scoutfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{
struct inode *inode = mapping->host;
pgoff_t index = pos >> PAGE_CACHE_SHIFT;
struct page *page;
trace_scoutfs_write_begin(scoutfs_ino(inode), pos, len);
page = grab_cache_page_write_begin(mapping, index, flags);
if (!page)
return -ENOMEM;
@@ -185,6 +189,8 @@ static int scoutfs_write_end(struct file *file, struct address_space *mapping,
struct inode *inode = mapping->host;
unsigned off;
trace_scoutfs_write_end(scoutfs_ino(inode), pos, len, copied);
off = pos & (PAGE_CACHE_SIZE - 1);
/* zero the stale part of the page if we did a short copy */

View File

@@ -22,6 +22,7 @@
#include "segment.h"
#include "dir.h"
#include "filerw.h"
#include "scoutfs_trace.h"
/*
* XXX
@@ -237,6 +238,7 @@ int scoutfs_dirty_inode_item(struct inode *inode)
if (!ret) {
store_inode(ref.val, inode);
scoutfs_put_ref(&ref);
trace_scoutfs_dirty_inode(inode);
}
return ret;
}
@@ -264,6 +266,7 @@ void scoutfs_update_inode_item(struct inode *inode)
store_inode(ref.val, inode);
scoutfs_put_ref(&ref);
trace_scoutfs_update_inode(inode);
}
/*

View File

@@ -66,10 +66,128 @@ TRACE_EVENT(scoutfs_bloom_miss,
__entry->inode, __entry->type, __entry->offset)
);
TRACE_EVENT(scoutfs_write_begin,
TP_PROTO(u64 ino, loff_t pos, unsigned len),
TP_ARGS(ino, pos, len),
TP_STRUCT__entry(
__field(__u64, inode)
__field(__u64, pos)
__field(__u32, len)
),
TP_fast_assign(
__entry->inode = ino;
__entry->pos = pos;
__entry->len = len;
),
TP_printk("ino %llu pos %llu len %u",
__entry->inode, __entry->pos, __entry->len)
);
TRACE_EVENT(scoutfs_write_end,
TP_PROTO(u64 ino, loff_t pos, unsigned len, unsigned copied),
TP_ARGS(ino, pos, len, copied),
TP_STRUCT__entry(
__field(__u64, inode)
__field(__u64, pos)
__field(__u32, len)
__field(__u32, copied)
),
TP_fast_assign(
__entry->inode = ino;
__entry->pos = pos;
__entry->len = len;
__entry->copied = copied;
),
TP_printk("ino %llu pos %llu len %u",
__entry->inode, __entry->pos, __entry->len)
);
TRACE_EVENT(scoutfs_dirty_inode,
TP_PROTO(struct inode *inode),
TP_ARGS(inode),
TP_STRUCT__entry(
__field(__u64, ino)
__field(__u64, size)
),
TP_fast_assign(
__entry->ino = scoutfs_ino(inode);
__entry->size = inode->i_size;
),
TP_printk("ino %llu size %llu",
__entry->ino, __entry->size)
);
TRACE_EVENT(scoutfs_update_inode,
TP_PROTO(struct inode *inode),
TP_ARGS(inode),
TP_STRUCT__entry(
__field(__u64, ino)
__field(__u64, size)
),
TP_fast_assign(
__entry->ino = scoutfs_ino(inode);
__entry->size = inode->i_size;
),
TP_printk("ino %llu size %llu",
__entry->ino, __entry->size)
);
TRACE_EVENT(scoutfs_dirty_super,
TP_PROTO(struct scoutfs_super_block *super),
TP_ARGS(super),
TP_STRUCT__entry(
__field(__u64, blkno)
__field(__u64, seq)
),
TP_fast_assign(
__entry->blkno = le64_to_cpu(super->hdr.blkno);
__entry->seq = le64_to_cpu(super->hdr.seq);
),
TP_printk("blkno %llu seq %llu",
__entry->blkno, __entry->seq)
);
TRACE_EVENT(scoutfs_write_super,
TP_PROTO(struct scoutfs_super_block *super),
TP_ARGS(super),
TP_STRUCT__entry(
__field(__u64, blkno)
__field(__u64, seq)
),
TP_fast_assign(
__entry->blkno = le64_to_cpu(super->hdr.blkno);
__entry->seq = le64_to_cpu(super->hdr.seq);
),
TP_printk("blkno %llu seq %llu",
__entry->blkno, __entry->seq)
);
#endif /* _TRACE_SCOUTFS_H */
/* This part must be outside protection */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .

View File

@@ -27,6 +27,7 @@
#include "manifest.h"
#include "ring.h"
#include "segment.h"
#include "scoutfs_trace.h"
/*
* We've been dirtying log segment blocks and ring blocks as items were
@@ -71,6 +72,8 @@ int scoutfs_advance_dirty_super(struct super_block *sb)
le64_add_cpu(&super->hdr.seq, 1);
trace_scoutfs_dirty_super(super);
return 0;
}
@@ -96,6 +99,7 @@ int scoutfs_write_dirty_super(struct super_block *sb)
scoutfs_calc_hdr_crc(bh);
mark_buffer_dirty(bh);
trace_scoutfs_write_super(super);
ret = sync_dirty_buffer(bh);
brelse(bh);