linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs_logprint: handle the log split of inode item correctly
@ 2017-01-11 13:38 Hou Tao
  2017-01-12 13:34 ` Brian Foster
  0 siblings, 1 reply; 7+ messages in thread
From: Hou Tao @ 2017-01-11 13:38 UTC (permalink / raw)
  To: linux-xfs; +Cc: sandeen

It is possible that the data fork or the attribute fork
of an inode will be splitted to the next log record, so
we need to check the count of available operations
in the log record and calculate the count of skipped
operations properly.

Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 logprint/log_misc.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index a0f1766..20f0f89 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -524,6 +524,7 @@ xlog_print_trans_inode(
     xfs_inode_log_format_t *f;
     int			   mode;
     int			   size;
+    int			   printed_ops;
 
     /*
      * print inode type header region
@@ -572,13 +573,6 @@ xlog_print_trans_inode(
     xlog_print_trans_inode_core(&dino);
     *ptr += xfs_log_dinode_size(dino.di_version);
 
-    if (*i == num_ops-1 && f->ilf_size == 3)  {
-	return 1;
-    }
-
-    /* does anything come next */
-    op_head = (xlog_op_header_t *)*ptr;
-
     switch (f->ilf_fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) {
     case XFS_ILOG_DEV:
 	printf(_("DEV inode: no extra region\n"));
@@ -595,7 +589,13 @@ xlog_print_trans_inode(
     ASSERT(f->ilf_size <= 4);
     ASSERT((f->ilf_size == 3) || (f->ilf_fields & XFS_ILOG_AFORK));
 
+    /* does anything come next */
+    printed_ops = 2;
+    op_head = (xlog_op_header_t *)*ptr;
+
     if (f->ilf_fields & XFS_ILOG_DFORK) {
+		if (*i == num_ops-1)
+		return f->ilf_size-printed_ops;
 	    (*i)++;
 	    xlog_print_op_header(op_head, *i, ptr);
 
@@ -618,11 +618,14 @@ xlog_print_trans_inode(
 
 	    *ptr += be32_to_cpu(op_head->oh_len);
 	    if (op_head->oh_flags & XLOG_CONTINUE_TRANS)
-		return 1;
+		return f->ilf_size-printed_ops;
 	    op_head = (xlog_op_header_t *)*ptr;
+		printed_ops++;
     }
 
     if (f->ilf_fields & XFS_ILOG_AFORK) {
+		if (*i == num_ops-1)
+		return f->ilf_size-printed_ops;
 	    (*i)++;
 	    xlog_print_op_header(op_head, *i, ptr);
 
@@ -644,7 +647,7 @@ xlog_print_trans_inode(
 	    }
 	    *ptr += be32_to_cpu(op_head->oh_len);
 	    if (op_head->oh_flags & XLOG_CONTINUE_TRANS)
-		return 1;
+		return f->ilf_size-printed_ops;
     }
 
     return 0;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-13 15:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11 13:38 [PATCH] xfs_logprint: handle the log split of inode item correctly Hou Tao
2017-01-12 13:34 ` Brian Foster
2017-01-12 14:38   ` Eric Sandeen
2017-01-13  3:28     ` Hou Tao
2017-01-13  3:32       ` Eric Sandeen
2017-01-13  4:23         ` Hou Tao
2017-01-13 15:49       ` Brian Foster

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).