Skip to content

Commit

Permalink
ROMFS: support inode blocks calculation
Browse files Browse the repository at this point in the history
When use 'stat' tool to display file status, the 'Blocks' field always in
'0', this is not good for tool 'du'(e.g.: busybox 'du'), it always output
'0' size for the files under ROMFS since such tool calculates number of
512B Blocks.

This patch calculates approx.  number of 512B blocks based on inode size.

Signed-off-by: Libing Zhou <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: David Howells <[email protected]>
Cc: Al Viro <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
Libing Zhou authored and torvalds committed Oct 16, 2020

Verified

This commit was signed with the committer’s verified signature.
jorenham Joren Hammudoglu
1 parent 6a6155f commit d9bc85d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/romfs/super.c
Original file line number Diff line number Diff line change
@@ -356,6 +356,7 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)
}

i->i_mode = mode;
i->i_blocks = (i->i_size + 511) >> 9;

unlock_new_inode(i);
return i;

0 comments on commit d9bc85d

Please sign in to comment.