[v3,3/7] debugfs: 64bit inode support

Message ID 20180306151835.4842-4-artem.blagodarenko@gmail.com
State New
Headers show
Series
  • 64bit inode e2fsprogs support
Related show

Commit Message

c17828 March 6, 2018, 3:18 p.m.
New dirdata type EXT2_DIRENT_INODE is added.

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-9309
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
---
 debugfs/ls.c         | 6 ++++--
 lib/ext2fs/ext2_fs.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Andreas Dilger March 8, 2018, 5:36 a.m. | #1
> On Mar 6, 2018, at 8:18 AM, Artem Blagodarenko <artem.blagodarenko@gmail.com> wrote:
> 
> New dirdata type EXT2_DIRENT_INODE is added.
> 
> Lustre-bug: https://jira.hpdd.intel.com/browse/LU-9309
> Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> ---
> debugfs/ls.c         | 6 ++++--
> lib/ext2fs/ext2_fs.h | 1 +
> 2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/debugfs/ls.c b/debugfs/ls.c
> index a7a5dae8..57b84c7e 100644
> --- a/debugfs/ls.c
> +++ b/debugfs/ls.c
> @@ -87,11 +87,13 @@ static void list_dirdata(struct list_dir_struct *ls,
> 
> 		dlen = data[0];
> 
> -		if (dirdata_mask == EXT2_DIRENT_LUFID) {
> +		if (dirdata_mask == EXT2_DIRENT_INODE) {
> +			fprintf(ls->f, "ino64:%04\n", *(__u32 *)(data + 1));
> +		} else if (dirdata_mask == EXT2_DIRENT_LUFID) {
> 			struct lu_fid *fid = (struct lu_fid *)(data + 1);
> 
> 			fid_be_to_cpu(fid, fid);
> -			fprintf(ls->f, DFID, PFID(fid));
> +			fprintf(ls->f, "fid:"DFID, PFID(fid));

My only suggestion might be to include the "fid:" prefix in the original
1/7 patch so that the 4/7 test works properly regardless of whether this
patch is applied or not.

> 		} else {
> 			int i;
> 
> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
> index 9de6bdf9..980072f7 100644
> --- a/lib/ext2fs/ext2_fs.h
> +++ b/lib/ext2fs/ext2_fs.h
> @@ -1041,6 +1041,7 @@ struct ext2_dir_entry_tail {
> /* lu_fid size and NUL char */
> #define EXT2_DIRENT_LUFID_SIZE		16
> #define EXT2_DIRENT_LUFID		0x10
> +#define EXT2_DIRENT_INODE		0x20
> 
> /*
>  * Constants for ext4's extended time encoding
> --
> 2.14.3 (Apple Git-98)
> 


Cheers, Andreas

Patch

diff --git a/debugfs/ls.c b/debugfs/ls.c
index a7a5dae8..57b84c7e 100644
--- a/debugfs/ls.c
+++ b/debugfs/ls.c
@@ -87,11 +87,13 @@  static void list_dirdata(struct list_dir_struct *ls,
 
 		dlen = data[0];
 
-		if (dirdata_mask == EXT2_DIRENT_LUFID) {
+		if (dirdata_mask == EXT2_DIRENT_INODE) {
+			fprintf(ls->f, "ino64:%04\n", *(__u32 *)(data + 1));
+		} else if (dirdata_mask == EXT2_DIRENT_LUFID) {
 			struct lu_fid *fid = (struct lu_fid *)(data + 1);
 
 			fid_be_to_cpu(fid, fid);
-			fprintf(ls->f, DFID, PFID(fid));
+			fprintf(ls->f, "fid:"DFID, PFID(fid));
 		} else {
 			int i;
 
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 9de6bdf9..980072f7 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -1041,6 +1041,7 @@  struct ext2_dir_entry_tail {
 /* lu_fid size and NUL char */
 #define EXT2_DIRENT_LUFID_SIZE		16
 #define EXT2_DIRENT_LUFID		0x10
+#define EXT2_DIRENT_INODE		0x20
 
 /*
  * Constants for ext4's extended time encoding