mirror of
https://github.com/ceph/ceph
synced 2025-02-24 03:27:10 +00:00
rgw: round bytes to the next 4k for quota use
Be more consistent as we round it like this in the objclass, so we need the accounting to match. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
parent
6f34df45ed
commit
2f9a93d385
@ -1279,6 +1279,11 @@ static inline uint64_t rgw_rounded_kb(uint64_t bytes)
|
||||
return (bytes + 1023) / 1024;
|
||||
}
|
||||
|
||||
static inline uint64_t rgw_rounded_objsize_kb(uint64_t bytes)
|
||||
{
|
||||
return ((bytes + 4095) & ~4095) / 1024;
|
||||
}
|
||||
|
||||
extern string rgw_string_unquote(const string& s);
|
||||
extern void parse_csv_string(const string& ival, vector<string>& ovals);
|
||||
extern int parse_key_value(string& in_str, string& key, string& val);
|
||||
|
@ -217,8 +217,8 @@ public:
|
||||
RGWQuotaStatsUpdate(int _objs_delta, uint64_t _added_bytes, uint64_t _removed_bytes) :
|
||||
objs_delta(_objs_delta), added_bytes(_added_bytes), removed_bytes(_removed_bytes) {}
|
||||
bool update(RGWQuotaCacheStats *entry) {
|
||||
uint64_t rounded_kb_added = rgw_rounded_kb(added_bytes);
|
||||
uint64_t rounded_kb_removed = rgw_rounded_kb(removed_bytes);
|
||||
uint64_t rounded_kb_added = rgw_rounded_objsize_kb(added_bytes);
|
||||
uint64_t rounded_kb_removed = rgw_rounded_objsize_kb(removed_bytes);
|
||||
|
||||
entry->stats.num_kb_rounded += (rounded_kb_added - rounded_kb_removed);
|
||||
entry->stats.num_kb += (added_bytes - removed_bytes) / 1024;
|
||||
@ -561,7 +561,7 @@ public:
|
||||
virtual int check_quota(const string& user, rgw_bucket& bucket,
|
||||
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota,
|
||||
uint64_t num_objs, uint64_t size) {
|
||||
uint64_t size_kb = rgw_rounded_kb(size);
|
||||
uint64_t size_kb = rgw_rounded_objsize_kb(size);
|
||||
|
||||
if (bucket_quota.enabled) {
|
||||
RGWStorageStats bucket_stats;
|
||||
|
Loading…
Reference in New Issue
Block a user