Re: optimize DNAME_INLINE_LEN

Manfred Spraul (manfred@colorfullife.com)
Fri, 14 Dec 2001 00:24:07 +0100


This is a multi-part message in MIME format.
--------------7D1CDA7038AA77A7C6AD60BE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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
--------------7D1CDA7038AA77A7C6AD60BE
Content-Type: text/plain; charset=us-ascii;
 name="patch-dcache"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-dcache"

--- 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 */ };

--------------7D1CDA7038AA77A7C6AD60BE--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/