summaryrefslogtreecommitdiffstats
path: root/fs/ceph/file.c
diff options
context:
space:
mode:
authorLuis Henriques <lhenriques@suse.com>2018-01-05 05:47:22 -0500
committerIlya Dryomov <idryomov@gmail.com>2018-04-02 05:17:52 -0400
commit1ab302a0cb1455631646aa66b7fc02afd617ea4f (patch)
tree73686da6a5aef8ef0190bd8498d3591fc766ddee /fs/ceph/file.c
parent2b83845f8bd711e66e1c367a9bd56c9df3410236 (diff)
ceph: quota: update MDS when max_bytes is approaching
When we're reaching the ceph.quota.max_bytes limit, i.e., when writing more than 1/16th of the space left in a quota realm, update the MDS with the new file size. This mirrors the fuse-client approach with commit 122c50315ed1 ("client: Inform mds file size when approaching quota limit"), in the ceph git tree. Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r--fs/ceph/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 0a2843fdebbd..f85040d73e3d 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1464,6 +1464,7 @@ retry_snap:
1464 1464
1465 if (written >= 0) { 1465 if (written >= 0) {
1466 int dirty; 1466 int dirty;
1467
1467 spin_lock(&ci->i_ceph_lock); 1468 spin_lock(&ci->i_ceph_lock);
1468 ci->i_inline_version = CEPH_INLINE_NONE; 1469 ci->i_inline_version = CEPH_INLINE_NONE;
1469 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR, 1470 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR,
@@ -1471,6 +1472,8 @@ retry_snap:
1471 spin_unlock(&ci->i_ceph_lock); 1472 spin_unlock(&ci->i_ceph_lock);
1472 if (dirty) 1473 if (dirty)
1473 __mark_inode_dirty(inode, dirty); 1474 __mark_inode_dirty(inode, dirty);
1475 if (ceph_quota_is_max_bytes_approaching(inode, iocb->ki_pos))
1476 ceph_check_caps(ci, CHECK_CAPS_NODELAY, NULL);
1474 } 1477 }
1475 1478
1476 dout("aio_write %p %llx.%llx %llu~%u dropping cap refs on %s\n", 1479 dout("aio_write %p %llx.%llx %llu~%u dropping cap refs on %s\n",
@@ -1767,6 +1770,9 @@ static long ceph_fallocate(struct file *file, int mode,
1767 spin_unlock(&ci->i_ceph_lock); 1770 spin_unlock(&ci->i_ceph_lock);
1768 if (dirty) 1771 if (dirty)
1769 __mark_inode_dirty(inode, dirty); 1772 __mark_inode_dirty(inode, dirty);
1773 if ((endoff > size) &&
1774 ceph_quota_is_max_bytes_approaching(inode, endoff))
1775 ceph_check_caps(ci, CHECK_CAPS_NODELAY, NULL);
1770 } 1776 }
1771 1777
1772 ceph_put_cap_refs(ci, got); 1778 ceph_put_cap_refs(ci, got);