lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1343735309-30579-15-git-send-email-wenqing.lz@taobao.com>
Date:	Tue, 31 Jul 2012 19:48:07 +0800
From:	Zheng Liu <gnehzuil.liu@...il.com>
To:	linux-ext4@...r.kernel.org
Cc:	Zheng Liu <wenqing.lz@...bao.com>
Subject: [PATCH 14/36 v4] debugfs: make filefrag cmd support inline data

From: Zheng Liu <wenqing.lz@...bao.com>

Inode with inline data haven't any fragmentations.

Signed-off-by: Zheng Liu <wenqing.lz@...bao.com>
---
 debugfs/filefrag.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/debugfs/filefrag.c b/debugfs/filefrag.c
index 7f28bc0..c94396c 100644
--- a/debugfs/filefrag.c
+++ b/debugfs/filefrag.c
@@ -153,16 +153,18 @@ static void filefrag(ext2_ino_t ino, struct ext2_inode *inode,
 		fprintf(fs->f, "\n%s has %llu block(s), i_size is %llu\n",
 			fs->name, num_blocks, EXT2_I_SIZE(inode));
 	}
-	print_header(fs);
-	retval = ext2fs_block_iterate3(current_fs, ino,
-				       BLOCK_FLAG_READ_ONLY, NULL,
-				       filefrag_blocks_proc, fs);
-	if (retval)
-		com_err("ext2fs_block_iterate3", retval, 0);
-
-	report_filefrag(fs);
-	fprintf(fs->f, "%s: %d contiguous extents%s\n", fs->name, fs->ext,
-		LINUX_S_ISDIR(inode->i_mode) ? " (dir)" : "");
+	if (!ext2fs_has_inline_data(current_fs, ino)) {
+		print_header(fs);
+		retval = ext2fs_block_iterate3(current_fs, ino,
+					       BLOCK_FLAG_READ_ONLY, NULL,
+					       filefrag_blocks_proc, fs);
+		if (retval)
+			com_err("ext2fs_block_iterate3", retval, 0);
+
+		report_filefrag(fs);
+		fprintf(fs->f, "%s: %d contiguous extents%s\n", fs->name, fs->ext,
+			LINUX_S_ISDIR(inode->i_mode) ? " (dir)" : "");
+	}
 }
 
 static int filefrag_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
@@ -240,8 +242,12 @@ static void dir_iterate(ext2_ino_t ino, struct filefrag_struct *fs)
 	fs->dir_name = fs->name;
 
 	while (1) {
-		retval = ext2fs_dir_iterate2(current_fs, ino, 0,
-					     0, filefrag_dir_proc, fs);
+		if (ext2fs_has_inline_data(current_fs, ino))
+			retval = ext2fs_inline_data_iterate2(current_fs, ino,
+						0, 0, filefrag_dir_proc, fs);
+		else
+			retval = ext2fs_dir_iterate2(current_fs, ino, 0,
+						     0, filefrag_dir_proc, fs);
 		if (retval)
 			com_err("ext2fs_dir_iterate2", retval, 0);
 		if (p) {
-- 
1.7.4.1

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ