Re: s_bmap and flags explanation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 03, 2022 at 04:56:43PM +0200, Emmanouil Vamvakopoulos wrote:
> 
> 
> Hello developers
> 
> It is possible to explain the FLAGS field in xfs_bmap output of a file

Flags bits for each extent:

FLG_SHARED      0100000 /* shared extent */
FLG_PRE         0010000 /* Unwritten extent */
FLG_BSU         0001000 /* Not on begin of stripe unit  */
FLG_ESU         0000100 /* Not on end   of stripe unit  */
FLG_BSW         0000010 /* Not on begin of stripe width */
FLG_ESW         0000001 /* Not on end   of stripe width */

> 
>  EXT: FILE-OFFSET           BLOCK-RANGE              AG AG-OFFSET                 TOTAL FLAGS
>    0: [0..7]:               49700520968..49700520975 30 (8..15)                       8 001111
>    1: [8..4175871]:         49708756480..49712932343 30 (8235520..12411383)     4175864 000111
>    2: [4175872..19976191]:  49715788288..49731588607 30 (15267328..31067647)   15800320 000011
>    3: [19976192..25153535]: 49731588608..49736765951 30 (31067648..36244991)    5177344 000011
>    4: [25153536..41930743]: 49767625216..49784402423 30 (67104256..83881463)   16777208 000111
>    5: [41930744..58707951]: 49784402424..49801179631 30 (83881464..100658671)  16777208 001111
>    6: [58707952..58959935]: 49801179632..49801431615 30 (100658672..100910655)   251984 001111
>    7: [58959936..75485159]: 49801431616..49817956839 30 (100910656..117435879) 16525224 001111
> 

Disclaimer: I am not sure exactly how du accounts for --aparent-size.

Said that, xfs_bmap shows you the current block mapping of the file you
mentioned using 512 blocks. According to the mapping above, this file is mapped
into 75485160 512-byte blocks, so:

(75485160*512)/(1024**3) = 35.99

> [disk06]# du -sh ./00000869/014886f4
> 36G	./00000869/014886f4

Matching the size here.


> [disk06]# du -sh --apparent-size  ./00000869/014886f4
> 29G	./00000869/014886f4

According to du's man page:

       --apparent-size
              print  apparent  sizes  rather  than device usage; although the
	      apparent size is usually smaller, it may be larger due to holes
	      in ('sparse') files, internal fragmentation, indirect blocks, and
	      the like

Giving the stripe misalignment flags set on all the extents I'd say this is the
main reason for why --apparent-size differs so much, if the writes being done to
the file are not stripe aligned, each stripe unity might be wasting some space.
> 
> I try to understand if  this file contains unused externs
> and how those file are created like this (if we assume that the free space was not fragmented )

Maybe your FS is on top of a striped volume and the FS itself is not
configured with the correct unity/width?
This is a guess btw, I may very well be wrong and it be related to something
else :)

> if I defrag the file above the difference bewteen apparent size and size with du disappered !


-- 
Carlos Maiolino



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux