Re: [f2fs-dev] [PATCH] f2fs: change fiemap way in printing compression chunk

From: Eric Biggers
Date: Wed Jul 21 2021 - 17:35:46 EST


On Wed, Jul 21, 2021 at 12:20:48AM -0700, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> When we print out a discontinuous compression chunk, it shows like a
> continuous chunk now. To show it more correctly, I've changed the way of
> printing fiemap info like below. Plus, eliminated NEW_ADDR(-1) in fiemap
> info, since it is not in fiemap user api manual.
>
> 0: 0000000000000000 0000000000000000 0000000000001000 1008 (M/E)
> 1: 0000000000001000 0000000f15c0f000 0000000000001000 1008 (M/E)
> 2: 0000000000002000 0000000000000000 0000000000002000 1808 (M/U/E)
> 3: 0000000000004000 0000000000000000 0000000000001000 1008 (M/E)
> 4: 0000000000005000 0000000f15c10000 0000000000001000 1008 (M/E)
> 5: 0000000000006000 0000000000000000 0000000000002000 1808 (M/U/E)
> 6: 0000000000008000 0000000000000000 0000000000001000 1008 (M/E)

Please label these columns.

Anyway, this doesn't appear to work quite in the way I had in mind. With this
patch, what I'm seeing is:

$ head -c 16384 /dev/zero > file; xfs_io -c "fiemap -v" file
file:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..7]: 0..7 8 0x1008
1: [8..15]: 2683128..2683135 8 0x1008
2: [16..31]: 0..15 16 0x1809

So, working in 512-byte sectors, the logical sectors 0-31 are stored as one
compressed cluster in the 8 physical sectors 2683128-2683135.

The problem is, with this patch these physical sectors are reported at logical
sectors 8-15 instead of 0-7. Obviously, this isn't particularly well-defined,
but I thought it was logical for the physical blocks to be associated with the
first logical blocks. That is what the tests I've written (xfstest f2fs/002,
and the Android vts_kernel_encryption_test) assume.

Is there any particular reason why you wouldn't report instead:

0: [0..7]: 2683128..2683135 8 0x1008
1: [8..31]: 0..23 8 0x1809

- Eric