lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinXEtHBLH=aDt0tHZQfWFaU-38EGWDRLQJJ8nmM@mail.gmail.com>
Date:	Tue, 1 Mar 2011 16:57:54 +0200
From:	Amir Goldstein <amir73il@...il.com>
To:	Theodore Tso <tytso@....edu>
Cc:	Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: [PATCH 2/2] jbd2: add the h_cowing flag and debug counters to
 jbd2_journal_handle struct

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@...rs.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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ