From 97a5284dec2336fef87482ba3509c7ba6353c678 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Mon, 5 Nov 2018 16:48:56 +1100 Subject: [PATCH] LU-11545 debugfs: mask off dir_data flags for ncheck Leaving dir_data flags on filetype will confuse "ncheck -c". This also adds man page and help message for the "-D" option of ls. Change-Id: I5bbaf1b6845eaa6c2b6d97818c174f56b669f27d Signed-off-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/33574 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- debugfs/debugfs.8.in | 7 ++++++- debugfs/ls.c | 2 +- debugfs/ncheck.c | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in index 393c000..3497060 100644 --- a/debugfs/debugfs.8.in +++ b/debugfs/debugfs.8.in @@ -549,7 +549,7 @@ option causes logdump to display old (checkpointed) journal entries. This can be used to try to track down journal problems even after the journal has been replayed. .TP -.BI ls " [-l] [-c] [-d] [-p] [-r] filespec" +.BI ls " [-l] [-c] [-d] [-p] [-r] [-D] filespec" Print a listing of the files in the directory .IR filespec . The @@ -569,6 +569,11 @@ non-printing characters at the end of filenames. The .I \-r flag will force the printing of the filename, even if it is encrypted. +The +.I \-D +flag will print the extra data found inside each entry when the +.I \-l +flag is used. .TP .BI list_deleted_inodes " [limit]" List deleted inodes, optionally limited to those deleted within diff --git a/debugfs/ls.c b/debugfs/ls.c index 1b549b4..2b631f8 100644 --- a/debugfs/ls.c +++ b/debugfs/ls.c @@ -270,7 +270,7 @@ void do_list_dir(int argc, char *argv[]) if (argc > optind+1) { print_usage: - com_err(0, 0, "Usage: ls [-c] [-d] [-l] [-p] [-r] file"); + com_err(0, 0, "Usage: ls [-c] [-d] [-l] [-p] [-r] [-D] file"); return; } diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c index dc4ab56..5936d5d 100644 --- a/debugfs/ncheck.c +++ b/debugfs/ncheck.c @@ -51,6 +51,9 @@ static int ncheck_proc(struct ext2_dir_entry *dirent, iw->position++; if (iw->position <= 2) return 0; + if (current_fs->super->s_feature_incompat & + EXT4_FEATURE_INCOMPAT_DIRDATA) + filetype &= EXT2_FT_MASK; for (i=0; i < iw->num_inodes; i++) { if (iw->iarray[i] == dirent->inode) { if (!iw->parent && !iw->get_pathname_failed) { -- 1.8.3.1