[PATCH v2 2/2] debugfs: output large directory size

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

 



large_dir option allows to create directory with size > 2GB.
debugfs utility outputs negative size value for large directories
and ignores high part of directory size.

Fix debugfs to use high part of directory size in debugfs output
and use appropriate output format.

Signed-off-by: Artem Blagodarenko <artem.blagodarenko@xxxxxxxxx>
---
 debugfs/debugfs.c | 2 +-
 debugfs/ls.c      | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index e03519c4..2e600b92 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -848,7 +848,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
 	if (is_large_inode && large_inode->i_extra_isize >= 32)
 		fprintf(out, "   Project: %5d", large_inode->i_projid);
 	fputs("   Size: ", out);
-	if (LINUX_S_ISREG(inode->i_mode))
+	if (LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode))
 		fprintf(out, "%llu\n", EXT2_I_SIZE(inode));
 	else
 		fprintf(out, "%d\n", inode->i_size);
diff --git a/debugfs/ls.c b/debugfs/ls.c
index a1e8f4e9..41af15d2 100644
--- a/debugfs/ls.c
+++ b/debugfs/ls.c
@@ -152,9 +152,6 @@ static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
 		fprintf(ls->f, "(%d)  %5d  %5d   ",
 			ext2fs_dirent_file_type(dirent),
 			inode_uid(inode), inode_gid(inode));
-		if (LINUX_S_ISDIR(inode.i_mode))
-			fprintf(ls->f, "%5d", inode.i_size);
-		else
 			fprintf(ls->f, "%5llu", EXT2_I_SIZE(&inode));
 		fprintf(ls->f, " %s ", datestr);
 		print_filename(ls->f, dirent, options);
-- 
2.14.3




[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