Whamcloud - gitweb
LU-17705 ptlrpc: replace synchronize_rcu() with rcu_barrier()
[fs/lustre-release.git] / contrib / debug_tools / epython_scripts / sbi_ptrs.py
1 #!/usr/bin/env python
2 """
3 Copyright (c) 2019 Cray Inc. All Rights Reserved.
4 Utility to display Lustre inode related struct pointers
5 """
6
7 from pykdump.API import *
8 import argparse
9 from crashlib.input import toint
10
11 description_short = "Prints Lustre structs associated with inode."
12
13 def dump_inode(inode):
14      offset = member_offset('struct ll_inode_info', 'lli_vfs_inode')
15      lli = readSU('struct ll_inode_info', Addr(inode) - offset)
16      sb = readSU('struct super_block', inode.i_sb)
17      lsi = readSU('struct lustre_sb_info', sb.s_fs_info)
18      llsbi = readSU('struct ll_sb_info', lsi.lsi_llsbi)
19      print("%x %x %x %x %x" % (Addr(inode), lli, sb, lsi, llsbi))
20
21 def dump_inode_list(inodes):
22     print("%-16s %-16s %-16s %-16s %-16s" % ("inode", "ll_inode_info",
23           "super_block", "lustre_sb_info", "ll_sb_info"))
24     for addr in inodes:
25         dump_inode(readSU('struct inode', addr))
26
27 if __name__ == "__main__":
28     description = "Prints ll_inode_info, super_block, \n" + \
29             "lustre_sb_info, and ll_sb_info pointers associated \n" + \
30             "with specified inode(s) \n"
31
32     parser = argparse.ArgumentParser(description=description)
33     parser.add_argument('inode', nargs="+", type=toint,
34         help="list of one or more inodes")
35     args = parser.parse_args()
36
37     dump_inode_list(args.inode)