ceph: fix getattr on directory when using norbytes

The norbytes mount option was broken, and when doing getattr
on a directory it return the rbytes instead of the number of
entities. This commit fixes it.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>

authored by Yehuda Sadeh and committed by Sage Weil 1c1266bb 766fc439

+5 -5
+5 -5
fs/ceph/inode.c
··· 701 701 ci->i_ceph_flags |= CEPH_I_COMPLETE; 702 702 ci->i_max_offset = 2; 703 703 } 704 - 705 - /* it may be better to set st_size in getattr instead? */ 706 - if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), RBYTES)) 707 - inode->i_size = ci->i_rbytes; 708 704 break; 709 705 default: 710 706 pr_err("fill_inode %llx.%llx BAD mode 0%o\n", ··· 1801 1805 else 1802 1806 stat->dev = 0; 1803 1807 if (S_ISDIR(inode->i_mode)) { 1804 - stat->size = ci->i_rbytes; 1808 + if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), 1809 + RBYTES)) 1810 + stat->size = ci->i_rbytes; 1811 + else 1812 + stat->size = ci->i_files + ci->i_subdirs; 1805 1813 stat->blocks = 0; 1806 1814 stat->blksize = 65536; 1807 1815 }