Skip to content

Commit 059590f

Browse files
Eric SandeenLinus Torvalds
authored andcommitted
ext3: remove #ifdef CONFIG_EXT3_INDEX
CONFIG_EXT3_INDEX is not an exposed config option in the kernel, and it is unconditionally defined in ext3_fs.h. tune2fs is already able to turn off dir indexing, so at this point it's just cluttering up the code. Remove it. Signed-off-by: Eric Sandeen <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent a9c62a1 commit 059590f

File tree

3 files changed

+2
-38
lines changed

3 files changed

+2
-38
lines changed

fs/ext3/dir.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ const struct file_operations ext3_dir_operations = {
4747
.compat_ioctl = ext3_compat_ioctl,
4848
#endif
4949
.fsync = ext3_sync_file, /* BKL held */
50-
#ifdef CONFIG_EXT3_INDEX
5150
.release = ext3_release_dir,
52-
#endif
5351
};
5452

5553

@@ -107,7 +105,6 @@ static int ext3_readdir(struct file * filp,
107105

108106
sb = inode->i_sb;
109107

110-
#ifdef CONFIG_EXT3_INDEX
111108
if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb,
112109
EXT3_FEATURE_COMPAT_DIR_INDEX) &&
113110
((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) ||
@@ -123,7 +120,6 @@ static int ext3_readdir(struct file * filp,
123120
*/
124121
EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
125122
}
126-
#endif
127123
stored = 0;
128124
offset = filp->f_pos & (sb->s_blocksize - 1);
129125

@@ -232,7 +228,6 @@ static int ext3_readdir(struct file * filp,
232228
return ret;
233229
}
234230

235-
#ifdef CONFIG_EXT3_INDEX
236231
/*
237232
* These functions convert from the major/minor hash to an f_pos
238233
* value.
@@ -518,5 +513,3 @@ static int ext3_release_dir (struct inode * inode, struct file * filp)
518513

519514
return 0;
520515
}
521-
522-
#endif

fs/ext3/namei.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ struct dx_map_entry
144144
u16 size;
145145
};
146146

147-
#ifdef CONFIG_EXT3_INDEX
148147
static inline unsigned dx_get_block (struct dx_entry *entry);
149148
static void dx_set_block (struct dx_entry *entry, unsigned value);
150149
static inline unsigned dx_get_hash (struct dx_entry *entry);
@@ -768,8 +767,6 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, u32 block)
768767
dx_set_block(new, block);
769768
dx_set_count(entries, count + 1);
770769
}
771-
#endif
772-
773770

774771
static void ext3_update_dx_flag(struct inode *inode)
775772
{
@@ -871,7 +868,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
871868
name = dentry->d_name.name;
872869
if (namelen > EXT3_NAME_LEN)
873870
return NULL;
874-
#ifdef CONFIG_EXT3_INDEX
875871
if (is_dx(dir)) {
876872
bh = ext3_dx_find_entry(dentry, res_dir, &err);
877873
/*
@@ -883,7 +879,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
883879
return bh;
884880
dxtrace(printk("ext3_find_entry: dx failed, falling back\n"));
885881
}
886-
#endif
887882
nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
888883
start = EXT3_I(dir)->i_dir_start_lookup;
889884
if (start >= nblocks)
@@ -959,7 +954,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
959954
return ret;
960955
}
961956

962-
#ifdef CONFIG_EXT3_INDEX
963957
static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
964958
struct ext3_dir_entry_2 **res_dir, int *err)
965959
{
@@ -1027,7 +1021,6 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
10271021
dx_release (frames);
10281022
return NULL;
10291023
}
1030-
#endif
10311024

10321025
static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
10331026
{
@@ -1123,7 +1116,6 @@ static inline void ext3_set_de_type(struct super_block *sb,
11231116
de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
11241117
}
11251118

1126-
#ifdef CONFIG_EXT3_INDEX
11271119
/*
11281120
* Move count entries from end of map between two memory locations.
11291121
* Returns pointer to last entry moved.
@@ -1268,7 +1260,6 @@ static struct ext3_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
12681260
*error = err;
12691261
return NULL;
12701262
}
1271-
#endif
12721263

12731264

12741265
/*
@@ -1366,7 +1357,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
13661357
return 0;
13671358
}
13681359

1369-
#ifdef CONFIG_EXT3_INDEX
13701360
/*
13711361
* This converts a one block unindexed directory to a 3 block indexed
13721362
* directory, and adds the dentry to the indexed directory.
@@ -1445,7 +1435,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
14451435

14461436
return add_dirent_to_buf(handle, dentry, inode, de, bh);
14471437
}
1448-
#endif
14491438

14501439
/*
14511440
* ext3_add_entry()
@@ -1466,17 +1455,14 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
14661455
struct ext3_dir_entry_2 *de;
14671456
struct super_block * sb;
14681457
int retval;
1469-
#ifdef CONFIG_EXT3_INDEX
14701458
int dx_fallback=0;
1471-
#endif
14721459
unsigned blocksize;
14731460
u32 block, blocks;
14741461

14751462
sb = dir->i_sb;
14761463
blocksize = sb->s_blocksize;
14771464
if (!dentry->d_name.len)
14781465
return -EINVAL;
1479-
#ifdef CONFIG_EXT3_INDEX
14801466
if (is_dx(dir)) {
14811467
retval = ext3_dx_add_entry(handle, dentry, inode);
14821468
if (!retval || (retval != ERR_BAD_DX_DIR))
@@ -1485,7 +1471,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
14851471
dx_fallback++;
14861472
ext3_mark_inode_dirty(handle, dir);
14871473
}
1488-
#endif
14891474
blocks = dir->i_size >> sb->s_blocksize_bits;
14901475
for (block = 0, offset = 0; block < blocks; block++) {
14911476
bh = ext3_bread(handle, dir, block, 0, &retval);
@@ -1495,11 +1480,9 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
14951480
if (retval != -ENOSPC)
14961481
return retval;
14971482

1498-
#ifdef CONFIG_EXT3_INDEX
14991483
if (blocks == 1 && !dx_fallback &&
15001484
EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
15011485
return make_indexed_dir(handle, dentry, inode, bh);
1502-
#endif
15031486
brelse(bh);
15041487
}
15051488
bh = ext3_append(handle, dir, &block, &retval);
@@ -1511,7 +1494,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
15111494
return add_dirent_to_buf(handle, dentry, inode, de, bh);
15121495
}
15131496

1514-
#ifdef CONFIG_EXT3_INDEX
15151497
/*
15161498
* Returns 0 for success, or a negative error value
15171499
*/
@@ -1646,7 +1628,6 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
16461628
dx_release(frames);
16471629
return err;
16481630
}
1649-
#endif
16501631

16511632
/*
16521633
* ext3_delete_entry deletes a directory entry by merging it with the

include/linux/ext3_fs.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
3636
#define EXT3_MAX_RESERVE_BLOCKS 1027
3737
#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
38-
/*
39-
* Always enable hashed directories
40-
*/
41-
#define CONFIG_EXT3_INDEX
4238

4339
/*
4440
* Debug code
@@ -665,17 +661,11 @@ struct ext3_dir_entry_2 {
665661
* (c) Daniel Phillips, 2001
666662
*/
667663

668-
#ifdef CONFIG_EXT3_INDEX
669-
#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
670-
EXT3_FEATURE_COMPAT_DIR_INDEX) && \
664+
#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
665+
EXT3_FEATURE_COMPAT_DIR_INDEX) && \
671666
(EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
672667
#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
673668
#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
674-
#else
675-
#define is_dx(dir) 0
676-
#define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX)
677-
#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
678-
#endif
679669

680670
/* Legal values for the dx_root hash_version field: */
681671

0 commit comments

Comments
 (0)