stat <filename> doesn't give any block number as it's filesystem specific. Add getattr wrapper to return i_blkcnt calculated during affs_iget() Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx> --- fs/affs/affs.h | 2 ++ fs/affs/file.c | 1 + fs/affs/inode.c | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/fs/affs/affs.h b/fs/affs/affs.h index fd99f28..a2151e9 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h @@ -180,6 +180,8 @@ extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, /* inode.c */ extern struct inode *affs_new_inode(struct inode *dir); +extern int affs_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int flags); extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); extern void affs_evict_inode(struct inode *inode); extern struct inode *affs_iget(struct super_block *sb, unsigned long ino); diff --git a/fs/affs/file.c b/fs/affs/file.c index 196ee7f..b331abb 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -979,4 +979,5 @@ const struct file_operations affs_file_operations = { const struct inode_operations affs_file_inode_operations = { .setattr = affs_notify_change, + .getattr = affs_getattr, }; diff --git a/fs/affs/inode.c b/fs/affs/inode.c index fd4ef3c..76fb281 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -214,6 +214,17 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) return 0; } +int affs_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int flags) +{ + struct inode *inode = d_inode(path->dentry); + + generic_fillattr(inode, stat); + stat->blocks = AFFS_I(inode)->i_blkcnt; + + return 0; +} + int affs_notify_change(struct dentry *dentry, struct iattr *attr) { -- 2.9.3