[sheepdog] [PATCH 3/3] add selectable object_size support of VDI operation (1/2)

Teruaki Ishizaki tell.ishi at gmail.com
Fri Dec 12 02:51:13 CET 2014


>> @@ -451,10 +462,34 @@ static int vdi_create(int argc, char **argv)
>>       if (ret < 0)
>>               return EXIT_USAGE;
>>
>> -     if (size > SD_OLD_MAX_VDI_SIZE && 0 == vdi_cmd_data.store_policy) {
>> +     if (vdi_cmd_data.object_size)
>> +             old_max_total_size =
>> +                     vdi_cmd_data.object_size * OLD_MAX_DATA_OBJS;
>> +     else{
>> +             struct sd_req hdr;
>> +             struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
>> +             struct cluster_info cinfo;
>> +             sd_init_req(&hdr, SD_OP_CLUSTER_INFO);
>> +             hdr.data_length = sizeof(cinfo);
>> +             ret = dog_exec_req(&sd_nid, &hdr, &cinfo);
>> +             if (ret < 0) {
>> +                     sd_err("Fail to execute request: SD_OP_CLUSTER_INFO");
>> +                     ret = EXIT_FAILURE;
>> +                     goto out;
>> +             }
>> +             if (rsp->result != SD_RES_SUCCESS) {
>> +                     sd_err("%s", sd_strerror(rsp->result));
>> +                     ret = EXIT_FAILURE;
>> +                     goto out;
>> +             }
>> +             old_max_total_size = cinfo.object_size * OLD_MAX_DATA_OBJS;
>> +     }
>
> I cannot understand that why blocksize should be read before creating
> VDI. If sd_req->vdi.object_size is equal to 0, sheep can use its
> default value from cinfo->object_size.
When shift bit num is set to 0, vdi_cmd_data.object_size is set to 1
byte.(not 0 byte)

But, if shift_bit num is not specifed,  vdi_cmd_data.object_size is
equal to 0 and VDI is created with using cinfo.object_size.
Then, to calculate VDI max size by using cinfo.object_size, we need to
do SD_OP_CLUSTER_INFO.


> In addition, sd_inode already has a member block_size_shift for
> representing object size. Newly added members of cluster_info and
> sd_req should be a number of block size shift, not bytes.
OK, I'll change it

Thanks,
Teruaki



More information about the sheepdog mailing list