From: Xiubo Li Date: Tue, 28 Jun 2022 02:30:26 +0000 (+0800) Subject: client: switch to use CEPH_4K_BLOCK_SHIFT macro for general case X-Git-Tag: v19.0.0~1459^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=001aa2c4d811232f9c93acaf1039599623b6e903;p=ceph.git client: switch to use CEPH_4K_BLOCK_SHIFT macro for general case Fixes: https://tracker.ceph.com/issues/56397 Signed-off-by: Xiubo Li --- diff --git a/src/client/Client.cc b/src/client/Client.cc index dbc2826bb385..88cb711bf360 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11220,9 +11220,8 @@ int Client::statfs(const char *path, struct statvfs *stbuf, * blocks. We use 4MB only because it is big enough, and because it * actually *is* the (ceph) default block size. */ - const int CEPH_BLOCK_SHIFT = 22; - stbuf->f_frsize = 1 << CEPH_BLOCK_SHIFT; - stbuf->f_bsize = 1 << CEPH_BLOCK_SHIFT; + stbuf->f_frsize = CEPH_4M_BLOCK_SIZE; + stbuf->f_bsize = CEPH_4M_BLOCK_SIZE; stbuf->f_files = total_files_on_fs; stbuf->f_ffree = -1; stbuf->f_favail = -1; @@ -11262,8 +11261,8 @@ int Client::statfs(const char *path, struct statvfs *stbuf, // Special case: if there is a size quota set on the Inode acting // as the root for this client mount, then report the quota status // as the filesystem statistics. - const fsblkcnt_t total = quota_root->quota.max_bytes >> CEPH_BLOCK_SHIFT; - const fsblkcnt_t used = quota_root->rstat.rbytes >> CEPH_BLOCK_SHIFT; + const fsblkcnt_t total = quota_root->quota.max_bytes >> CEPH_4M_BLOCK_SHIFT; + const fsblkcnt_t used = quota_root->rstat.rbytes >> CEPH_4M_BLOCK_SHIFT; // It is possible for a quota to be exceeded: arithmetic here must // handle case where used > total. const fsblkcnt_t free = total > used ? total - used : 0; @@ -11275,9 +11274,9 @@ int Client::statfs(const char *path, struct statvfs *stbuf, // General case: report the cluster statistics returned from RADOS. Because // multiple pools may be used without one filesystem namespace via // layouts, this is the most correct thing we can do. - stbuf->f_blocks = stats.kb >> (CEPH_BLOCK_SHIFT - 10); - stbuf->f_bfree = stats.kb_avail >> (CEPH_BLOCK_SHIFT - 10); - stbuf->f_bavail = stats.kb_avail >> (CEPH_BLOCK_SHIFT - 10); + stbuf->f_blocks = stats.kb >> CEPH_4K_BLOCK_SHIFT; + stbuf->f_bfree = stats.kb_avail >> CEPH_4K_BLOCK_SHIFT; + stbuf->f_bavail = stats.kb_avail >> CEPH_4K_BLOCK_SHIFT; } return rval;