[sheepdog] [PATCH v1 2/2] sheep/http: add support for big object which is larger than SD_DATA_OBJ_SIZE
Liu Yuan
namei.unix at gmail.com
Mon Dec 9 03:56:06 CET 2013
On Fri, Dec 06, 2013 at 05:04:19PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
>
> Using hyper volume and extent structure of onode to store large number of
> objects size of which exceed SD_DATA_OBJ_SIZE.
>
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
> sheep/http/kv.c | 422 ++++++++++++++++++++++++++++++++++++++++-------------
> sheep/http/kv.h | 15 +-
> sheep/http/s3.c | 8 +-
> sheep/http/swift.c | 30 +---
> 4 files changed, 335 insertions(+), 140 deletions(-)
>
> diff --git a/sheep/http/kv.c b/sheep/http/kv.c
> index 55a7e24..68f0759 100644
> --- a/sheep/http/kv.c
> +++ b/sheep/http/kv.c
> @@ -21,6 +21,7 @@ struct bucket_inode {
> uint64_t obj_count;
> uint64_t bytes_used;
> uint32_t vdi_id; /* kv_onode stores in this vdi */
> + uint32_t data_vid; /* data of objects store in this vdi */
> uint32_t pad;
> uint64_t reserved[SD_MAX_BUCKET_NAME/sizeof(uint64_t) - 3];
> };
> @@ -172,13 +173,13 @@ int kv_create_account(const char *account)
> return kv_create_hyper_volume(account, &vdi_id);
> }
>
> -typedef void (*list_cb)(struct http_request *req, const char *bucket,
> +typedef void (*list_bucket_cb)(struct http_request *req, const char *bucket,
> void *opaque);
>
> struct list_buckets_arg {
> struct http_request *req;
> const char *account;
> - list_cb cb;
> + list_bucket_cb cb;
> uint32_t bucket_counter;
> };
>
> @@ -360,7 +361,16 @@ static int delete_bucket(struct sd_inode *account_inode, uint64_t idx,
> bnode->vdi_id = 0;
> snprintf(vdi_name, SD_MAX_VDI_LEN, "%s/%s",
> account_inode->name, bucket);
> -
> + /* delete vdi which store kv_onode */
> + ret = kv_delete_vdi(vdi_name);
> + if (ret != SD_RES_SUCCESS) {
> + sd_err("Failed to delete vdi %s", vdi_name);
> + ret = -1;
> + goto out;
> + }
> + /* delete vdi which store object data */
> + snprintf(vdi_name, SD_MAX_VDI_LEN, "%s/%s/allocator",
> + account_inode->name, bucket);
> ret = kv_delete_vdi(vdi_name);
> if (ret != SD_RES_SUCCESS) {
> sd_err("Failed to delete vdi %s", vdi_name);
> @@ -462,12 +472,29 @@ static int add_bucket(struct sd_inode *account_inode, uint64_t idx,
> bnode->bytes_used = 0;
> snprintf(vdi_name, SD_MAX_VDI_LEN, "%s/%s",
> account_inode->name, bucket);
> + /* create vdi to store kv_onode */
> ret = kv_create_hyper_volume(vdi_name, &(bnode->vdi_id));
>
&bnode->vdi_id is fine because -> is has priority over & operator.
Thanks
Yuan
More information about the sheepdog
mailing list