OOT: sharing about my research about why stat and ls show difference used block count upon a file

João Eduardo Luís jecluis at gmail.com
Sat Jul 2 07:38:36 EDT 2011


Hello.

Nice post. I had never noticed that. And I am able to reproduce the ls-stat behavior on a debian box with ext4 fs and no SELinux, or any other ACL's whatsoever.

In any case, from here,

On Jul 2, 2011, at 8:00 AM, Mulyadi Santosa wrote:
> 
> Few kind people already share their opinions on Linkedin. Here is the
> summary so far:
> http://the-hydra.blogspot.com/2011/07/feedback-regarding-my-stat-or-ls-post.html

You state:

> But my friend pointed that stat was accouting extra blocks that might (I say "might" because my friend is not so sure) contain metadata such as SELinux and ACL.

I am no ext3 expert, but I cannot wrap my head around the FS accounting for *metadata* blocks when stat is invoked. And I don't believe the ACLs would be kept within data blocks either, so this makes little sense to me.

In any case, after looking at ext3, I now believe the 'getattr' method in 'struct inode_operations' is left for the VFS to handle with its 'generic_fillattr()' method, and it pretty much copies everything relevant from the inode to the 'struct kstat'. Thing is, does the inode 'i_blocks' field keep track of both metadata and data blocks, or only data blocks? (I think only the latter makes any sense, but hey, that's just me).

---
João Eduardo Luís
gpg key: 477C26E5 from pool.keyserver.eu 





-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 495 bytes
Desc: This is a digitally signed message part
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110702/45c6be35/attachment.bin 


More information about the Kernelnewbies mailing list