Bug 12688

Summary: XFS support for dt_type in readdir results
Product: File System Reporter: Török Edwin (edwin+bugs)
Component: XFSAssignee: XFS Guru (xfs-masters)
Status: RESOLVED WILL_FIX_LATER    
Severity: enhancement CC: alan, djwong
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.28.4 Subsystem:
Regression: No Bisected commit-id:

Description Török Edwin 2009-02-11 04:47:25 UTC
XFS doesn't support the dt_type member in readdir results, it fills it with DT_UNKNOWN.

These are the filesystems that appear to support the dt_type field:
9p, btrfs, cifs, coda, ext2, ext3, ext4, fat, hfs, hfsplus, jffs2, ntfs, ocfs2, omfs, openpromfs, romfs, squashfs, ubifs, ufs

I would like XFS to support it as well, is there something in XFS's design that prevents it, or was it just not implemented?

It would be useful, because you can skip stat()-ing files, and can traverse directories faster by just looking at the ->dt_type field to know if it is a file/directory/something else.
Comment 1 Dave Chinner 2009-02-12 14:05:00 UTC
XFS doesn't have the necessary metadata in it's directory structure
to supply this information. That is, it requires an on-disk format
change to support this. We plan to support this in the future when we
change the directory structure to include CRCs, but that is some time
off....
Comment 2 Darrick J. Wong 2016-12-15 17:40:52 UTC
mkfs.xfs -n ftype=1 (which is now a default-on option) should enable dt_type reporting.