Skip to contentSkip to conversation

hfsplus: add necessary declarations for journal replay

PATCH Superseded Vyacheslav Dubeyko 1 participant 1 message Dec 26, 2013

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Vyacheslav Dubeyko

author maintainer
#0 lore raw

PATCH 1/14 hfsplus: add necessary declarations for journal replay

From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH 01/14] hfsplus: add necessary declarations for journal replay

The patch adds necessary declarations of HFS+ journal's on-disk structures, declaration of structure for journal's object in memory and different journal related flags.

If HFSPLUS_VOL_JOURNALED is set in the volume header's attributes field, the volume has a journal. The journal data stuctures consist of a journal info block, journal header, and journal buffer. The journal info block indicates the location and size of the journal header and journal buffer. The journal buffer is the space set aside to hold transactions. The journal header describes which part of the journal buffer is active and contains transactions waiting to be committed.

A single transaction consists of several blocks, including both the data to be written, and the location where that data is to be written. This is represented on disk by a block list header, which describes the number and sizes of the blocks, immediately followed by the contents of those blocks.

The journal info block (struct hfsplus_journal_info_block) is big-endian structure. The rest structures of HFS+ journal (struct hfsplus_journal_header, struct hfsplus_blhdr, struct hfsplus_block_info) are little-endian.

CC Al Viro <[email protected]>
CC Christoph Hellwig <[email protected]>
CC Hin-Tak Leung <[email protected]>
---
 fs/hfsplus/hfsplus_fs.h  |   23 ++++++++++++++++++++
 fs/hfsplus/hfsplus_raw.h |   53 +++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 75 insertions(+), 1 deletion(-)
fs/hfsplus/hfsplus_fs.h +23 -0
index 08846425b..18ca92c 100644
@@ -31,6 +31,11 @@
 #define DBG_BITMAP	0x00000040
 #define DBG_ATTR_MOD	0x00000080
 #define DBG_ACL_MOD	0x00000100
+#define DBG_JOURNAL	0x00000200
+#define DBG_JREPLAY	0x00000400
+#define DBG_JTRANS	0x00000800
+#define DBG_JCOMMIT	0x00001000
+#define DBG_JCHKPT	0x00002000
 
 #if 0
 #define DBG_MASK	(DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD)
@@ -126,6 +131,23 @@ struct hfs_bnode {
 #define HFS_BNODE_DIRTY		3
 #define HFS_BNODE_DELETED	4
 
+/* An HFS+ Journal held in memory */
+struct hfsplus_journal {
+	struct mutex jnl_lock;
+
+	/* Journal info block specific */
+	void *jib_buf;
+	struct hfsplus_journal_info_block *jib;
+
+	/* Journal header specific */
+	void *jh_buf;
+	struct hfsplus_journal_header *jh;
+
+	/* TODO: Pointer of JBD */
+
+	struct super_block *sbp;
+};
+
 /*
  * Attributes file states
  */
@@ -146,6 +168,7 @@ struct hfsplus_sb_info {
 	struct hfsplus_vh *s_vhdr;
 	void *s_backup_vhdr_buf;
 	struct hfsplus_vh *s_backup_vhdr;
+	struct hfsplus_journal *jnl;
 	struct hfs_btree *ext_tree;
 	struct hfs_btree *cat_tree;
 	struct hfs_btree *attr_tree;
fs/hfsplus/hfsplus_raw.h +52 -1

69 lines not on this page · raw message

Signature · 1 line
1.7.9.5