]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_logprint: handle log operation split of inode item correctly
authorHou Tao <houtao1@huawei.com>
Thu, 26 Jan 2017 02:02:42 +0000 (20:02 -0600)
committerEric Sandeen <sandeen@redhat.com>
Thu, 26 Jan 2017 02:02:42 +0000 (20:02 -0600)
commit04f1d806a0678878c7ee31c79795ee9584b68010
tree7f42f62bcbfed02db2fce8f8cb78038ca10708ae
parent744a8624813678e2b649e2278fe55157e596272e
xfs_logprint: handle log operation split of inode item correctly

If an inode log item has 4 log operations, and the 4th operation
(attr fork op) is splitted to the next log record due to the size
limitation of log record, xfs_logprint doesn't check whether or not
the 4th operation is in the current log record and print invalid data.

xfs_logprint also needs to calculate the count of splitted log
operations correctly instead of just returning 1.

The following is a diff of the output before and after the patch
is applied:

  =====================================================================
  cycle: 120  version: 2      lsn: 120,11014  tail_lsn: 120,427
  length of Log Record: 32256 prev offset: 10984      num ops: 243
  ......
  h_size: 32768
  ---------------------------------------------------------------------
  Oper (0): tid: 2db4353b  len: 0  clientid: TRANS  flags: START
  ......
  ---------------------------------------------------------------------
  Oper (240): tid: 2db4353b  len: 56  clientid: TRANS  flags: none
  INODE: #regs: 4   ino: 0x200a4bf  flags: 0x45   dsize: 64
          blkno: 10506832  len: 16  boff: 7936
  Oper (241): tid: 2db4353b  len: 96  clientid: TRANS  flags: none
  INODE CORE
  ......
  Oper (242): tid: 2db4353b  len: 64  clientid: TRANS  flags: none
  EXTENTS inode data
 -Oper (243): tid: 150000  len: 83886080  clientid: ERROR  flags: none
 -LOCAL attr data
  =====================================================================
  cycle: 120  version: 2      lsn: 120,11078  tail_lsn: 120,427
  length of Log Record: 3584  prev offset: 11014      num ops: 44
  ......
  h_size: 32768
  ---------------------------------------------------------------------
  Oper (0): tid: 2db4353b  len: 52  clientid: TRANS  flags: none
 +Left over region from split log item
  ---------------------------------------------------------------------
  Oper (1): tid: 2db4353b  len: 56  clientid: TRANS  flags: none
  INODE: #regs: 3   ino: 0x100047b  flags: 0x5   dsize: 64
  ......
  ---------------------------------------------------------------------

Signed-off-by: Hou Tao <houtao1@huawei.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
logprint/log_misc.c