aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/dir.c7
-rw-r--r--fs/ext4/namei.c20
-rw-r--r--include/linux/ext4_fs.h14
3 files changed, 2 insertions, 39 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 0fb1e62b20d0..f612bef98315 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -47,9 +47,7 @@ const struct file_operations ext4_dir_operations = {
47 .compat_ioctl = ext4_compat_ioctl, 47 .compat_ioctl = ext4_compat_ioctl,
48#endif 48#endif
49 .fsync = ext4_sync_file, /* BKL held */ 49 .fsync = ext4_sync_file, /* BKL held */
50#ifdef CONFIG_EXT4_INDEX
51 .release = ext4_release_dir, 50 .release = ext4_release_dir,
52#endif
53}; 51};
54 52
55 53
@@ -107,7 +105,6 @@ static int ext4_readdir(struct file * filp,
107 105
108 sb = inode->i_sb; 106 sb = inode->i_sb;
109 107
110#ifdef CONFIG_EXT4_INDEX
111 if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb, 108 if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
112 EXT4_FEATURE_COMPAT_DIR_INDEX) && 109 EXT4_FEATURE_COMPAT_DIR_INDEX) &&
113 ((EXT4_I(inode)->i_flags & EXT4_INDEX_FL) || 110 ((EXT4_I(inode)->i_flags & EXT4_INDEX_FL) ||
@@ -123,7 +120,6 @@ static int ext4_readdir(struct file * filp,
123 */ 120 */
124 EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL; 121 EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
125 } 122 }
126#endif
127 stored = 0; 123 stored = 0;
128 offset = filp->f_pos & (sb->s_blocksize - 1); 124 offset = filp->f_pos & (sb->s_blocksize - 1);
129 125
@@ -232,7 +228,6 @@ out:
232 return ret; 228 return ret;
233} 229}
234 230
235#ifdef CONFIG_EXT4_INDEX
236/* 231/*
237 * These functions convert from the major/minor hash to an f_pos 232 * These functions convert from the major/minor hash to an f_pos
238 * value. 233 * value.
@@ -518,5 +513,3 @@ static int ext4_release_dir (struct inode * inode, struct file * filp)
518 513
519 return 0; 514 return 0;
520} 515}
521
522#endif
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 5fdb862e71c4..94ee6f315dc1 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -144,7 +144,6 @@ struct dx_map_entry
144 u16 size; 144 u16 size;
145}; 145};
146 146
147#ifdef CONFIG_EXT4_INDEX
148static inline unsigned dx_get_block (struct dx_entry *entry); 147static inline unsigned dx_get_block (struct dx_entry *entry);
149static void dx_set_block (struct dx_entry *entry, unsigned value); 148static void dx_set_block (struct dx_entry *entry, unsigned value);
150static inline unsigned dx_get_hash (struct dx_entry *entry); 149static inline unsigned dx_get_hash (struct dx_entry *entry);
@@ -766,8 +765,6 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, u32 block)
766 dx_set_block(new, block); 765 dx_set_block(new, block);
767 dx_set_count(entries, count + 1); 766 dx_set_count(entries, count + 1);
768} 767}
769#endif
770
771 768
772static void ext4_update_dx_flag(struct inode *inode) 769static void ext4_update_dx_flag(struct inode *inode)
773{ 770{
@@ -869,7 +866,6 @@ static struct buffer_head * ext4_find_entry (struct dentry *dentry,
869 name = dentry->d_name.name; 866 name = dentry->d_name.name;
870 if (namelen > EXT4_NAME_LEN) 867 if (namelen > EXT4_NAME_LEN)
871 return NULL; 868 return NULL;
872#ifdef CONFIG_EXT4_INDEX
873 if (is_dx(dir)) { 869 if (is_dx(dir)) {
874 bh = ext4_dx_find_entry(dentry, res_dir, &err); 870 bh = ext4_dx_find_entry(dentry, res_dir, &err);
875 /* 871 /*
@@ -881,7 +877,6 @@ static struct buffer_head * ext4_find_entry (struct dentry *dentry,
881 return bh; 877 return bh;
882 dxtrace(printk("ext4_find_entry: dx failed, falling back\n")); 878 dxtrace(printk("ext4_find_entry: dx failed, falling back\n"));
883 } 879 }
884#endif
885 nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb); 880 nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
886 start = EXT4_I(dir)->i_dir_start_lookup; 881 start = EXT4_I(dir)->i_dir_start_lookup;
887 if (start >= nblocks) 882 if (start >= nblocks)
@@ -957,7 +952,6 @@ cleanup_and_exit:
957 return ret; 952 return ret;
958} 953}
959 954
960#ifdef CONFIG_EXT4_INDEX
961static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry, 955static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry,
962 struct ext4_dir_entry_2 **res_dir, int *err) 956 struct ext4_dir_entry_2 **res_dir, int *err)
963{ 957{
@@ -1025,7 +1019,6 @@ errout:
1025 dx_release (frames); 1019 dx_release (frames);
1026 return NULL; 1020 return NULL;
1027} 1021}
1028#endif
1029 1022
1030static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) 1023static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
1031{ 1024{
@@ -1121,7 +1114,6 @@ static inline void ext4_set_de_type(struct super_block *sb,
1121 de->file_type = ext4_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; 1114 de->file_type = ext4_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
1122} 1115}
1123 1116
1124#ifdef CONFIG_EXT4_INDEX
1125/* 1117/*
1126 * Move count entries from end of map between two memory locations. 1118 * Move count entries from end of map between two memory locations.
1127 * Returns pointer to last entry moved. 1119 * Returns pointer to last entry moved.
@@ -1266,8 +1258,6 @@ errout:
1266 *error = err; 1258 *error = err;
1267 return NULL; 1259 return NULL;
1268} 1260}
1269#endif
1270
1271 1261
1272/* 1262/*
1273 * Add a new entry into a directory (leaf) block. If de is non-NULL, 1263 * Add a new entry into a directory (leaf) block. If de is non-NULL,
@@ -1364,7 +1354,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1364 return 0; 1354 return 0;
1365} 1355}
1366 1356
1367#ifdef CONFIG_EXT4_INDEX
1368/* 1357/*
1369 * This converts a one block unindexed directory to a 3 block indexed 1358 * This converts a one block unindexed directory to a 3 block indexed
1370 * directory, and adds the dentry to the indexed directory. 1359 * directory, and adds the dentry to the indexed directory.
@@ -1443,7 +1432,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1443 1432
1444 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1433 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1445} 1434}
1446#endif
1447 1435
1448/* 1436/*
1449 * ext4_add_entry() 1437 * ext4_add_entry()
@@ -1464,9 +1452,7 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1464 struct ext4_dir_entry_2 *de; 1452 struct ext4_dir_entry_2 *de;
1465 struct super_block * sb; 1453 struct super_block * sb;
1466 int retval; 1454 int retval;
1467#ifdef CONFIG_EXT4_INDEX
1468 int dx_fallback=0; 1455 int dx_fallback=0;
1469#endif
1470 unsigned blocksize; 1456 unsigned blocksize;
1471 u32 block, blocks; 1457 u32 block, blocks;
1472 1458
@@ -1474,7 +1460,6 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1474 blocksize = sb->s_blocksize; 1460 blocksize = sb->s_blocksize;
1475 if (!dentry->d_name.len) 1461 if (!dentry->d_name.len)
1476 return -EINVAL; 1462 return -EINVAL;
1477#ifdef CONFIG_EXT4_INDEX
1478 if (is_dx(dir)) { 1463 if (is_dx(dir)) {
1479 retval = ext4_dx_add_entry(handle, dentry, inode); 1464 retval = ext4_dx_add_entry(handle, dentry, inode);
1480 if (!retval || (retval != ERR_BAD_DX_DIR)) 1465 if (!retval || (retval != ERR_BAD_DX_DIR))
@@ -1483,7 +1468,6 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1483 dx_fallback++; 1468 dx_fallback++;
1484 ext4_mark_inode_dirty(handle, dir); 1469 ext4_mark_inode_dirty(handle, dir);
1485 } 1470 }
1486#endif
1487 blocks = dir->i_size >> sb->s_blocksize_bits; 1471 blocks = dir->i_size >> sb->s_blocksize_bits;
1488 for (block = 0, offset = 0; block < blocks; block++) { 1472 for (block = 0, offset = 0; block < blocks; block++) {
1489 bh = ext4_bread(handle, dir, block, 0, &retval); 1473 bh = ext4_bread(handle, dir, block, 0, &retval);
@@ -1493,11 +1477,9 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1493 if (retval != -ENOSPC) 1477 if (retval != -ENOSPC)
1494 return retval; 1478 return retval;
1495 1479
1496#ifdef CONFIG_EXT4_INDEX
1497 if (blocks == 1 && !dx_fallback && 1480 if (blocks == 1 && !dx_fallback &&
1498 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) 1481 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
1499 return make_indexed_dir(handle, dentry, inode, bh); 1482 return make_indexed_dir(handle, dentry, inode, bh);
1500#endif
1501 brelse(bh); 1483 brelse(bh);
1502 } 1484 }
1503 bh = ext4_append(handle, dir, &block, &retval); 1485 bh = ext4_append(handle, dir, &block, &retval);
@@ -1509,7 +1491,6 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1509 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1491 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1510} 1492}
1511 1493
1512#ifdef CONFIG_EXT4_INDEX
1513/* 1494/*
1514 * Returns 0 for success, or a negative error value 1495 * Returns 0 for success, or a negative error value
1515 */ 1496 */
@@ -1644,7 +1625,6 @@ cleanup:
1644 dx_release(frames); 1625 dx_release(frames);
1645 return err; 1626 return err;
1646} 1627}
1647#endif
1648 1628
1649/* 1629/*
1650 * ext4_delete_entry deletes a directory entry by merging it with the 1630 * ext4_delete_entry deletes a directory entry by merging it with the
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 3baeb996fd3f..151738af6be2 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -36,10 +36,6 @@
36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ 36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37#define EXT4_MAX_RESERVE_BLOCKS 1027 37#define EXT4_MAX_RESERVE_BLOCKS 1027
38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0 38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0
39/*
40 * Always enable hashed directories
41 */
42#define CONFIG_EXT4_INDEX
43 39
44/* 40/*
45 * Debug code 41 * Debug code
@@ -766,17 +762,11 @@ struct ext4_dir_entry_2 {
766 * (c) Daniel Phillips, 2001 762 * (c) Daniel Phillips, 2001
767 */ 763 */
768 764
769#ifdef CONFIG_EXT4_INDEX 765#define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
770 #define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \ 766 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
771 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
772 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) 767 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL))
773#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX) 768#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
774#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) 769#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
775#else
776 #define is_dx(dir) 0
777#define EXT4_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT4_LINK_MAX)
778#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
779#endif
780 770
781/* Legal values for the dx_root hash_version field: */ 771/* Legal values for the dx_root hash_version field: */
782 772