Skip to content

Commit

Permalink
ext4_dirlock: show cached files under the dir
Browse files Browse the repository at this point in the history
It tells how many cached files under the dir, a small number doesn't
mean iterating the dir will be fast, the size of the dir will be more
accurate to tell that since ext4 may not release dir block even all
files in that block were removed.

Signed-off-by: Junxiao Bi <[email protected]>
  • Loading branch information
biger410 authored and brenns10 committed Dec 2, 2023
1 parent 8ce8757 commit f3e8fcc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drgn_tools/ext4_dirlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@
import drgn
from drgn import Program
from drgn.helpers.linux.fs import d_path
from drgn.helpers.linux.list import list_for_each
from drgn.helpers.linux.sched import task_state_to_char

from drgn_tools.bt import bt
from drgn_tools.bt import bt_has
from drgn_tools.corelens import CorelensModule
from drgn_tools.itertools import count
from drgn_tools.locking import for_each_mutex_waiter
from drgn_tools.locking import for_each_rwsem_waiter
from drgn_tools.locking import show_lock_waiter
Expand Down Expand Up @@ -138,6 +140,10 @@ def ext4_dirlock_scan(prog: drgn.Program, stacktrace: bool = False) -> None:
print("%-12s: 0x%x" % ("inode", inode.value_()))
print("%-12s: %d" % ("Size", inode.i_size.value_()))
print("%-12s: %d" % ("Blocks", inode.i_blocks.value_()))
print(
"%-12s: %d"
% ("subdirs", count(list_for_each(dentry.d_subdirs.address_of_())))
)
print(
"%-12s: %-16s %-8s %-6s %-16s"
% ("Inode Lock", "Command", "Pid", "Status", "Lastrun2now")
Expand Down

0 comments on commit f3e8fcc

Please sign in to comment.