Skip to contentSkip to conversation

ext3: kill 2 useless magic numbers

PATCH In review Li Zefan 3 participants 3 messages Jun 12, 2008

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/2 ext3: kill 2 useless magic numbers

dx_root_limit() will never return 20, and I can't figure out what 20 stands for. This function has never changed since htree directory indexing was merged.

Similar for dx_node_limit() and the magic 22.

---
 fs/ext3/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext3/namei.c +2 -2
index 0b8cf80..d282ea8 100644
@@ -240,13 +240,13 @@ static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize)
 {
 	unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(1) -
 		EXT3_DIR_REC_LEN(2) - infosize;
-	return 0? 20: entry_space / sizeof(struct dx_entry);
+	return entry_space / sizeof(struct dx_entry);
 }
 
 static inline unsigned dx_node_limit (struct inode *dir)
 {
 	unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(0);
-	return 0? 22: entry_space / sizeof(struct dx_entry);
+	return entry_space / sizeof(struct dx_entry);
 }
 
 /*
Signature · 1 line
1.5.4.rc3
Acked-by on v1 1/2
#1 lore raw
Quoted 5 lines · Li Zefan

dx_root_limit() will never return 20, and I can't figure out what 20 stands for. This function has never changed since htree directory indexing was merged.

Similar for dx_node_limit() and the magic 22.

This was for testing htree split code more aggressively, but can be removed.

Quoted 32 lines
---
 fs/ext3/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext3/namei.c +2 -2
index 0b8cf80..d282ea8 100644
@@ -240,13 +240,13 @@ static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize)
 {
 	unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(1) -
 		EXT3_DIR_REC_LEN(2) - infosize;
-	return 0? 20: entry_space / sizeof(struct dx_entry);
+	return entry_space / sizeof(struct dx_entry);
 }
 
 static inline unsigned dx_node_limit (struct inode *dir)
 {
 	unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(0);
-	return 0? 22: entry_space / sizeof(struct dx_entry);
+	return entry_space / sizeof(struct dx_entry);
 }
 
 /*
Signature · 6 lines
1.5.4.rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

#2 lore raw
Quoted 11 lines · Andreas Dilger
Quoted 5 lines · Li Zefan

dx_root_limit() will never return 20, and I can't figure out what 20 stands for. This function has never changed since htree directory indexing was merged.

Similar for dx_node_limit() and the magic 22.

This was for testing htree split code more aggressively, but can be removed.

I added the ext4 version to the patch queue

Mingming

Quoted 44 lines
Quoted 33 lines
---
 fs/ext3/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext3/namei.c +2 -2
index 0b8cf80..d282ea8 100644
@@ -240,13 +240,13 @@ static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize)
 {
 	unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(1) -
 		EXT3_DIR_REC_LEN(2) - infosize;
-	return 0? 20: entry_space / sizeof(struct dx_entry);
+	return entry_space / sizeof(struct dx_entry);
 }
 
 static inline unsigned dx_node_limit (struct inode *dir)
 {
 	unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(0);
-	return 0? 22: entry_space / sizeof(struct dx_entry);
+	return entry_space / sizeof(struct dx_entry);
 }
 
 /*
Signature · 6 lines
1.5.4.rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html