aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorLuis Henriques <lhenriques@suse.com>2018-01-12 17:19:29 +0000
committerIlya Dryomov <idryomov@gmail.com>2018-04-02 11:17:53 +0200
commitd557c48db730eaab6b75d4af332c135309b7a6a4 (patch)
tree74b28856b9052a36b588d9baf77b5781f8479c97 /fs/ceph/inode.c
parentceph: quota: cache inode pointer in ceph_snap_realm (diff)
downloadlinux-dev-d557c48db730eaab6b75d4af332c135309b7a6a4.tar.xz
linux-dev-d557c48db730eaab6b75d4af332c135309b7a6a4.zip
ceph: quota: add counter for snaprealms with quota
By keeping a counter with the number of snaprealms that have quota set allows to optimize the functions that need to walk throught the realms hierarchy looking for quotas. Thus, if this counter is zero it's safe to assume that there are no realms with quota. 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/inode.c')
-rw-r--r--fs/ceph/inode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 8ea11b1a2e23..8bf60250309e 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -539,6 +539,9 @@ void ceph_destroy_inode(struct inode *inode)
ceph_queue_caps_release(inode);
+ if (__ceph_has_any_quota(ci))
+ ceph_adjust_quota_realms_count(inode, false);
+
/*
* we may still have a snap_realm reference if there are stray
* caps in i_snap_caps.
@@ -796,8 +799,7 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
inode->i_rdev = le32_to_cpu(info->rdev);
inode->i_blkbits = fls(le32_to_cpu(info->layout.fl_stripe_unit)) - 1;
- ci->i_max_bytes = iinfo->max_bytes;
- ci->i_max_files = iinfo->max_files;
+ __ceph_update_quota(ci, iinfo->max_bytes, iinfo->max_files);
if ((new_version || (new_issued & CEPH_CAP_AUTH_SHARED)) &&
(issued & CEPH_CAP_AUTH_EXCL) == 0) {