Skip to content

Commit 61bc24a

Browse files
author
Al Viro
committed
make sure that DNAME_INLINE_LEN is a multiple of word size
... calling the number of words DNAME_INLINE_WORDS. The next step will be to have a structure to hold inline name arrays (both in dentry and in name_snapshot) and use that to alias the existing arrays of unsigned char there. That will allow both full-structure copies and convenient word-by-word accesses. Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 40384c8 commit 61bc24a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

fs/dcache.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,9 +2748,7 @@ static void swap_names(struct dentry *dentry, struct dentry *target)
27482748
/*
27492749
* Both are internal.
27502750
*/
2751-
unsigned int i;
2752-
BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long)));
2753-
for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) {
2751+
for (int i = 0; i < DNAME_INLINE_WORDS; i++) {
27542752
swap(((long *) &dentry->d_iname)[i],
27552753
((long *) &target->d_iname)[i]);
27562754
}

include/linux/dcache.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ extern const struct qstr dotdot_name;
6868
* large memory footprint increase).
6969
*/
7070
#ifdef CONFIG_64BIT
71-
# define DNAME_INLINE_LEN 40 /* 192 bytes */
71+
# define DNAME_INLINE_WORDS 5 /* 192 bytes */
7272
#else
7373
# ifdef CONFIG_SMP
74-
# define DNAME_INLINE_LEN 36 /* 128 bytes */
74+
# define DNAME_INLINE_WORDS 9 /* 128 bytes */
7575
# else
76-
# define DNAME_INLINE_LEN 44 /* 128 bytes */
76+
# define DNAME_INLINE_WORDS 11 /* 128 bytes */
7777
# endif
7878
#endif
7979

80+
#define DNAME_INLINE_LEN (DNAME_INLINE_WORDS*sizeof(unsigned long))
81+
8082
#define d_lock d_lockref.lock
8183

8284
struct dentry {

0 commit comments

Comments
 (0)