From b45ec8824b960900780825ffb436c05ce1bc967d Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 3 Dec 2016 19:24:29 -0800 Subject: [PATCH] Add a bunch of trace_printk()s There's nothing particularly coherent about these, they're what I added while debugging. Signed-off-by: Zach Brown --- kmod/src/bio.c | 4 ++++ kmod/src/item.c | 2 ++ kmod/src/manifest.c | 11 +++++++++++ kmod/src/ring.c | 10 ++++++++++ kmod/src/seg.c | 4 ++++ 5 files changed, 31 insertions(+) diff --git a/kmod/src/bio.c b/kmod/src/bio.c index d1ed293d..fe41a689 100644 --- a/kmod/src/bio.c +++ b/kmod/src/bio.c @@ -42,6 +42,8 @@ static void bio_end_io(struct bio *bio, int err) { struct bio_end_io_args *args = bio->bi_private; + trace_printk("bio %p end io\n", bio); + dec_end_io(args, bio->bi_size, err); bio_put(bio); } @@ -114,6 +116,8 @@ void scoutfs_bio_submit(struct super_block *sb, int rw, struct page **pages, continue; } + trace_printk("added page %p to bio %p\n", page, bio); + blkno += SCOUTFS_BLOCKS_PER_PAGE; nr_blocks -= SCOUTFS_BLOCKS_PER_PAGE; } diff --git a/kmod/src/item.c b/kmod/src/item.c index 7525a6ba..f65388ec 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -116,6 +116,8 @@ int scoutfs_item_lookup(struct super_block *sb, struct kvec *key, } while (!item && ((ret = scoutfs_manifest_read_items(sb, key)) == 0)); + trace_printk("ret %d\n", ret); + return ret; } diff --git a/kmod/src/manifest.c b/kmod/src/manifest.c index b927a142..c6b1a33f 100644 --- a/kmod/src/manifest.c +++ b/kmod/src/manifest.c @@ -127,6 +127,8 @@ static int add_ment(struct manifest *mani, struct manifest_entry *ment) { int ret; + trace_printk("adding ment %p level %u\n", ment, ment->level); + if (ment->level) { ret = insert_ment(&mani->level_roots[ment->level], ment); if (!ret) @@ -218,6 +220,8 @@ static struct manifest_ref *get_key_refs(struct manifest *mani, unsigned int nr; int i; + trace_printk("getting refs\n"); + spin_lock_irqsave(&mani->lock, flags); total = mani->level0_nr + mani->last_level; @@ -227,6 +231,7 @@ static struct manifest_ref *get_key_refs(struct manifest *mani, kfree(refs); refs = kcalloc(total, sizeof(struct manifest_ref), GFP_NOFS); + trace_printk("alloc refs %p total %u\n", refs, total); if (!refs) return ERR_PTR(-ENOMEM); @@ -236,6 +241,7 @@ static struct manifest_ref *get_key_refs(struct manifest *mani, nr = 0; list_for_each_entry(ment, &mani->level0_list, level0_entry) { + trace_printk("trying l0 ment %p\n", ment); if (scoutfs_kvec_cmp_overlap(key, key, ment->first, ment->last)) continue; @@ -261,6 +267,9 @@ static struct manifest_ref *get_key_refs(struct manifest *mani, refs = NULL; } + trace_printk("refs %p (err %ld)\n", + refs, IS_ERR(refs) ? PTR_ERR(refs) : 0); + return refs; } @@ -299,6 +308,8 @@ int scoutfs_manifest_read_items(struct super_block *sb, struct kvec *key) int i; int n; + trace_printk("reading items\n"); + refs = get_key_refs(mani, key, &nr_refs); if (IS_ERR(refs)) return PTR_ERR(refs); diff --git a/kmod/src/ring.c b/kmod/src/ring.c index 04729eaa..867acd3b 100644 --- a/kmod/src/ring.c +++ b/kmod/src/ring.c @@ -138,10 +138,16 @@ static int read_one_entry(struct super_block *sb, SCOUTFS_DECLARE_KVEC(last); int ret; + trace_printk("type %u len %u\n", eh->type, le16_to_cpu(eh->len)); + switch(eh->type) { case SCOUTFS_RING_ADD_MANIFEST: am = container_of(eh, struct scoutfs_ring_add_manifest, eh); + trace_printk("lens %u %u\n", + le16_to_cpu(am->first_key_len), + le16_to_cpu(am->last_key_len)); + scoutfs_kvec_init(first, am + 1, le16_to_cpu(am->first_key_len)); scoutfs_kvec_init(last, @@ -167,6 +173,8 @@ static int read_entries(struct super_block *sb, int ret = 0; int i; + trace_printk("reading %u entries\n", le32_to_cpu(ring->nr_entries)); + eh = ring->entries; for (i = 0; i < le32_to_cpu(ring->nr_entries); i++) { @@ -236,6 +244,8 @@ int scoutfs_ring_read(struct super_block *sb) nr = le64_to_cpu(super->ring_blocks) - index; nr = min_t(int, nr, NR_BLOCKS); + trace_printk("index %llu tail %llu nr %u\n", index, tail, nr); + ret = scoutfs_bio_read(sb, pages, blkno, nr); if (ret) goto out; diff --git a/kmod/src/seg.c b/kmod/src/seg.c index 9f884845..4537c50c 100644 --- a/kmod/src/seg.c +++ b/kmod/src/seg.c @@ -71,6 +71,8 @@ static struct scoutfs_segment *alloc_seg(u64 segno) for (i = 0; i < SCOUTFS_SEGMENT_PAGES; i++) { page = alloc_page(GFP_NOFS); + trace_printk("seg %p segno %llu page %u %p\n", + seg, segno, i, page); if (!page) { scoutfs_seg_put(seg); return ERR_PTR(-ENOMEM); @@ -217,6 +219,8 @@ struct scoutfs_segment *scoutfs_seg_submit_read(struct super_block *sb, struct scoutfs_segment *seg; unsigned long flags; + trace_printk("segno %llu\n", segno); + spin_lock_irqsave(&cac->lock, flags); seg = find_seg(&cac->root, segno); if (seg)