diff options
-rw-r--r-- | fs/ext3/dir.c | 7 | ||||
-rw-r--r-- | fs/ext3/namei.c | 19 | ||||
-rw-r--r-- | include/linux/ext3_fs.h | 14 |
3 files changed, 2 insertions, 38 deletions
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index fd4b6dd71150..c8e4ee3af1d0 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -47,9 +47,7 @@ const struct file_operations ext3_dir_operations = { | |||
47 | .compat_ioctl = ext3_compat_ioctl, | 47 | .compat_ioctl = ext3_compat_ioctl, |
48 | #endif | 48 | #endif |
49 | .fsync = ext3_sync_file, /* BKL held */ | 49 | .fsync = ext3_sync_file, /* BKL held */ |
50 | #ifdef CONFIG_EXT3_INDEX | ||
51 | .release = ext3_release_dir, | 50 | .release = ext3_release_dir, |
52 | #endif | ||
53 | }; | 51 | }; |
54 | 52 | ||
55 | 53 | ||
@@ -107,7 +105,6 @@ static int ext3_readdir(struct file * filp, | |||
107 | 105 | ||
108 | sb = inode->i_sb; | 106 | sb = inode->i_sb; |
109 | 107 | ||
110 | #ifdef CONFIG_EXT3_INDEX | ||
111 | if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb, | 108 | if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb, |
112 | EXT3_FEATURE_COMPAT_DIR_INDEX) && | 109 | EXT3_FEATURE_COMPAT_DIR_INDEX) && |
113 | ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) || | 110 | ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) || |
@@ -123,7 +120,6 @@ static int ext3_readdir(struct file * filp, | |||
123 | */ | 120 | */ |
124 | EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL; | 121 | EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_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_EXT3_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 ext3_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/ext3/namei.c b/fs/ext3/namei.c index c1fa1908dba0..ec8170adac53 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -144,7 +144,6 @@ struct dx_map_entry | |||
144 | u16 size; | 144 | u16 size; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | #ifdef CONFIG_EXT3_INDEX | ||
148 | static inline unsigned dx_get_block (struct dx_entry *entry); | 147 | static inline unsigned dx_get_block (struct dx_entry *entry); |
149 | static void dx_set_block (struct dx_entry *entry, unsigned value); | 148 | static void dx_set_block (struct dx_entry *entry, unsigned value); |
150 | static inline unsigned dx_get_hash (struct dx_entry *entry); | 149 | 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) | |||
768 | dx_set_block(new, block); | 767 | dx_set_block(new, block); |
769 | dx_set_count(entries, count + 1); | 768 | dx_set_count(entries, count + 1); |
770 | } | 769 | } |
771 | #endif | ||
772 | |||
773 | 770 | ||
774 | static void ext3_update_dx_flag(struct inode *inode) | 771 | static void ext3_update_dx_flag(struct inode *inode) |
775 | { | 772 | { |
@@ -871,7 +868,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry, | |||
871 | name = dentry->d_name.name; | 868 | name = dentry->d_name.name; |
872 | if (namelen > EXT3_NAME_LEN) | 869 | if (namelen > EXT3_NAME_LEN) |
873 | return NULL; | 870 | return NULL; |
874 | #ifdef CONFIG_EXT3_INDEX | ||
875 | if (is_dx(dir)) { | 871 | if (is_dx(dir)) { |
876 | bh = ext3_dx_find_entry(dentry, res_dir, &err); | 872 | bh = ext3_dx_find_entry(dentry, res_dir, &err); |
877 | /* | 873 | /* |
@@ -883,7 +879,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry, | |||
883 | return bh; | 879 | return bh; |
884 | dxtrace(printk("ext3_find_entry: dx failed, falling back\n")); | 880 | dxtrace(printk("ext3_find_entry: dx failed, falling back\n")); |
885 | } | 881 | } |
886 | #endif | ||
887 | nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb); | 882 | nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb); |
888 | start = EXT3_I(dir)->i_dir_start_lookup; | 883 | start = EXT3_I(dir)->i_dir_start_lookup; |
889 | if (start >= nblocks) | 884 | if (start >= nblocks) |
@@ -959,7 +954,6 @@ cleanup_and_exit: | |||
959 | return ret; | 954 | return ret; |
960 | } | 955 | } |
961 | 956 | ||
962 | #ifdef CONFIG_EXT3_INDEX | ||
963 | static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, | 957 | static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, |
964 | struct ext3_dir_entry_2 **res_dir, int *err) | 958 | struct ext3_dir_entry_2 **res_dir, int *err) |
965 | { | 959 | { |
@@ -1027,7 +1021,6 @@ errout: | |||
1027 | dx_release (frames); | 1021 | dx_release (frames); |
1028 | return NULL; | 1022 | return NULL; |
1029 | } | 1023 | } |
1030 | #endif | ||
1031 | 1024 | ||
1032 | static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) | 1025 | static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) |
1033 | { | 1026 | { |
@@ -1123,7 +1116,6 @@ static inline void ext3_set_de_type(struct super_block *sb, | |||
1123 | de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; | 1116 | de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; |
1124 | } | 1117 | } |
1125 | 1118 | ||
1126 | #ifdef CONFIG_EXT3_INDEX | ||
1127 | /* | 1119 | /* |
1128 | * Move count entries from end of map between two memory locations. | 1120 | * Move count entries from end of map between two memory locations. |
1129 | * Returns pointer to last entry moved. | 1121 | * Returns pointer to last entry moved. |
@@ -1268,7 +1260,6 @@ errout: | |||
1268 | *error = err; | 1260 | *error = err; |
1269 | return NULL; | 1261 | return NULL; |
1270 | } | 1262 | } |
1271 | #endif | ||
1272 | 1263 | ||
1273 | 1264 | ||
1274 | /* | 1265 | /* |
@@ -1366,7 +1357,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
1366 | return 0; | 1357 | return 0; |
1367 | } | 1358 | } |
1368 | 1359 | ||
1369 | #ifdef CONFIG_EXT3_INDEX | ||
1370 | /* | 1360 | /* |
1371 | * This converts a one block unindexed directory to a 3 block indexed | 1361 | * This converts a one block unindexed directory to a 3 block indexed |
1372 | * directory, and adds the dentry to the indexed directory. | 1362 | * directory, and adds the dentry to the indexed directory. |
@@ -1445,7 +1435,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1445 | 1435 | ||
1446 | return add_dirent_to_buf(handle, dentry, inode, de, bh); | 1436 | return add_dirent_to_buf(handle, dentry, inode, de, bh); |
1447 | } | 1437 | } |
1448 | #endif | ||
1449 | 1438 | ||
1450 | /* | 1439 | /* |
1451 | * ext3_add_entry() | 1440 | * ext3_add_entry() |
@@ -1466,9 +1455,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1466 | struct ext3_dir_entry_2 *de; | 1455 | struct ext3_dir_entry_2 *de; |
1467 | struct super_block * sb; | 1456 | struct super_block * sb; |
1468 | int retval; | 1457 | int retval; |
1469 | #ifdef CONFIG_EXT3_INDEX | ||
1470 | int dx_fallback=0; | 1458 | int dx_fallback=0; |
1471 | #endif | ||
1472 | unsigned blocksize; | 1459 | unsigned blocksize; |
1473 | u32 block, blocks; | 1460 | u32 block, blocks; |
1474 | 1461 | ||
@@ -1476,7 +1463,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1476 | blocksize = sb->s_blocksize; | 1463 | blocksize = sb->s_blocksize; |
1477 | if (!dentry->d_name.len) | 1464 | if (!dentry->d_name.len) |
1478 | return -EINVAL; | 1465 | return -EINVAL; |
1479 | #ifdef CONFIG_EXT3_INDEX | ||
1480 | if (is_dx(dir)) { | 1466 | if (is_dx(dir)) { |
1481 | retval = ext3_dx_add_entry(handle, dentry, inode); | 1467 | retval = ext3_dx_add_entry(handle, dentry, inode); |
1482 | if (!retval || (retval != ERR_BAD_DX_DIR)) | 1468 | if (!retval || (retval != ERR_BAD_DX_DIR)) |
@@ -1485,7 +1471,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1485 | dx_fallback++; | 1471 | dx_fallback++; |
1486 | ext3_mark_inode_dirty(handle, dir); | 1472 | ext3_mark_inode_dirty(handle, dir); |
1487 | } | 1473 | } |
1488 | #endif | ||
1489 | blocks = dir->i_size >> sb->s_blocksize_bits; | 1474 | blocks = dir->i_size >> sb->s_blocksize_bits; |
1490 | for (block = 0, offset = 0; block < blocks; block++) { | 1475 | for (block = 0, offset = 0; block < blocks; block++) { |
1491 | bh = ext3_bread(handle, dir, block, 0, &retval); | 1476 | bh = ext3_bread(handle, dir, block, 0, &retval); |
@@ -1495,11 +1480,9 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1495 | if (retval != -ENOSPC) | 1480 | if (retval != -ENOSPC) |
1496 | return retval; | 1481 | return retval; |
1497 | 1482 | ||
1498 | #ifdef CONFIG_EXT3_INDEX | ||
1499 | if (blocks == 1 && !dx_fallback && | 1483 | if (blocks == 1 && !dx_fallback && |
1500 | EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX)) | 1484 | EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX)) |
1501 | return make_indexed_dir(handle, dentry, inode, bh); | 1485 | return make_indexed_dir(handle, dentry, inode, bh); |
1502 | #endif | ||
1503 | brelse(bh); | 1486 | brelse(bh); |
1504 | } | 1487 | } |
1505 | bh = ext3_append(handle, dir, &block, &retval); | 1488 | bh = ext3_append(handle, dir, &block, &retval); |
@@ -1511,7 +1494,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1511 | return add_dirent_to_buf(handle, dentry, inode, de, bh); | 1494 | return add_dirent_to_buf(handle, dentry, inode, de, bh); |
1512 | } | 1495 | } |
1513 | 1496 | ||
1514 | #ifdef CONFIG_EXT3_INDEX | ||
1515 | /* | 1497 | /* |
1516 | * Returns 0 for success, or a negative error value | 1498 | * Returns 0 for success, or a negative error value |
1517 | */ | 1499 | */ |
@@ -1646,7 +1628,6 @@ cleanup: | |||
1646 | dx_release(frames); | 1628 | dx_release(frames); |
1647 | return err; | 1629 | return err; |
1648 | } | 1630 | } |
1649 | #endif | ||
1650 | 1631 | ||
1651 | /* | 1632 | /* |
1652 | * ext3_delete_entry deletes a directory entry by merging it with the | 1633 | * ext3_delete_entry deletes a directory entry by merging it with the |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index ece49a804fe1..589b0b355d84 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -35,10 +35,6 @@ | |||
35 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ | 35 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ |
36 | #define EXT3_MAX_RESERVE_BLOCKS 1027 | 36 | #define EXT3_MAX_RESERVE_BLOCKS 1027 |
37 | #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 | 37 | #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 |
38 | /* | ||
39 | * Always enable hashed directories | ||
40 | */ | ||
41 | #define CONFIG_EXT3_INDEX | ||
42 | 38 | ||
43 | /* | 39 | /* |
44 | * Debug code | 40 | * Debug code |
@@ -665,17 +661,11 @@ struct ext3_dir_entry_2 { | |||
665 | * (c) Daniel Phillips, 2001 | 661 | * (c) Daniel Phillips, 2001 |
666 | */ | 662 | */ |
667 | 663 | ||
668 | #ifdef CONFIG_EXT3_INDEX | 664 | #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \ |
669 | #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \ | 665 | EXT3_FEATURE_COMPAT_DIR_INDEX) && \ |
670 | EXT3_FEATURE_COMPAT_DIR_INDEX) && \ | ||
671 | (EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) | 666 | (EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) |
672 | #define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX) | 667 | #define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX) |
673 | #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) | 668 | #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 | ||
679 | 669 | ||
680 | /* Legal values for the dx_root hash_version field: */ | 670 | /* Legal values for the dx_root hash_version field: */ |
681 | 671 | ||