> Date: Fri, 19 Jun 2015 16:00:10 -0400
> From: anderson@redhat.com
> To: crash-utility@redhat.com
> Subject: Re: [Crash-utility] [PATCH v2] files: support dump file pages from its address space
>
>
>
> And a couple other things I forgot to mention...
>
> The vast majority of the "files -M" output consists of either the file
> descriptors for CHR, FIFO, SOCK, etc., files, or REG file descriptors
> that don't have any pages mapped into the task's address space.
>
> (1) Wouldn't it make more sense to show *only* the file descriptors
> that have mapped pages? And if the task has no mapped pages,
> just display "(no mapped pages)".
Confirmed some files mapped zero pages is also useful for debugging.
In theory, all of files/inodes have the mapping(address_space), per its inode data structure.
The command just reflects the inode data structure.
In current kernel implementation, only REG and BLK types used the mapping.
Most important reason is, we can reuse most existing code in filesys.c.
> (2) Is there any good reason to show the ROOT and CWD directories?
Same with above. Because code reuse.
All these behaviors are inherited from original files cmd code.
For example, when -R is specified, the ROOT and CWD is required by original code.
Because we want -R keep working with -m, I don't want to change the behavior.
You can see -R could work with -m option very well, because we share the common code.
Below command can filter all files with REG type,
crash> foreach files -m -R REG
PID: 1 TASK: ffff880139b20000 CPU: 2 COMMAND: "systemd"
ROOT: / CWD: /
FD INODE MAPPING PAGE-CNT TYPE PATH
11 ffff88013ac2d678 ffff88013ac2d7c0 0 REG /proc/1/mountinfo
12 ffff880138e6ea38 ffff880138e6eb80 0 REG /proc/swaps
PID: 422 TASK: ffff880135f74c40 CPU: 2 COMMAND: "systemd-journal"
ROOT: / CWD: /
FD INODE MAPPING PAGE-CNT TYPE PATH
13 ffff880135267050 ffff880135267198 17813 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/system.journal
34 ffff8801352e80b0 ffff8801352e81f8 652 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-42.journal
36 ffff8801352e9090 ffff8801352e91d8 905 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-530.journal
38 ffff8801352e8c98 ffff8801352e8de0 1 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-995.journa
Below command can filter all files with journal pattern in the filename,
foreach files -m -R journal
PID: 422 TASK: ffff880135f74c40 CPU: 2 COMMAND: "systemd-journal"
ROOT: / CWD: /
FD INODE MAPPING PAGE-CNT TYPE PATH
13 ffff880135267050 ffff880135267198 17813 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/system.journal
34 ffff8801352e80b0 ffff8801352e81f8 652 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-42.journal
36 ffff8801352e9090 ffff8801352e91d8 905 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-530.journal
38 ffff8801352e8c98 ffff8801352e8de0 1 REG /var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-995.journal