[sheepdog] [PATCH UPDATE] collie: don't round_up vdi size & read/write
Liu Yuan
namei.unix at gmail.com
Wed May 22 10:40:52 CEST 2013
Openstack Glance doesn't assume the size will be rounded up. We don't need block
uint constraint, it is no harm to support random read/write on the sheepdog vdi
on the byte granularity.
With removing the sector constraint, we'll get a better file-like abstraction to
store arbitrary length objects.
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
collie/vdi.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/collie/vdi.c b/collie/vdi.c
index ccc4e04..7dea4f3 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -523,7 +523,7 @@ int do_vdi_create(const char *vdiname, int64_t vdi_size,
hdr.vdi.base_vdi_id = base_vid;
hdr.vdi.snapid = snapshot ? 1 : 0;
- hdr.vdi.vdi_size = round_up(vdi_size, 512);
+ hdr.vdi.vdi_size = vdi_size;
hdr.vdi.copies = nr_copies;
ret = collie_exec_req(sdhost, sdport, &hdr, buf);
@@ -1187,10 +1187,6 @@ static int vdi_read(int argc, char **argv)
ret = parse_option_size(argv[optind++], &offset);
if (ret < 0)
return EXIT_USAGE;
- if (offset % 512 != 0) {
- fprintf(stderr, "Read offset must be block-aligned\n");
- return EXIT_USAGE;
- }
if (argv[optind]) {
ret = parse_option_size(argv[optind++], &total);
if (ret < 0)
@@ -1214,7 +1210,6 @@ static int vdi_read(int argc, char **argv)
}
total = min(total, inode->vdi_size - offset);
- total = round_up(total, 512);
idx = offset / SD_DATA_OBJ_SIZE;
offset %= SD_DATA_OBJ_SIZE;
while (done < total) {
@@ -1270,10 +1265,6 @@ static int vdi_write(int argc, char **argv)
ret = parse_option_size(argv[optind++], &offset);
if (ret < 0)
return EXIT_USAGE;
- if (offset % 512 != 0) {
- fprintf(stderr, "Write offset must be block-aligned\n");
- return EXIT_USAGE;
- }
if (argv[optind]) {
ret = parse_option_size(argv[optind++], &total);
if (ret < 0)
@@ -1295,7 +1286,6 @@ static int vdi_write(int argc, char **argv)
}
total = min(total, inode->vdi_size - offset);
- total = round_up(total, 512);
idx = offset / SD_DATA_OBJ_SIZE;
offset %= SD_DATA_OBJ_SIZE;
while (done < total) {
--
1.7.9.5
More information about the sheepdog
mailing list