From 4aa102f911db7e6928f80c421a32ac8f9f283c6e Mon Sep 17 00:00:00 2001 From: Yuan Zhou Date: Thu, 9 Jul 2015 16:56:07 +0800 Subject: [PATCH] rgw: Make RGW_MAX_PUT_SIZE configurable The 5GB limit of a single operation uploading was part of S3 spec. However some private setups may have some special requirements on this limit. It's more convinent to have a configurable value. Fixes: #6999 Signed-off-by: Yuan Zhou --- src/common/config_opts.h | 1 + src/rgw/rgw_common.h | 1 - src/rgw/rgw_rest.cc | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 1ea85a649662..7280310a7ce4 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -932,6 +932,7 @@ OPTION(nss_db_path, OPT_STR, "") // path to nss db OPTION(rgw_max_chunk_size, OPT_INT, 512 * 1024) +OPTION(rgw_max_put_size, OPT_U64, 5ULL*1024*1024*1024) /** * override max bucket index shards in zone configuration (if not zero) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index bef7fa89c993..a32d363797c3 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -83,7 +83,6 @@ using ceph::crypto::MD5; #define RGW_BUCKETS_OBJ_SUFFIX ".buckets" #define RGW_MAX_PENDING_CHUNKS 16 -#define RGW_MAX_PUT_SIZE (5ULL*1024*1024*1024) #define RGW_MIN_MULTIPART_SIZE (5ULL*1024*1024) #define RGW_FORMAT_PLAIN 0 diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 903f44140d9b..a03e31fabf2e 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -816,7 +816,7 @@ int RGWPutObj_ObjStore::verify_params() { if (s->length) { off_t len = atoll(s->length); - if (len > (off_t)RGW_MAX_PUT_SIZE) { + if (len > (off_t)(s->cct->_conf->rgw_max_put_size)) { return -ERR_TOO_LARGE; } } @@ -855,7 +855,7 @@ int RGWPutObj_ObjStore::get_data(bufferlist& bl) bl.append(bp, 0, len); } - if ((uint64_t)ofs + len > RGW_MAX_PUT_SIZE) { + if ((uint64_t)ofs + len > s->cct->_conf->rgw_max_put_size) { return -ERR_TOO_LARGE; } @@ -874,7 +874,7 @@ int RGWPostObj_ObjStore::verify_params() return -ERR_LENGTH_REQUIRED; } off_t len = atoll(s->length); - if (len > (off_t)RGW_MAX_PUT_SIZE) { + if (len > (off_t)(s->cct->_conf->rgw_max_put_size)) { return -ERR_TOO_LARGE; } -- 2.47.3