]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client/Client: change dir's size delta to current write file size delta 26104/head
authorguoyong <guo.yong33@zte.com.cn>
Sat, 26 Jan 2019 09:01:45 +0000 (17:01 +0800)
committerguoyong <guo.yong33@zte.com.cn>
Sat, 26 Jan 2019 09:01:45 +0000 (17:01 +0800)
Since dir's size always is zero, which lead to quota bytes approaching
calculate lose efficacy, the client always use delay message to notify
mds update dir used space statistic, and cause client update dir used
space statistic more delays. We change dir's size to current write file
size, when current write file delta exceed the threshold of available quota,
then client will updata used space statistic no delay and prevent excess quota writing.

Signed-off-by: guoyong <guo.yong33@zte.com.cn>
src/client/Client.cc

index a0b54d3dc10d7505e6e529944c91ab2762e344af..ba69875446b825d680611a6cf637b7945adbdc87 100644 (file)
@@ -14011,16 +14011,16 @@ bool Client::is_quota_bytes_exceeded(Inode *in, int64_t new_bytes,
 
 bool Client::is_quota_bytes_approaching(Inode *in, const UserPerm& perms)
 {
+  ceph_assert(in->size >= in->reported_size);
+  const uint64_t size = in->size - in->reported_size;
   return check_quota_condition(in, perms,
-      [](const Inode &in) {
+      [&size](const Inode &in) {
         if (in.quota.max_bytes) {
           if (in.rstat.rbytes >= in.quota.max_bytes) {
             return true;
           }
 
-          ceph_assert(in.size >= in.reported_size);
           const uint64_t space = in.quota.max_bytes - in.rstat.rbytes;
-          const uint64_t size = in.size - in.reported_size;
           return (space >> 4) < size;
         } else {
           return false;