diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-11-05 00:14:04 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-11-05 00:14:04 -0500 |
commit | 498e5f24158da7bf8fa48074a70e370e22844492 (patch) | |
tree | 1434b349c8eca3b0667af0b385533cbcd599c1c3 /fs/ext4/namei.c | |
parent | a9df9a49102f3578909cba7bd33784eb3b9caaa4 (diff) |
ext4: Change unsigned long to unsigned int
Convert the unsigned longs that are most responsible for bloating the
stack usage on 64-bit systems.
Nearly all places in the ext3/4 code which uses "unsigned long" is
probably a bug, since on 32-bit systems a ulong a 32-bits, which means
we are wasting stack space on 64-bit systems.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r-- | fs/ext4/namei.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 08873e938ab2..183a09a8b14e 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -811,7 +811,7 @@ static inline int ext4_match (int len, const char * const name, | |||
811 | static inline int search_dirblock(struct buffer_head *bh, | 811 | static inline int search_dirblock(struct buffer_head *bh, |
812 | struct inode *dir, | 812 | struct inode *dir, |
813 | const struct qstr *d_name, | 813 | const struct qstr *d_name, |
814 | unsigned long offset, | 814 | unsigned int offset, |
815 | struct ext4_dir_entry_2 ** res_dir) | 815 | struct ext4_dir_entry_2 ** res_dir) |
816 | { | 816 | { |
817 | struct ext4_dir_entry_2 * de; | 817 | struct ext4_dir_entry_2 * de; |
@@ -1048,11 +1048,11 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru | |||
1048 | bh = ext4_find_entry(dir, &dentry->d_name, &de); | 1048 | bh = ext4_find_entry(dir, &dentry->d_name, &de); |
1049 | inode = NULL; | 1049 | inode = NULL; |
1050 | if (bh) { | 1050 | if (bh) { |
1051 | unsigned long ino = le32_to_cpu(de->inode); | 1051 | __u32 ino = le32_to_cpu(de->inode); |
1052 | brelse(bh); | 1052 | brelse(bh); |
1053 | if (!ext4_valid_inum(dir->i_sb, ino)) { | 1053 | if (!ext4_valid_inum(dir->i_sb, ino)) { |
1054 | ext4_error(dir->i_sb, "ext4_lookup", | 1054 | ext4_error(dir->i_sb, "ext4_lookup", |
1055 | "bad inode number: %lu", ino); | 1055 | "bad inode number: %u", ino); |
1056 | return ERR_PTR(-EIO); | 1056 | return ERR_PTR(-EIO); |
1057 | } | 1057 | } |
1058 | inode = ext4_iget(dir->i_sb, ino); | 1058 | inode = ext4_iget(dir->i_sb, ino); |
@@ -1065,7 +1065,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru | |||
1065 | 1065 | ||
1066 | struct dentry *ext4_get_parent(struct dentry *child) | 1066 | struct dentry *ext4_get_parent(struct dentry *child) |
1067 | { | 1067 | { |
1068 | unsigned long ino; | 1068 | __u32 ino; |
1069 | struct inode *inode; | 1069 | struct inode *inode; |
1070 | static const struct qstr dotdot = { | 1070 | static const struct qstr dotdot = { |
1071 | .name = "..", | 1071 | .name = "..", |
@@ -1083,7 +1083,7 @@ struct dentry *ext4_get_parent(struct dentry *child) | |||
1083 | 1083 | ||
1084 | if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { | 1084 | if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { |
1085 | ext4_error(child->d_inode->i_sb, "ext4_get_parent", | 1085 | ext4_error(child->d_inode->i_sb, "ext4_get_parent", |
1086 | "bad inode number: %lu", ino); | 1086 | "bad inode number: %u", ino); |
1087 | return ERR_PTR(-EIO); | 1087 | return ERR_PTR(-EIO); |
1088 | } | 1088 | } |
1089 | 1089 | ||
@@ -1271,7 +1271,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
1271 | struct inode *dir = dentry->d_parent->d_inode; | 1271 | struct inode *dir = dentry->d_parent->d_inode; |
1272 | const char *name = dentry->d_name.name; | 1272 | const char *name = dentry->d_name.name; |
1273 | int namelen = dentry->d_name.len; | 1273 | int namelen = dentry->d_name.len; |
1274 | unsigned long offset = 0; | 1274 | unsigned int offset = 0; |
1275 | unsigned short reclen; | 1275 | unsigned short reclen; |
1276 | int nlen, rlen, err; | 1276 | int nlen, rlen, err; |
1277 | char *top; | 1277 | char *top; |
@@ -1444,7 +1444,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, | |||
1444 | struct inode *inode) | 1444 | struct inode *inode) |
1445 | { | 1445 | { |
1446 | struct inode *dir = dentry->d_parent->d_inode; | 1446 | struct inode *dir = dentry->d_parent->d_inode; |
1447 | unsigned long offset; | ||
1448 | struct buffer_head *bh; | 1447 | struct buffer_head *bh; |
1449 | struct ext4_dir_entry_2 *de; | 1448 | struct ext4_dir_entry_2 *de; |
1450 | struct super_block *sb; | 1449 | struct super_block *sb; |
@@ -1466,7 +1465,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, | |||
1466 | ext4_mark_inode_dirty(handle, dir); | 1465 | ext4_mark_inode_dirty(handle, dir); |
1467 | } | 1466 | } |
1468 | blocks = dir->i_size >> sb->s_blocksize_bits; | 1467 | blocks = dir->i_size >> sb->s_blocksize_bits; |
1469 | for (block = 0, offset = 0; block < blocks; block++) { | 1468 | for (block = 0; block < blocks; block++) { |
1470 | bh = ext4_bread(handle, dir, block, 0, &retval); | 1469 | bh = ext4_bread(handle, dir, block, 0, &retval); |
1471 | if(!bh) | 1470 | if(!bh) |
1472 | return retval; | 1471 | return retval; |
@@ -1861,7 +1860,7 @@ out_stop: | |||
1861 | */ | 1860 | */ |
1862 | static int empty_dir(struct inode *inode) | 1861 | static int empty_dir(struct inode *inode) |
1863 | { | 1862 | { |
1864 | unsigned long offset; | 1863 | unsigned int offset; |
1865 | struct buffer_head *bh; | 1864 | struct buffer_head *bh; |
1866 | struct ext4_dir_entry_2 *de, *de1; | 1865 | struct ext4_dir_entry_2 *de, *de1; |
1867 | struct super_block *sb; | 1866 | struct super_block *sb; |
@@ -1906,7 +1905,7 @@ static int empty_dir(struct inode *inode) | |||
1906 | if (err) | 1905 | if (err) |
1907 | ext4_error(sb, __func__, | 1906 | ext4_error(sb, __func__, |
1908 | "error %d reading directory" | 1907 | "error %d reading directory" |
1909 | " #%lu offset %lu", | 1908 | " #%lu offset %u", |
1910 | err, inode->i_ino, offset); | 1909 | err, inode->i_ino, offset); |
1911 | offset += sb->s_blocksize; | 1910 | offset += sb->s_blocksize; |
1912 | continue; | 1911 | continue; |
@@ -2009,7 +2008,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) | |||
2009 | struct list_head *prev; | 2008 | struct list_head *prev; |
2010 | struct ext4_inode_info *ei = EXT4_I(inode); | 2009 | struct ext4_inode_info *ei = EXT4_I(inode); |
2011 | struct ext4_sb_info *sbi; | 2010 | struct ext4_sb_info *sbi; |
2012 | unsigned long ino_next; | 2011 | __u32 ino_next; |
2013 | struct ext4_iloc iloc; | 2012 | struct ext4_iloc iloc; |
2014 | int err = 0; | 2013 | int err = 0; |
2015 | 2014 | ||
@@ -2042,7 +2041,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) | |||
2042 | goto out_err; | 2041 | goto out_err; |
2043 | 2042 | ||
2044 | if (prev == &sbi->s_orphan) { | 2043 | if (prev == &sbi->s_orphan) { |
2045 | jbd_debug(4, "superblock will point to %lu\n", ino_next); | 2044 | jbd_debug(4, "superblock will point to %u\n", ino_next); |
2046 | BUFFER_TRACE(sbi->s_sbh, "get_write_access"); | 2045 | BUFFER_TRACE(sbi->s_sbh, "get_write_access"); |
2047 | err = ext4_journal_get_write_access(handle, sbi->s_sbh); | 2046 | err = ext4_journal_get_write_access(handle, sbi->s_sbh); |
2048 | if (err) | 2047 | if (err) |
@@ -2054,7 +2053,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) | |||
2054 | struct inode *i_prev = | 2053 | struct inode *i_prev = |
2055 | &list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode; | 2054 | &list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode; |
2056 | 2055 | ||
2057 | jbd_debug(4, "orphan inode %lu will point to %lu\n", | 2056 | jbd_debug(4, "orphan inode %lu will point to %u\n", |
2058 | i_prev->i_ino, ino_next); | 2057 | i_prev->i_ino, ino_next); |
2059 | err = ext4_reserve_inode_write(handle, i_prev, &iloc2); | 2058 | err = ext4_reserve_inode_write(handle, i_prev, &iloc2); |
2060 | if (err) | 2059 | if (err) |