If the dentries are already aligned on cachelines, I don't see any reason
NOT to do this. Why waste all the memory for alignment when it can be
used for something else?
> The attached patch is preliminary, it doesn't compile with egcs-1.1.2.
> Which gcc version added support for unnamed structures?
Hmm, I thought it was gcc 3.0 that supported unnames structures. For
sure gcc 2.95.2 does not, because unnamed structs are used in the NTFS
tools, and I couldn't compile them.
If you wanted to keep compatibility for older compilers (may be a good idea)
you could do something ugly like using a named struct like "du" and then:
#define d_inode du.du_inode
#define d_count du.du_count
.
.
.
#define d_fsdata du.du_fsdata
Alternately (also ugly) you could just define struct dentry the as now,
but have a fixed size declaration for d_iname, like:
#define DNAME_INLINE_MIN 16
unsigned char d_iname[DNAME_INLINE_MIN];
and only set DNAME_INLINE_LEN afterwards like:
#define DNAME_INLINE_LEN \
(DNAME_INLINE_MIN+L1_CACHE_BYTES - sizeof(struct dentry)%L1_CACHE_BYTES)
This _should_ work for all code that uses DNAME_INLINE_LEN, and if the
alignment doesn't change. It will break horribly if you do sizeof(struct
dentry), declare a dentry on the stack, or if someone changes the alignment.
You can also do preprocessor macro tricks to get something like an unnamed
union in a struct, but it is also a bit ugly.
Cheers, Andreas
-- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/- 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/