diff options
author | Sage Weil <sage@newdream.net> | 2009-10-21 14:21:49 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-10-21 14:24:36 -0400 |
commit | 232d4b01319767b3ffa5d08962a81c805962be49 (patch) | |
tree | 9df213823c817b988c4438e1f81797936c70f48b /fs | |
parent | bb097ffaf833a40335b6dd5e4fa6f5ed0b223bdc (diff) |
ceph: move directory size logic to ceph_getattr
We can't fill i_size with rbytes at the fill_file_size stage without
adding additional checks for directories. Notably, we want st_blocks
to remain 0 on directories so that 'du' still works.
Fill in i_blocks, i_size specially in ceph_getattr instead.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/inode.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 6097af790047..036873c42a78 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -568,8 +568,6 @@ static int fill_inode(struct inode *inode, | |||
568 | queue_trunc = ceph_fill_file_size(inode, issued, | 568 | queue_trunc = ceph_fill_file_size(inode, issued, |
569 | le32_to_cpu(info->truncate_seq), | 569 | le32_to_cpu(info->truncate_seq), |
570 | le64_to_cpu(info->truncate_size), | 570 | le64_to_cpu(info->truncate_size), |
571 | S_ISDIR(inode->i_mode) ? | ||
572 | ci->i_rbytes : | ||
573 | le64_to_cpu(info->size)); | 571 | le64_to_cpu(info->size)); |
574 | ceph_fill_file_time(inode, issued, | 572 | ceph_fill_file_time(inode, issued, |
575 | le32_to_cpu(info->time_warp_seq), | 573 | le32_to_cpu(info->time_warp_seq), |
@@ -1603,6 +1601,7 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1603 | struct kstat *stat) | 1601 | struct kstat *stat) |
1604 | { | 1602 | { |
1605 | struct inode *inode = dentry->d_inode; | 1603 | struct inode *inode = dentry->d_inode; |
1604 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
1606 | int err; | 1605 | int err; |
1607 | 1606 | ||
1608 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL); | 1607 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL); |
@@ -1613,8 +1612,11 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1613 | stat->dev = ceph_snap(inode); | 1612 | stat->dev = ceph_snap(inode); |
1614 | else | 1613 | else |
1615 | stat->dev = 0; | 1614 | stat->dev = 0; |
1616 | if (S_ISDIR(inode->i_mode)) | 1615 | if (S_ISDIR(inode->i_mode)) { |
1616 | stat->size = ci->i_rbytes; | ||
1617 | stat->blocks = 0; | ||
1617 | stat->blksize = 65536; | 1618 | stat->blksize = 65536; |
1619 | } | ||
1618 | } | 1620 | } |
1619 | return err; | 1621 | return err; |
1620 | } | 1622 | } |