diff options
author | Libing Zhou <[email protected]> | 2020-10-15 20:13:42 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2020-10-16 11:11:22 -0700 |
commit | d9bc85de46cad90851c346b592005090674b7669 (patch) | |
tree | 9bc50688e46d1abe7af63709cabe8fef6fdb4c01 | |
parent | 6a6155f664e31c9be43cd690541a9a682ba3dc22 (diff) |
ROMFS: support inode blocks calculation
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]>
-rw-r--r-- | fs/romfs/super.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/romfs/super.c b/fs/romfs/super.c index e582d001f792..b1b7d3f5752f 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -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; |