Skip to contentSkip to conversation

nilfs2: implement block mapping subsystem debugging output

PATCH New Vyacheslav Dubeyko 1 participant 1 message Jun 17, 2013

Subsystems (2)
lore
Share & tools
lore

Vyacheslav Dubeyko

author maintainer
#0 lore raw

PATCH 13/24 nilfs2: implement block mapping subsystem debugging output

From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH 13/24] nilfs2: implement block mapping subsystem debugging output

This patch adds debugging output by means of nilfs2_debug() method into modules that are grouped by block mapping subsystem debugging output option (CONFIG_NILFS2_DEBUG_BLOCK_MAPPING).

---
 fs/nilfs2/alloc.c  |   15 ++++
 fs/nilfs2/bmap.c   |   81 ++++++++++++++++++++-
 fs/nilfs2/btnode.c |   28 +++++++
 fs/nilfs2/btree.c  |  205 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 fs/nilfs2/direct.c |   51 +++++++++++++
 5 files changed, 375 insertions(+), 5 deletions(-)
fs/nilfs2/alloc.c +15 -0
index eed4d7b..2ce1fd4 100644
@@ -62,6 +62,10 @@ int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned entry_size)
 {
 	struct nilfs_mdt_info *mi = NILFS_MDT(inode);
 
+	nilfs2_debug(DBG_ALLOC,
+			"i_ino %lu, entry_size %u\n",
+			inode->i_ino, entry_size);
+
 	mi->mi_bgl = kmalloc(sizeof(*mi->mi_bgl), GFP_NOFS);
 	if (!mi->mi_bgl)
 		return -ENOMEM;
@@ -646,6 +650,10 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
 	unsigned long group, group_offset;
 	int i, j, n, ret;
 
+	nilfs2_debug(DBG_ALLOC,
+			"i_ino %lu, entry_nrs %p, nitems %zu\n",
+			inode->i_ino, entry_nrs, nitems);
+
 	for (i = 0; i < nitems; i = j) {
 		group = nilfs_palloc_group(inode, entry_nrs[i], &group_offset);
 		ret = nilfs_palloc_get_desc_block(inode, group, 0, &desc_bh);
@@ -696,6 +704,9 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
 void nilfs_palloc_setup_cache(struct inode *inode,
 			      struct nilfs_palloc_cache *cache)
 {
+	nilfs2_debug(DBG_ALLOC,
+			"i_ino %lu, cache %p\n", inode->i_ino, cache);
+
 	NILFS_MDT(inode)->mi_palloc_cache = cache;
 	spin_lock_init(&cache->lock);
 }
@@ -704,6 +715,8 @@ void nilfs_palloc_clear_cache(struct inode *inode)
 {
 	struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache;
 
+	nilfs2_debug(DBG_ALLOC, "i_ino %lu\n", inode->i_ino);
+
 	spin_lock(&cache->lock);
 	brelse(cache->prev_desc.bh);
 	brelse(cache->prev_bitmap.bh);
@@ -716,6 +729,8 @@ void nilfs_palloc_clear_cache(struct inode *inode)
 
 void nilfs_palloc_destroy_cache(struct inode *inode)
 {
+	nilfs2_debug(DBG_ALLOC, "i_ino %lu\n", inode->i_ino);
+
 	nilfs_palloc_clear_cache(inode);
 	NILFS_MDT(inode)->mi_palloc_cache = NULL;
 }
fs/nilfs2/bmap.c +79 -2

207 lines not on this page · raw message

fs/nilfs2/btnode.c +28 -0
index a35ae35..54b3f2a 100644
@@ -36,6 +36,9 @@
 
 void nilfs_btnode_cache_clear(struct address_space *btnc)
 {
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu\n", btnc->host->i_ino);
+
 	invalidate_mapping_pages(btnc, 0, -1);
 	truncate_inode_pages(btnc, 0);
 }
@@ -46,6 +49,10 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
 	struct inode *inode = NILFS_BTNC_I(btnc);
 	struct buffer_head *bh;
 
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu, blocknr %llu\n",
+			btnc->host->i_ino, blocknr);
+
 	bh = nilfs_grab_buffer(inode, btnc, blocknr, 1 << BH_NILFS_Node);
 	if (unlikely(!bh))
 		return NULL;
@@ -75,6 +82,10 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
 	struct page *page;
 	int err;
 
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu, blocknr %llu, pblocknr %lu, mode %d\n",
+			btnc->host->i_ino, blocknr, pblocknr, mode);
+
 	bh = nilfs_grab_buffer(inode, btnc, blocknr, 1 << BH_NILFS_Node);
 	if (unlikely(!bh))
 		return -ENOMEM;
@@ -123,6 +134,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
 	bh->b_blocknr = blocknr; /* set back to the given block address */
 	*submit_ptr = pblocknr;
 	err = 0;
+	nilfs2_debug(DBG_BTNODE, "submit_ptr %lu\n", *submit_ptr);
 found:
 	*pbh = bh;
 
@@ -146,6 +158,10 @@ void nilfs_btnode_delete(struct buffer_head *bh)
 	pgoff_t index = page_index(page);
 	int still_dirty;
 
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu, bh->blocknr %lu\n",
+			page->mapping->host->i_ino, bh->b_blocknr);
+
 	page_cache_get(page);
 	lock_page(page);
 	wait_on_page_writeback(page);
@@ -178,6 +194,10 @@ int nilfs_btnode_prepare_change_key(struct address_space *btnc,
 	if (oldkey == newkey)
 		return 0;
 
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu, oldkey %llu, newkey %llu\n",
+			btnc->host->i_ino, ctxt->oldkey, ctxt->newkey);
+
 	obh = ctxt->bh;
 	ctxt->newbh = NULL;
 
@@ -247,6 +267,10 @@ void nilfs_btnode_commit_change_key(struct address_space *btnc,
 	if (oldkey == newkey)
 		return;
 
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu, oldkey %llu, newkey %llu\n",
+			btnc->host->i_ino, ctxt->oldkey, ctxt->newkey);
+
 	if (nbh == NULL) {	/* blocksize == pagesize */
 		opage = obh->b_page;
 		if (unlikely(oldkey != opage->index))
@@ -287,6 +311,10 @@ void nilfs_btnode_abort_change_key(struct address_space *btnc,
 	if (oldkey == newkey)
 		return;
 
+	nilfs2_debug(DBG_BTNODE,
+			"i_ino %lu, oldkey %llu, newkey %llu\n",
+			btnc->host->i_ino, ctxt->oldkey, ctxt->newkey);
+
 	if (nbh == NULL) {	/* blocksize == pagesize */
 		spin_lock_irq(&btnc->tree_lock);
 		radix_tree_delete(&btnc->page_tree, newkey);
fs/nilfs2/btree.c +202 -3

520 lines not on this page · raw message

fs/nilfs2/direct.c +51 -0

129 lines not on this page · raw message

Signature · 1 line
1.7.9.5