Skip to content

Commit d9bc85d

Browse files
Libing Zhoutorvalds
authored andcommitted
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 <libing.zhou@nokia-sbell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Link: http://lkml.kernel.org/r/20200811052606.4243-1-libing.zhou@nokia-sbell.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6a6155f commit d9bc85d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/romfs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)
356356
}
357357

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

360361
unlock_new_inode(i);
361362
return i;

0 commit comments

Comments
 (0)