[Devel] [PATCH 05/10] e4defrag2: improve dircache debug

Dmitry Monakhov dmonakhov at openvz.org
Thu Feb 25 02:54:28 PST 2016


Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 misc/e4defrag2.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/misc/e4defrag2.c b/misc/e4defrag2.c
index 886b832..3699a28 100644
--- a/misc/e4defrag2.c
+++ b/misc/e4defrag2.c
@@ -1075,12 +1075,16 @@ static void group_add_dircache(struct defrag_context *dfx, int dirfd, struct sta
 		free(fhp);
 		return;
 	}
+	if (debug_flag & DBG_FS)
+		printf("%s group:%d cache_idx:%d inode:%d\n", __func__, grp, stat->st_ino,
+		       dfx->group[grp]->dir_cached);
 
 	memcpy(dfx->group[grp]->dir_rawh +
 	       dfx->root_fhp->handle_bytes * dfx->group[grp]->dir_cached,
 	       fhp->f_handle, dfx->root_fhp->handle_bytes);
 	dfx->group[grp]->dir_ino[dfx->group[grp]->dir_cached] = stat->st_ino;
 	dfx->group[grp]->dir_cached++;
+
 }
 
 static int scan_inode_pass3(struct defrag_context *dfx, int fd,
@@ -1775,8 +1779,11 @@ static int do_find_donor(struct defrag_context *dfx, dgrp_t group,
 		dir = __do_open_f_handle(dfx, raw_fh, O_RDONLY);
 		if(dir < 0) {
 			if (debug_flag & DBG_SCAN)
-				fprintf(stderr, "Can not open parent handle"
-				       " err:%d\n", errno);
+				fprintf(stderr, "%s: Can not open parent handle for "
+					"grp:%d cache_id:%d inode:%d fid[0]\n"
+					", %m\n", __func__, group, i,
+					dfx->group[group]->dir_ino,
+					((int*)raw_fh)[0]);
 			continue;
 		}
 
-- 
1.8.3.1



More information about the Devel mailing list