mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Bob Peterson <rpeterso@redhat.com>,
	Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 23/24] GFS2: Add rgrp information to block_alloc trace point
Date: Thu, 17 May 2012 13:23:30 +0100	[thread overview]
Message-ID: <1337257411-3173-24-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1337257411-3173-1-git-send-email-swhiteho@redhat.com>

From: Bob Peterson <rpeterso@redhat.com>

This is a second attempt at a patch that adds rgrp information to the
block allocation trace point for GFS2. As suggested, the patch was
modified to list the rgrp information _after_ the fields that exist today.

Again, the reason for this patch is to allow us to trace and debug
problems with the block reservations patch, which is still in the works.
We can debug problems with reservations if we can see what block allocations
result from the block reservations. It may also be handy in figuring out
if there are problems in rgrp free space accounting. In other words,
we can use it to track the rgrp and its free space along side the allocations
that are taking place.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 645c16f..f74fb9b 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1556,7 +1556,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
 				  ip->i_inode.i_gid);
 
 	rgd->rd_free_clone -= *nblocks;
-	trace_gfs2_block_alloc(ip, block, *nblocks,
+	trace_gfs2_block_alloc(ip, rgd, block, *nblocks,
 			       dinode ? GFS2_BLKST_DINODE : GFS2_BLKST_USED);
 	*bn = block;
 	return 0;
@@ -1583,7 +1583,7 @@ void __gfs2_free_blocks(struct gfs2_inode *ip, u64 bstart, u32 blen, int meta)
 	rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE);
 	if (!rgd)
 		return;
-	trace_gfs2_block_alloc(ip, bstart, blen, GFS2_BLKST_FREE);
+	trace_gfs2_block_alloc(ip, rgd, bstart, blen, GFS2_BLKST_FREE);
 	rgd->rd_free += blen;
 	rgd->rd_flags &= ~GFS2_RGF_TRIMMED;
 	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
@@ -1621,7 +1621,7 @@ void gfs2_unlink_di(struct inode *inode)
 	rgd = rgblk_free(sdp, blkno, 1, GFS2_BLKST_UNLINKED);
 	if (!rgd)
 		return;
-	trace_gfs2_block_alloc(ip, blkno, 1, GFS2_BLKST_UNLINKED);
+	trace_gfs2_block_alloc(ip, rgd, blkno, 1, GFS2_BLKST_UNLINKED);
 	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data);
 }
@@ -1651,7 +1651,7 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno)
 void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip)
 {
 	gfs2_free_uninit_di(rgd, ip->i_no_addr);
-	trace_gfs2_block_alloc(ip, ip->i_no_addr, 1, GFS2_BLKST_FREE);
+	trace_gfs2_block_alloc(ip, rgd, ip->i_no_addr, 1, GFS2_BLKST_FREE);
 	gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid);
 	gfs2_meta_wipe(ip, ip->i_no_addr, 1);
 }
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index dfa89cd..1b8b815 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -457,10 +457,10 @@ TRACE_EVENT(gfs2_bmap,
 /* Keep track of blocks as they are allocated/freed */
 TRACE_EVENT(gfs2_block_alloc,
 
-	TP_PROTO(const struct gfs2_inode *ip, u64 block, unsigned len,
-		u8 block_state),
+	TP_PROTO(const struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
+		 u64 block, unsigned len, u8 block_state),
 
-	TP_ARGS(ip, block, len, block_state),
+	TP_ARGS(ip, rgd, block, len, block_state),
 
 	TP_STRUCT__entry(
 		__field(        dev_t,  dev                     )
@@ -468,6 +468,8 @@ TRACE_EVENT(gfs2_block_alloc,
 		__field(	u64,	inum			)
 		__field(	u32,	len			)
 		__field(	u8,	block_state		)
+		__field(        u64,	rd_addr			)
+		__field(        u32,	rd_free_clone		)
 	),
 
 	TP_fast_assign(
@@ -476,14 +478,18 @@ TRACE_EVENT(gfs2_block_alloc,
 		__entry->inum		= ip->i_no_addr;
 		__entry->len		= len;
 		__entry->block_state	= block_state;
+		__entry->rd_addr	= rgd->rd_addr;
+		__entry->rd_free_clone	= rgd->rd_free_clone;
 	),
 
-	TP_printk("%u,%u bmap %llu alloc %llu/%lu %s",
+	TP_printk("%u,%u bmap %llu alloc %llu/%lu %s rg:%llu rf:%u",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  (unsigned long long)__entry->inum,
 		  (unsigned long long)__entry->start,
 		  (unsigned long)__entry->len,
-		  block_state_name(__entry->block_state))
+		  block_state_name(__entry->block_state),
+		  (unsigned long long)__entry->rd_addr,
+		  __entry->rd_free_clone)
 );
 
 #endif /* _TRACE_GFS2_H */
-- 
1.7.4


  parent reply	other threads:[~2012-05-17 12:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17 12:23 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2012-05-17 12:23 ` [PATCH 01/24] GFS2: Drop "pull" argument from log_write_header() Steven Whitehouse
2012-05-17 12:23 ` [PATCH 02/24] GFS2: Make gfs2_log_fake_buf() write the buffer too Steven Whitehouse
2012-05-17 12:23 ` [PATCH 03/24] GFS2: Rename function gfs2_close to gfs2_release Steven Whitehouse
2012-05-17 12:23 ` [PATCH 04/24] GFS2: make function gfs2_page_add_databufs static Steven Whitehouse
2012-05-17 12:23 ` [PATCH 05/24] GFS2: Use slab for block reservation memory Steven Whitehouse
2012-05-17 12:23 ` [PATCH 06/24] GFS2: Eliminate offset parameter to gfs2_setbit Steven Whitehouse
2012-05-17 12:23 ` [PATCH 07/24] GFS2: Fix function parameter comments in rgrp.c Steven Whitehouse
2012-05-17 12:23 ` [PATCH 08/24] GFS2: Change variable blk to biblk Steven Whitehouse
2012-05-17 12:23 ` [PATCH 09/24] GFS2: Use variable rather than qa to determine if unstuff necessary Steven Whitehouse
2012-05-17 12:23 ` [PATCH 10/24] GFS2: Clean up log write code path Steven Whitehouse
2012-05-17 12:23 ` [PATCH 11/24] GFS2: Remove duplicate log code Steven Whitehouse
2012-05-17 12:23 ` [PATCH 12/24] GFS2: Remove bd_list_tr Steven Whitehouse
2012-05-17 12:23 ` [PATCH 13/24] GFS2: Remove unused argument from gfs2_internal_read Steven Whitehouse
2012-05-17 12:23 ` [PATCH 14/24] GFS2: Log code fixes Steven Whitehouse
2012-05-17 12:23 ` [PATCH 15/24] GFS2: Eliminate needless parameter from function gfs2_setbit Steven Whitehouse
2012-05-17 12:23 ` [PATCH 16/24] GFS2: Eliminate vestigial sd_log_le_rg Steven Whitehouse
2012-05-17 12:23 ` [PATCH 17/24] GFS2: eliminate log elements and simplify Steven Whitehouse
2012-05-17 12:23 ` [PATCH 18/24] GFS2: Fix sgid propagation when using ACLs Steven Whitehouse
2012-05-17 12:23 ` [PATCH 19/24] GFS2: Remove redundant metadata block type check Steven Whitehouse
2012-05-17 12:23 ` [PATCH 20/24] GFS2: Update main gfs2 doc Steven Whitehouse
2012-05-17 12:23 ` [PATCH 21/24] GFS2: Update glock doc to add new stats info Steven Whitehouse
2012-05-17 12:23 ` [PATCH 22/24] GFS2: Eliminate unused "new" parameter to gfs2_meta_indirect_buffer Steven Whitehouse
2012-05-17 12:23 ` Steven Whitehouse [this message]
2012-05-17 12:23 ` [PATCH 24/24] GFS2: Fix quota adjustment return code Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337257411-3173-24-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®