2010-02-18 13:07:31

by Andreas Dilger

[permalink] [raw]
Subject: [PATCH] improved filefrag output

Attached is a patch to improve the filefrag output. The most
important part of the change is that it allows the "extent format"
output to be used even if the filesystem does not support FIEMAP.
This is useful for older kernels (i.e. most vendor kernels), or in
case FIEMAP hasn't been wired into a filesystem yet.

The extent format output is improved to be more similar to that of
xfs_bmap, so it prints out a range of logical and physical block
numbers, in addition to the extent length, so that it is easier to see
where the discontinuities are. There is also an option to print out
the extents/lengths in hex, and using a different blocksize (e.g. "-
b1M" to print in units of 1MB):

$ filefrag -e -b1M "Indiana Jones And The Temple Of Doom.avi"
ext: device_logical: physical_offset: length: flags:
0: 0.. 1: 320566.. 320567: 1:
1: 1.. 3: 320866.. 320868: 2:
2: 3.. 3: 320768.. 320768: 0:
3: 4.. 29: 320870.. 320895: 26:
4: 30.. 155: 320898.. 321023: 126:
5: 156.. 281: 321026.. 321151: 126:
6: 282.. 407: 321154.. 321279: 126:
7: 408.. 533: 321282.. 321407: 126:
8: 534.. 659: 321410.. 321535: 126:

Also included is support for FIEMAP extensions to support multi-device
filesystems (e.g. Lustre, ZFS, maybe btrfs in the future).

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


Attachments:
e2fsprogs-fiemap-lustre.patch (20.01 kB)

2010-02-23 22:53:24

by Andreas Dilger

[permalink] [raw]
Subject: Re: [PATCH] improved filefrag output v2

Attached is a new patch to improve the filefrag output. The most
important part of the change is that it allows the "extent format"
output to be used even if the filesystem does not support FIEMAP.
This is useful for older kernels (i.e. most vendor kernels), or in
case FIEMAP hasn't been wired into a filesystem yet.

The major change from v1 of the patch is that for FIBMAP files it
considers logical file discontinuity as well as physical
discontinuity. This impacts only sparse files, but provides more
accurate information in "extent" output format. The old filefrag
output has not been changed (for compatibility, if that is a concern),
though it now reports a different number of extents for sparse files.
This could be changed fairly easily.


The extent format output is improved to be more similar to that of
xfs_bmap, so it prints out a range of logical and physical block
numbers in addition to the extent length, so that it is easier to see
where the discontinuities are. There is also an option to print out
the extents/lengths in hex, and using a different blocksize (e.g. "-
b1M" to print in units of 1MB):

$ filefrag -e -b1M "Indiana Jones And The Temple Of Doom.avi"
ext: logical_offset: physical_offset: length: flags:
0: 0.. 1: 320566.. 320567: 1:
1: 1.. 3: 320866.. 320868: 2:
2: 3.. 3: 320768.. 320768: 0:
3: 4.. 29: 320870.. 320895: 26:
4: 30.. 155: 320898.. 321023: 126:
5: 156.. 281: 321026.. 321151: 126:
6: 282.. 407: 321154.. 321279: 126:
7: 408.. 533: 321282.. 321407: 126:
8: 534.. 659: 321410.. 321535: 126: eof

Also included is support for FIEMAP extensions to support multi-device
filesystems (e.g. Lustre, ZFS, maybe btrfs in the future).

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


Attachments:
e2fsprogs-fiemap-lustre.patch (20.19 kB)

2010-05-13 21:56:23

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] improved filefrag output v2

Added to the e2fsprogs maint branch, thanks.

- Ted