ceph: update the 'approaching max_size' code

The old 'approaching max_size' code expects MDS set max_size to
'2 * reported_size'. This is no longer true. The new code reports
file size when half of previous max_size increment has been used.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Yan, Zheng
2017-05-22 12:03:32 +08:00
committed by Ilya Dryomov
parent 84eea8c790
commit efb0ca765a
5 changed files with 23 additions and 11 deletions

View File

@@ -1653,20 +1653,17 @@ out:
return err;
}
int ceph_inode_set_size(struct inode *inode, loff_t size)
bool ceph_inode_set_size(struct inode *inode, loff_t size)
{
struct ceph_inode_info *ci = ceph_inode(inode);
int ret = 0;
bool ret;
spin_lock(&ci->i_ceph_lock);
dout("set_size %p %llu -> %llu\n", inode, inode->i_size, size);
i_size_write(inode, size);
inode->i_blocks = calc_inode_blocks(size);
/* tell the MDS if we are approaching max_size */
if ((size << 1) >= ci->i_max_size &&
(ci->i_reported_size << 1) < ci->i_max_size)
ret = 1;
ret = __ceph_should_report_size(ci);
spin_unlock(&ci->i_ceph_lock);
return ret;