Re: optimize DNAME_INLINE_LEN

From: Manfred Spraul (manfred@colorfullife.com)
Date: Thu Dec 13 2001 - 18:24:07 EST


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

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

- 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/



This archive was generated by hypermail 2b29 : Sat Dec 15 2001 - 21:00:27 EST