* [PATCH 2/2] jbd2: add the h_cowing flag and debug counters to jbd2_journal_handle struct
@ 2011-03-01 14:57 Amir Goldstein
2011-03-21 1:14 ` Ted Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2011-03-01 14:57 UTC (permalink / raw)
To: Theodore Tso; +Cc: Ext4 Developers List
The h_cowing flag is used by ext4 snapshots code to mark the task in COWING
state.
The h_XXX_credits fields are used to track buffer credits usage (accounted by
COW and non-COW operations).
The h_cow_XXX fields are used as per task debugging counters.
Merging this patch to kernel 2.6.39, will allow users to test ext4
snapshots as a standalone module (with debug counters enabled), without
the need to patch and install a development kernel.
With CONFIG_JBD2_DEBUG not defined, this patch doesn't change the size of
the struct.
With CONFIG_JBD2_DEBUG defined, the struct grows by 7 int fields, but since
CONFIG_JBD2_DEBUG is mostly defined on development kernels, and since the
size of objects associated with a task is much larger that 7 ints, that
doesn't seem to be a big problem.
Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
---
include/linux/jbd2.h | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 27e79c2..1f22e43 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -435,10 +435,32 @@ struct jbd2_journal_handle
unsigned int h_sync: 1; /* sync-on-close */
unsigned int h_jdata: 1; /* force data journaling */
unsigned int h_aborted: 1; /* fatal error on handle */
+ unsigned int h_cowing: 1; /* COWing block to snapshot */
+
+ /* Number of buffers requested by user:
+ * (before adding the COW credits factor) */
+ unsigned int h_base_credits: 14;
+
+ /* Number of buffers the user is allowed to dirty:
+ * (counts only buffers dirtied when !h_cowing) */
+ unsigned int h_user_credits: 14;
+
#ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lockdep_map h_lockdep_map;
#endif
+
+#ifdef CONFIG_JBD2_DEBUG
+ /* COW debugging counters: */
+ unsigned int h_cow_moved; /* blocks moved to snapshot */
+ unsigned int h_cow_copied; /* blocks copied to snapshot */
+ unsigned int h_cow_ok_jh; /* blocks already COWed during current
+ transaction */
+ unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
+ unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
+ unsigned int h_cow_bitmaps; /* COW bitmaps created */
+ unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
+#endif
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] jbd2: add the h_cowing flag and debug counters to jbd2_journal_handle struct
2011-03-01 14:57 [PATCH 2/2] jbd2: add the h_cowing flag and debug counters to jbd2_journal_handle struct Amir Goldstein
@ 2011-03-21 1:14 ` Ted Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2011-03-21 1:14 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Ext4 Developers List
Added to the ext4 patch queue.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-21 1:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 14:57 [PATCH 2/2] jbd2: add the h_cowing flag and debug counters to jbd2_journal_handle struct Amir Goldstein
2011-03-21 1:14 ` Ted Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).