@@ -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);
@@ -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,
};
@@ -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)
{
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@skynet.be> --- fs/affs/affs.h | 2 ++ fs/affs/file.c | 1 + fs/affs/inode.c | 11 +++++++++++ 3 files changed, 14 insertions(+)