Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want command to print all znodes and a shorthand znode2inode (+ inverse) #180

Open
sdimitro opened this issue Feb 21, 2020 · 1 comment · May be fixed by #279
Open

Want command to print all znodes and a shorthand znode2inode (+ inverse) #180

sdimitro opened this issue Feb 21, 2020 · 1 comment · May be fixed by #279
Labels
new command request for new sdb command

Comments

@sdimitro
Copy link
Contributor

No description provided.

@sdimitro sdimitro added the new command request for new sdb command label Feb 21, 2020
@PaulZ-98
Copy link
Contributor

Maybe have a command znodes that does the equivalent of this?

sdb> slabs | filter 'obj.name == "zfs_znode_cache"' |walk | cast znode_t * | deref | print
(znode_t){
	.z_id = (uint64_t)6,
	.z_lock = (kmutex_t){
		.m_mutex = (struct mutex){
			.owner = (atomic_long_t){
				.counter = (s64)0,
			},
			.wait_lock = (spinlock_t){
				.rlock = (struct raw_spinlock){
					.raw_lock = (arch_spinlock_t){
						.val = (atomic_t){
							.counter = (int)0,
						},
						.locked = (u8)0,
						.pending = (u8)0,
						.locked_pending = (u16)0,
						.tail = (u16)0,
					},
				},
			},
			.osq = (struct optimistic_spin_queue){
				.tail = (atomic_t){
					.counter = (int)0,
				},
			},
			.wait_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45f828,
				.prev = (struct list_head *)0xffff8cdb1c45f828,
			},
		},
		.m_lock = (spinlock_t){
			.rlock = (struct raw_spinlock){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
					.tail = (u16)0,
				},
			},
		},
		.m_owner = (kthread_t *)0x0,
	},
	.z_parent_lock = (krwlock_t){
		.rw_rwlock = (struct rw_semaphore){
			.count = (atomic_long_t){
				.counter = (s64)0,
			},
			.owner = (atomic_long_t){
				.counter = (s64)0,
			},
			.osq = (struct optimistic_spin_queue){
				.tail = (atomic_t){
					.counter = (int)0,
				},
			},
			.wait_lock = (raw_spinlock_t){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
						.tail = (u16)0,
				},
			},
			.wait_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45f860,
				.prev = (struct list_head *)0xffff8cdb1c45f860,
			},
		},
		.rw_owner = (kthread_t *)0x0,
	},
	.z_name_lock = (krwlock_t){
		.rw_rwlock = (struct rw_semaphore){
			.count = (atomic_long_t){
				.counter = (s64)0,
			},
			.owner = (atomic_long_t){
				.counter = (s64)-126602474094591,
			},
			.osq = (struct optimistic_spin_queue){
				.tail = (atomic_t){
					.counter = (int)0,
				},
			},
			.wait_lock = (raw_spinlock_t){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
					.tail = (u16)0,
				},
			},
			.wait_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45f890,
				.prev = (struct list_head *)0xffff8cdb1c45f890,
			},
		},
		.rw_owner = (kthread_t *)0x0,
	},
	.z_dirlocks = (zfs_dirlock_t *)0x0,
	.z_rangelock = (zfs_rangelock_t){
		.rl_tree = (avl_tree_t){
			.avl_root = (struct avl_node *)0x0,
			.avl_compar = (int (*)(const void *, const void *))zfs_rangelock_compare+0x0 = 0xffffffffc0b16fc0,
			.avl_offset = (size_t)8,
			.avl_numnodes = (ulong_t)0,
			.avl_size = (size_t)208,
		},
		.rl_lock = (kmutex_t){
			.m_mutex = (struct mutex){
				.owner = (atomic_long_t){
					.counter = (s64)0,
				},
				.wait_lock = (spinlock_t){
					.rlock = (struct raw_spinlock){
						.raw_lock = (arch_spinlock_t){
							.val = (atomic_t){
								.counter = (int)0,
							},
							.locked = (u8)0,
							.pending = (u8)0,
							.locked_pending = (u16)0,
							.tail = (u16)0,
						},
					},
				},
				.osq = (struct optimistic_spin_queue){
					.tail = (atomic_t){
						.counter = (int)0,
					},
				},
				.wait_list = (struct list_head){
					.next = (struct list_head *)0xffff8cdb1c45f8e8,
					.prev = (struct list_head *)0xffff8cdb1c45f8e8,
				},
			},
			.m_lock = (spinlock_t){
				.rlock = (struct raw_spinlock){
					.raw_lock = (arch_spinlock_t){
						.val = (atomic_t){
							.counter = (int)0,
						},
						.locked = (u8)0,
						.pending = (u8)0,
						.locked_pending = (u16)0,
						.tail = (u16)0,
					},
				},
			},
			.m_owner = (kthread_t *)0x0,
		},
		.rl_cb = (zfs_rangelock_cb_t *)zfs_rangelock_cb+0x0 = 0xffffffffc0b5c5a0,
		.rl_arg = (void *)0xffff8cdb1c45f810,
	},
	.z_unlinked = (boolean_t)B_FALSE,
	.z_atime_dirty = (boolean_t)B_FALSE,
	.z_zn_prefetch = (boolean_t)B_FALSE,
	.z_moved = (boolean_t)B_FALSE,
	.z_is_sa = (boolean_t)B_TRUE,
	.z_is_mapped = (boolean_t)B_FALSE,
	.z_is_ctldir = (boolean_t)B_FALSE,
	.z_is_stale = (boolean_t)B_FALSE,
	.z_suspended = (boolean_t)B_FALSE,
	.z_blksz = (uint_t)131072,
	.z_seq = (uint_t)8013409,
	.z_mapcnt = (uint64_t)0,
	.z_dnodesize = (uint64_t)512,
	.z_size = (uint64_t)884850,
	.z_pflags = (uint64_t)145169894604804,
	.z_sync_cnt = (uint32_t)0,
	.z_mode = (mode_t)33184,
	.z_acl_lock = (kmutex_t){
		.m_mutex = (struct mutex){
			.owner = (atomic_long_t){
				.counter = (s64)0,
			},
			.wait_lock = (spinlock_t){
				.rlock = (struct raw_spinlock){
					.raw_lock = (arch_spinlock_t){
						.val = (atomic_t){
							.counter = (int)0,
						},
						.locked = (u8)0,
						.pending = (u8)0,
						.locked_pending = (u16)0,
						.tail = (u16)0,
					},
				},
			},
			.osq = (struct optimistic_spin_queue){
				.tail = (atomic_t){
					.counter = (int)0,
				},
			},
			.wait_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45f980,
				.prev = (struct list_head *)0xffff8cdb1c45f980,
			},
		},
		.m_lock = (spinlock_t){
			.rlock = (struct raw_spinlock){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
					.tail = (u16)0,
				},
			},
		},
		.m_owner = (kthread_t *)0x0,
	},
	.z_acl_cached = (zfs_acl_t *)0x0,
	.z_xattr_lock = (krwlock_t){
		.rw_rwlock = (struct rw_semaphore){
			.count = (atomic_long_t){
				.counter = (s64)0,
			},
			.owner = (atomic_long_t){
				.counter = (s64)-126602474094591,
			},
			.osq = (struct optimistic_spin_queue){
				.tail = (atomic_t){
					.counter = (int)0,
				},
			},
			.wait_lock = (raw_spinlock_t){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
					.tail = (u16)0,
				},
			},
			.wait_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45f9c0,
				.prev = (struct list_head *)0xffff8cdb1c45f9c0,
			},
		},
		.rw_owner = (kthread_t *)0x0,
	},
	.z_xattr_cached = (nvlist_t *)0x0,
	.z_xattr_parent = (uint64_t)0,
	.z_projid = (uint64_t)0,
	.z_link_node = (list_node_t){
		.next = (struct list_head *)0xdead000000000100,
		.prev = (struct list_head *)0xdead000000000122,
	},
	.z_sa_hdl = (sa_handle_t *)0x0,
	.z_inode = (struct inode){
		.i_mode = (umode_t)33184,
		.i_opflags = (unsigned short)13,
		.i_uid = (kuid_t){
			.val = (uid_t)0,
		},
		.i_gid = (kgid_t){
			.val = (gid_t)0,
		},
		.i_flags = (unsigned int)0,
		.i_acl = (struct posix_acl *)0xffffffffffffffff,
		.i_default_acl = (struct posix_acl *)0xffffffffffffffff,
		.i_op = (const struct inode_operations *)zpl_inode_operations+0x0 = 0xffffffffc0bf0d80,
		.i_sb = (struct super_block *)0xffff8cdb1900c800,
		.i_mapping = (struct address_space *)0x62d37258ee44fe2e,
		.i_security = (void *)0x0,
		.i_ino = (unsigned long)6,
		.i_nlink = (const unsigned int)1,
		.__i_nlink = (unsigned int)1,
		.i_rdev = (dev_t)0,
		.i_size = (loff_t)0,
		.i_atime = (struct timespec64){
			.tv_sec = (time64_t)1620669163,
			.tv_nsec = (long)591882185,
		},
		.i_mtime = (struct timespec64){
			.tv_sec = (time64_t)1620670041,
			.tv_nsec = (long)808683321,
		},
		.i_ctime = (struct timespec64){
			.tv_sec = (time64_t)1620670041,
			.tv_nsec = (long)808683321,
		},
		.i_lock = (spinlock_t){
			.rlock = (struct raw_spinlock){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
					.tail = (u16)0,
				},
			},
		},
		.i_bytes = (unsigned short)0,
		.i_blkbits = (u8)9,
		.i_write_hint = (u8)0,
		.i_blocks = (blkcnt_t)436,
		.i_state = (unsigned long)96,
		.i_rwsem = (struct rw_semaphore){
			.count = (atomic_long_t){
				.counter = (s64)0,
			},
			.owner = (atomic_long_t){
				.counter = (s64)0,
			},
			.osq = (struct optimistic_spin_queue){
				.tail = (atomic_t){
					.counter = (int)0,
				},
			},
			.wait_lock = (raw_spinlock_t){
				.raw_lock = (arch_spinlock_t){
					.val = (atomic_t){
						.counter = (int)0,
					},
					.locked = (u8)0,
					.pending = (u8)0,
					.locked_pending = (u16)0,
					.tail = (u16)0,
				},
			},
			.wait_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45fac0,
				.prev = (struct list_head *)0xffff8cdb1c45fac0,
			},
		},
		.dirtied_when = (unsigned long)0,
		.dirtied_time_when = (unsigned long)0,
		.i_hash = (struct hlist_node){
			.next = (struct hlist_node *)0x0,
			.pprev = (struct hlist_node **)0x0,
		},
		.i_io_list = (struct list_head){
			.next = (struct list_head *)0xffff8cdb1c45faf0,
			.prev = (struct list_head *)0xffff8cdb1c45faf0,
		},
		.i_wb = (struct bdi_writeback *)0x0,
		.i_wb_frn_winner = (int)0,
		.i_wb_frn_avg_time = (u16)0,
		.i_wb_frn_history = (u16)0,
		.i_lru = (struct list_head){
			.next = (struct list_head *)0xffff8cdb1c45fb10,
			.prev = (struct list_head *)0xffff8cdb1c45fb10,
		},
		.i_sb_list = (struct list_head){
			.next = (struct list_head *)0xffff8cdb1c45fb20,
			.prev = (struct list_head *)0xffff8cdb1c45fb20,
		},
		.i_wb_list = (struct list_head){
			.next = (struct list_head *)0xffff8cdb1c45fb30,
			.prev = (struct list_head *)0xffff8cdb1c45fb30,
		},
		.i_dentry = (struct hlist_head){
			.first = (struct hlist_node *)0x0,
		},
		.i_rcu = (struct callback_head){
			.next = (struct callback_head *)0x0,
			.func = (void (*)(struct callback_head *))0x0,
		},
		.i_version = (atomic64_t){
			.counter = (s64)2,
		},
		.i_sequence = (atomic64_t){
			.counter = (s64)0,
		},
		.i_count = (atomic_t){
			.counter = (int)0,
		},
		.i_dio_count = (atomic_t){
			.counter = (int)0,
		},
		.i_writecount = (atomic_t){
			.counter = (int)0,
		},
		.i_readcount = (atomic_t){
			.counter = (int)0,
		},
		.i_fop = (const struct file_operations *)zpl_file_operations+0x0 = 0xffffffffc0bf0760,
		.free_inode = (void (*)(struct inode *))zpl_file_operations+0x0 = 0xffffffffc0bf0760,
		.i_flctx = (struct file_lock_context *)0x0,
		.i_data = (struct address_space){
			.host = (struct inode *)0xffff8cdb1c45fa08,
			.i_pages = (struct xarray){
				.xa_lock = (spinlock_t){
					.rlock = (struct raw_spinlock){
						.raw_lock = (arch_spinlock_t){
							.val = (atomic_t){
								.counter = (int)0,
							},
							.locked = (u8)0,
							.pending = (u8)0,
							.locked_pending = (u16)0,
							.tail = (u16)0,
						},
					},
				},
				.xa_flags = (gfp_t)33,
				.xa_head = (void *)0x0,
			},
			.gfp_mask = (gfp_t)1051850,
			.i_mmap_writable = (atomic_t){
				.counter = (int)0,
			},
			.i_mmap = (struct rb_root_cached){
				.rb_root = (struct rb_root){
					.rb_node = (struct rb_node *)0x0,
				},
				.rb_leftmost = (struct rb_node *)0x0,
			},
			.i_mmap_rwsem = (struct rw_semaphore){
				.count = (atomic_long_t){
					.counter = (s64)0,
				},
				.owner = (atomic_long_t){
					.counter = (s64)0,
				},
				.osq = (struct optimistic_spin_queue){
					.tail = (atomic_t){
						.counter = (int)0,
					},
				},
				.wait_lock = (raw_spinlock_t){
					.raw_lock = (arch_spinlock_t){
						.val = (atomic_t){
							.counter = (int)0,
						},
						.locked = (u8)0,
						.pending = (u8)0,
						.locked_pending = (u16)0,
						.tail = (u16)0,
					},
				},
				.wait_list = (struct list_head){
					.next = (struct list_head *)0xffff8cdb1c45fbc8,
					.prev = (struct list_head *)0xffff8cdb1c45fbc8,
				},
			},
			.nrpages = (unsigned long)0,
			.nrexceptional = (unsigned long)0,
			.writeback_index = (unsigned long)0,
			.a_ops = (const struct address_space_operations *)zpl_address_space_operations+0x0 = 0xffffffffc0bf0880,
			.flags = (unsigned long)0,
			.wb_err = (errseq_t)0,
			.private_lock = (spinlock_t){
				.rlock = (struct raw_spinlock){
					.raw_lock = (arch_spinlock_t){
						.val = (atomic_t){
							.counter = (int)0,
						},
						.locked = (u8)0,
						.pending = (u8)0,
						.locked_pending = (u16)0,
						.tail = (u16)0,
					},
				},
			},
			.private_list = (struct list_head){
				.next = (struct list_head *)0xffff8cdb1c45fc08,
				.prev = (struct list_head *)0xffff8cdb1c45fc08,
			},
			.private_data = (void *)0x0,
		},
		.i_devices = (struct list_head){
			.next = (struct list_head *)0xffff8cdb1c45fc20,
			.prev = (struct list_head *)0xffff8cdb1c45fc20,
		},
		.i_pipe = (struct pipe_inode_info *)0x0,
		.i_bdev = (struct block_device *)0x0,
		.i_cdev = (struct cdev *)0x0,
		.i_link = (char *)0x0,
		.i_dir_seq = (unsigned int)0,
		.i_generation = (__u32)628023,
		.i_fsnotify_mask = (__u32)0,
		.i_fsnotify_marks = (struct fsnotify_mark_connector *)0x0,
		.i_crypt_info = (struct fscrypt_info *)0x0,
		.i_verity_info = (struct fsverity_info *)0x0,
		.i_private = (void *)0x0,
	},

Or cut down on that output? It's quite a lot per struct instance.

@PaulZ-98 PaulZ-98 linked a pull request Jun 28, 2021 that will close this issue
PaulZ-98 added a commit to PaulZ-98/sdb that referenced this issue Jun 28, 2021
inode2znode commands.

Signed-off-by: Paul Zuchowski <[email protected]>
Closes delphix#180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new command request for new sdb command
Development

Successfully merging a pull request may close this issue.

2 participants