summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2017-05-22 00:03:32 -0400
committerIlya Dryomov <idryomov@gmail.com>2017-07-07 11:25:12 -0400
commitefb0ca765ac6f4985b57ef215e8d55e746b083f4 (patch)
tree8333c6ae9ed47a7134c0163d07670970d1eff4b4 /fs/ceph/caps.c
parent84eea8c79090c44564877cd47c73455e32ec4846 (diff)
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>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 6752223dc81c..f5552455223f 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1653,6 +1653,21 @@ static int try_nonblocking_invalidate(struct inode *inode)
1653 return -1; 1653 return -1;
1654} 1654}
1655 1655
1656bool __ceph_should_report_size(struct ceph_inode_info *ci)
1657{
1658 loff_t size = ci->vfs_inode.i_size;
1659 /* mds will adjust max size according to the reported size */
1660 if (ci->i_flushing_caps & CEPH_CAP_FILE_WR)
1661 return false;
1662 if (size >= ci->i_max_size)
1663 return true;
1664 /* half of previous max_size increment has been used */
1665 if (ci->i_max_size > ci->i_reported_size &&
1666 (size << 1) >= ci->i_max_size + ci->i_reported_size)
1667 return true;
1668 return false;
1669}
1670
1656/* 1671/*
1657 * Swiss army knife function to examine currently used and wanted 1672 * Swiss army knife function to examine currently used and wanted
1658 * versus held caps. Release, flush, ack revoked caps to mds as 1673 * versus held caps. Release, flush, ack revoked caps to mds as
@@ -1806,8 +1821,7 @@ retry_locked:
1806 } 1821 }
1807 1822
1808 /* approaching file_max? */ 1823 /* approaching file_max? */
1809 if ((inode->i_size << 1) >= ci->i_max_size && 1824 if (__ceph_should_report_size(ci)) {
1810 (ci->i_reported_size << 1) < ci->i_max_size) {
1811 dout("i_size approaching max_size\n"); 1825 dout("i_size approaching max_size\n");
1812 goto ack; 1826 goto ack;
1813 } 1827 }