Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101121
b: refs/heads/master
c: 3e3398a
h: refs/heads/master
i:
  101119: 763494f
v: v3
  • Loading branch information
Mingming Cao authored and Theodore Ts'o committed Jul 11, 2008
1 parent 6de2bb8 commit 63a70d2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 632eaeab1feb5d78c1e2bfb1d2dfc0ebb8ac187f
refs/heads/master: 3e3398a08d6e516675d5af853d625dc7dd90eab1
2 changes: 2 additions & 0 deletions trunk/fs/ext4/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,8 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
extern struct inode *ext4_iget(struct super_block *, unsigned long);
extern int ext4_write_inode (struct inode *, int);
extern int ext4_setattr (struct dentry *, struct iattr *);
extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
extern void ext4_delete_inode (struct inode *);
extern int ext4_sync_inode (handle_t *, struct inode *);
extern void ext4_discard_reservation (struct inode *);
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ const struct file_operations ext4_file_operations = {
const struct inode_operations ext4_file_inode_operations = {
.truncate = ext4_truncate,
.setattr = ext4_setattr,
.getattr = ext4_getattr,
#ifdef CONFIG_EXT4DEV_FS_XATTR
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
Expand Down
26 changes: 26 additions & 0 deletions trunk/fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4231,6 +4231,32 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
return error;
}

int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct inode *inode;
unsigned long delalloc_blocks;

inode = dentry->d_inode;
generic_fillattr(inode, stat);

/*
* We can't update i_blocks if the block allocation is delayed
* otherwise in the case of system crash before the real block
* allocation is done, we will have i_blocks inconsistent with
* on-disk file blocks.
* We always keep i_blocks updated together with real
* allocation. But to not confuse with user, stat
* will return the blocks that include the delayed allocation
* blocks for this file.
*/
spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
delalloc_blocks = EXT4_I(inode)->i_reserved_data_blocks;
spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);

stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
return 0;
}

/*
* How many blocks doth make a writepage()?
Expand Down

0 comments on commit 63a70d2

Please sign in to comment.