All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Andreas Dilger <adilger@turbolabs.com>
Cc: linux-kernel@vger.kernel.org, ak@suse.de
Subject: Re: optimize DNAME_INLINE_LEN
Date: Fri, 14 Dec 2001 00:24:07 +0100	[thread overview]
Message-ID: <3C193897.893088D9@colorfullife.com> (raw)
In-Reply-To: <3C192A37.4547D2A7@colorfullife.com> <20011213160706.E940@lynx.no>

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Andreas Dilger wrote:
> 
> You can also do preprocessor macro tricks to get something like an unnamed
> union in a struct, but it is also a bit ugly.
>
I'd prefer that (patch attached, tested with egcs-1.1.2)

Unless I receive complaints, I'll send it to Linus tomorrow, and then
backport to 2.4 after Linus merged it.

--
	Manfred

[-- Attachment #2: patch-dcache --]
[-- Type: text/plain, Size: 1958 bytes --]

--- 2.5/include/linux/dcache.h	Thu Oct 11 15:20:18 2001
+++ build-2.5/include/linux/dcache.h	Thu Dec 13 23:39:32 2001
@@ -61,25 +61,33 @@
 	return end_name_hash(hash);
 }
 
-#define DNAME_INLINE_LEN 16
+#define DENTRY_MEMBERS \
+	atomic_t d_count; \
+	unsigned int d_flags; \
+	struct inode  * d_inode;	/* Where the name belongs to - NULL is negative */ \
+	struct dentry * d_parent;	/* parent directory */ \
+	struct list_head d_hash;	/* lookup hash list */ \
+	struct list_head d_lru;		/* d_count = 0 LRU list */ \
+	struct list_head d_child;	/* child of parent list */ \
+	struct list_head d_subdirs;	/* our children */ \
+	struct list_head d_alias;	/* inode alias list */ \
+	int d_mounted; \
+	struct qstr d_name; \
+	unsigned long d_time;		/* used by d_revalidate */ \
+	struct dentry_operations  *d_op; \
+	struct super_block * d_sb;	/* The root of the dentry tree */ \
+	unsigned long d_vfs_flags; \
+	void * d_fsdata;		/* fs-specific data */
+
+struct dentry_nameless {
+	DENTRY_MEMBERS
+};
+/* +15 to guarantee a minimal inline len of 16 bytes */
+#define DNAME_INLINE_LEN \
+	(15 + L1_CACHE_BYTES - (15+sizeof(struct dentry_nameless))%L1_CACHE_BYTES)
 
 struct dentry {
-	atomic_t d_count;
-	unsigned int d_flags;
-	struct inode  * d_inode;	/* Where the name belongs to - NULL is negative */
-	struct dentry * d_parent;	/* parent directory */
-	struct list_head d_hash;	/* lookup hash list */
-	struct list_head d_lru;		/* d_count = 0 LRU list */
-	struct list_head d_child;	/* child of parent list */
-	struct list_head d_subdirs;	/* our children */
-	struct list_head d_alias;	/* inode alias list */
-	int d_mounted;
-	struct qstr d_name;
-	unsigned long d_time;		/* used by d_revalidate */
-	struct dentry_operations  *d_op;
-	struct super_block * d_sb;	/* The root of the dentry tree */
-	unsigned long d_vfs_flags;
-	void * d_fsdata;		/* fs-specific data */
+	DENTRY_MEMBERS
 	unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
 };
 

  reply	other threads:[~2001-12-13 23:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-13 22:22 optimize DNAME_INLINE_LEN Manfred Spraul
2001-12-13 23:07 ` Andreas Dilger
2001-12-13 23:24   ` Manfred Spraul [this message]
2001-12-13 23:29   ` Andi Kleen
2001-12-14  0:03     ` Andreas Dilger
2001-12-14  0:10       ` Andi Kleen

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=3C193897.893088D9@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=adilger@turbolabs.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.