[PATCH 10/21] ext2fs: Fixup inline directory test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inline directory test had hardwired number of reserved inodes. Fix the
test to read the first available inode number from the superblock.

Signed-off-by: Jan Kara <jack@xxxxxxxx>
---
 lib/ext2fs/inline_data.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c
index 6260c5f35c1a..98c732bb2e3c 100644
--- a/lib/ext2fs/inline_data.c
+++ b/lib/ext2fs/inline_data.c
@@ -706,22 +706,23 @@ static errcode_t dir_test(ext2_filsys fs)
 	errcode_t retval;
 	char dirname[PATH_MAX];
 	int i;
+	ext2_ino_t ino = EXT2_FIRST_INO(fs->super);
 
-	retval = ext2fs_mkdir(fs, 11, 11, stub_name);
+	retval = ext2fs_mkdir(fs, ino, ino, stub_name);
 	if (retval) {
 		com_err("dir_test", retval, "while creating %s dir", stub_name);
 		return retval;
 	}
 
-	retval = ext2fs_mkdir(fs, 11, 0, parent_name);
+	retval = ext2fs_mkdir(fs, ino, 0, parent_name);
 	if (retval) {
 		com_err("dir_test", retval,
 			"while creating %s dir", parent_name);
 		return retval;
 	}
 
-	retval = ext2fs_lookup(fs, 11, parent_name, strlen(parent_name),
-			       0, &parent);
+	retval = ext2fs_lookup(fs, ino, parent_name,
+			       strlen(parent_name), 0, &parent);
 	if (retval) {
 		com_err("dir_test", retval,
 			"while looking up %s dir", parent_name);
@@ -742,7 +743,7 @@ static errcode_t dir_test(ext2_filsys fs)
 		return 1;
 	}
 
-	for (i = 0, dir = 13; i < 4; i++, dir++) {
+	for (i = 0, dir = ino + 2; i < 4; i++, dir++) {
 		tmp = 0;
 		snprintf(dirname, sizeof(dirname), "%d", i);
 		retval = ext2fs_mkdir(fs, parent, 0, dirname);
-- 
2.1.4

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



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux