linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Radek Pazdera <rpazdera@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: lczerner@redhat.com, kasparek@fit.vutbr.cz,
	Radek Pazdera <rpazdera@redhat.com>
Subject: [RFC v2 4/9] ext4: Adding itree structures
Date: Mon, 13 May 2013 17:42:05 +0200	[thread overview]
Message-ID: <1368459730-3405-5-git-send-email-rpazdera@redhat.com> (raw)
In-Reply-To: <1368459730-3405-1-git-send-email-rpazdera@redhat.com>

This commit adds 5 new structures that will be used in the itree code.

On-disk:
    struct itree_entry      Single entry in an itree_node.
    struct itree_node       A non-leaf node in the itree.
    struct itree_leaf_head  Comes first in every itree leaf block.
    struct itree_leaf_entry A dirent in itree leaf.

Memory only:
    struct itree_frame      Represents a path through a tree to one of
                            its leaves.
    struct itree_key        For representing the key for itree, which
                            is an inode number and file name hash

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
---
 fs/ext4/namei.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 20cf635..c9b6c91 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -261,6 +261,56 @@ struct dx_tail {
 	struct dx_itree_entry *itree;
 };
 
+/*
+ * itree structures
+ */
+
+/* A single entry in the itree_node */
+struct itree_entry {
+	__le32 inode;
+	__le32 hash;
+	__le64 block;
+	__u8 fullness;
+	__u8 flags;
+};
+
+#define ITREE_NODE_FL_CONT	1
+
+/* A non-leaf node of the itree */
+struct itree_node {
+	__le16 count;
+	__le16 limit;
+	__le32 checksum;
+	__u8 indirect_levels;
+	struct itree_entry entries[0];
+};
+
+/* Comes first in every itree leaf block */
+struct itree_leaf_head {
+	__le32 checksum;
+	__le32 used_length;
+};
+
+/* A dirent with hash in an itree leaf block */
+#define ITREE_LE_HEAD_LEN 4
+struct itree_leaf_entry {
+	__le32 hash;
+	struct ext4_dir_entry_2 dirent;
+};
+
+/* For easier manipulation of the compound key */
+struct itree_key {
+	u32 inode;
+	u32 hash;
+};
+
+/* Represents a position within an itree_node block */
+struct itree_frame {
+	struct buffer_head *bh;
+	struct itree_entry *entries;
+	struct itree_entry *at;
+};
+
 static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
 static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
 static inline unsigned dx_get_hash(struct dx_entry *entry);
-- 
1.7.11.7


  parent reply	other threads:[~2013-05-13 16:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 15:42 [RFC v2 0/9] ext4: An Auxiliary Tree for the Directory Index Radek Pazdera
2013-05-13 15:42 ` [RFC v2 1/9] ext4: Adding itree feature and inode flags Radek Pazdera
2013-05-13 15:42 ` [RFC v2 2/9] ext4: Allow sorting dx_map by inode as well Radek Pazdera
2013-05-13 15:42 ` [RFC v2 3/9] ext4: Adding a link to itree to the dx_root struct Radek Pazdera
2013-05-13 15:42 ` Radek Pazdera [this message]
2013-05-13 15:42 ` [RFC v2 5/9] ext4: Adding itree implementation I - Core Radek Pazdera
2013-05-13 15:42 ` [RFC v2 6/9] ext4: Adding itree implementation II - Inserting Radek Pazdera
2013-05-13 15:42 ` [RFC v2 7/9] ext4: Adding itree implementation III - Deleting Radek Pazdera
2013-05-13 15:42 ` [RFC v2 8/9] ext4: Make directory operations use itree Radek Pazdera
2013-05-13 15:42 ` [RFC v2 9/9] ext4: Make ext4_readdir() use itree if available Radek Pazdera

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=1368459730-3405-5-git-send-email-rpazdera@redhat.com \
    --to=rpazdera@redhat.com \
    --cc=kasparek@fit.vutbr.cz \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).