linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: alexey.lyashkov@gmail.com
To: linux-ext4@vger.kernel.org
Cc: Alexey Lyashkov <alexey.lyashkov@seagate.com>
Subject: [PATCH 1/3] block number output fix.
Date: Mon, 19 Nov 2018 12:16:48 +0300	[thread overview]
Message-ID: <20181119091650.81803-2-alexey.lyashkov@gmail.com> (raw)
In-Reply-To: <20181119091650.81803-1-alexey.lyashkov@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 44 bytes --]

This is a multi-part message in MIME format.

[-- Attachment #2: Type: text/plain, Size: 186 bytes --]


debugfs lack a support journal tag v3 and block numbers over 2^32
fix it.
---
 debugfs/logdump.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-block-number-output-fix.patch --]
[-- Type: text/x-patch; name="0001-block-number-output-fix.patch", Size: 3592 bytes --]

diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index e286ae83..84108a6e 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -58,11 +58,11 @@ static void dump_descriptor_block(FILE *, struct journal_source *,
 				  unsigned int *, int, tid_t);
 
 static void dump_revoke_block(FILE *, char *, journal_superblock_t *,
-				  unsigned int, int, tid_t);
+				  blk64_t, int, tid_t);
 
 static void dump_metadata_block(FILE *, struct journal_source *,
 				journal_superblock_t*,
-				unsigned int, unsigned int, unsigned int,
+				unsigned int, blk64_t, unsigned int,
 				int, tid_t);
 
 static void do_hexdump (FILE *, char *, int);
@@ -496,6 +496,16 @@ static inline size_t journal_super_tag_bytes(journal_superblock_t *jsb)
 	return sz - sizeof(__u32);
 }
 
+static blk64_t tag_blocknr(journal_superblock_t *jsb,
+			      journal_block_tag_t *tag)
+{
+	blk64_t block = be32_to_cpu(tag->t_blocknr);
+
+	if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_64BIT))
+		block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32;
+	return block;
+}
+
 static void dump_descriptor_block(FILE *out_file,
 				  struct journal_source *source,
 				  char *buf,
@@ -507,7 +517,7 @@ static void dump_descriptor_block(FILE *out_file,
 	char			*tagp;
 	journal_block_tag_t	*tag;
 	unsigned int		blocknr;
-	__u32			tag_block;
+	blk64_t			tag_block;
 	__u32			tag_flags;
 
 	tag_size = journal_super_tag_bytes(jsb);
@@ -537,7 +547,7 @@ static void dump_descriptor_block(FILE *out_file,
 		if (offset > blocksize - csum_size)
 			break;
 
-		tag_block = be32_to_cpu(tag->t_blocknr);
+		tag_block = tag_blocknr(jsb, tag);
 		tag_flags = be16_to_cpu(tag->t_flags);
 
 		if (!(tag_flags & JFS_FLAG_SAME_UUID))
@@ -558,7 +568,7 @@ static void dump_descriptor_block(FILE *out_file,
 
 static void dump_revoke_block(FILE *out_file, char *buf,
 			      journal_superblock_t *jsb EXT2FS_ATTR((unused)),
-			      unsigned int blocknr,
+			      blk64_t blocknr,
 			      int blocksize EXT2FS_ATTR((unused)),
 			      tid_t transaction)
 {
@@ -569,9 +579,9 @@ static void dump_revoke_block(FILE *out_file, char *buf,
 
 	if (dump_all)
 		fprintf(out_file, "Dumping revoke block, sequence %u, at "
-			"block %u:\n", transaction, blocknr);
+			"block %llu:\n", transaction, blocknr);
 
-	if (be32_to_cpu(jsb->s_feature_incompat) & JFS_FEATURE_INCOMPAT_64BIT)
+	if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_64BIT))
 		tag_size = sizeof(__u64);
 
 	header = (journal_revoke_header_t *) buf;
@@ -591,7 +601,7 @@ static void dump_revoke_block(FILE *out_file, char *buf,
 			if (dump_all)
 				fprintf(out_file, "\n");
 			else
-				fprintf(out_file," at block %u, sequence %u\n",
+				fprintf(out_file," at block %llu, sequence %u\n",
 					blocknr, transaction);
 		}
 		offset += tag_size;
@@ -617,7 +627,7 @@ static void show_indirect(FILE *out_file, const char *name, __u32 where)
 static void dump_metadata_block(FILE *out_file, struct journal_source *source,
 				journal_superblock_t *jsb EXT2FS_ATTR((unused)),
 				unsigned int log_blocknr,
-				unsigned int fs_blocknr,
+				blk64_t fs_blocknr,
 				unsigned int log_tag_flags,
 				int blocksize,
 				tid_t transaction)
@@ -631,7 +641,7 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source,
 	      || (fs_blocknr == bitmap_to_dump)))
 		return;
 
-	fprintf(out_file, "  FS block %u logged at ", fs_blocknr);
+	fprintf(out_file, "  FS block %llu logged at ", fs_blocknr);
 	if (!dump_all)
 		fprintf(out_file, "sequence %u, ", transaction);
 	fprintf(out_file, "journal block %u (flags 0x%x)\n", log_blocknr,

  reply	other threads:[~2018-11-19 19:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19  9:16 [PATCH 0/3] debugfs fixes alexey.lyashkov
2018-11-19  9:16 ` alexey.lyashkov [this message]
2018-11-21 23:33   ` [PATCH 1/3] block number output fix Theodore Y. Ts'o
2018-11-19  9:16 ` [PATCH 2/3] Fix panic with journal superblock flags printing alexey.lyashkov
2018-11-21 23:54   ` Theodore Y. Ts'o
2018-11-22  4:24     ` Alexey Lyashkov
2018-11-22 21:23       ` Theodore Y. Ts'o
2018-11-19  9:16 ` [PATCH 3/3] add support to check a journal checksum v1 while journal dump alexey.lyashkov
2018-11-22  0:07   ` Theodore Y. Ts'o
2018-11-22  5:08     ` Alexey Lyashkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181119091650.81803-2-alexey.lyashkov@gmail.com \
    --to=alexey.lyashkov@gmail.com \
    --cc=alexey.lyashkov@seagate.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).