[sheepdog] [PATCH] collie: don't use direct write for 'vdi snapshot'
Liu Yuan
namei.unix at gmail.com
Thu Jul 18 08:33:27 CEST 2013
- also remove an unnecessary tag check
Direct write will ask cache layer to flush_and_delete cache blindly
(set create = 1), which will be a time consuming process and lead
'collie vdi snapshot' easily timeout and cause unexpected behavior thereafter.
Use non-direct write to be cache friendly. 'collie vdi snapshot' will be boosted
a lot with cache enabled.
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
collie/vdi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/collie/vdi.c b/collie/vdi.c
index 4fd2bbc..4dea240 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -582,15 +582,15 @@ static int vdi_snapshot(int argc, char **argv)
if (ret != EXIT_SUCCESS)
return ret;
- if (vdi_cmd_data.snapshot_tag[0]) {
- ret = sd_write_object(vid_to_vdi_oid(vid), 0, vdi_cmd_data.snapshot_tag,
- SD_MAX_VDI_TAG_LEN,
- offsetof(struct sd_inode, tag),
- 0, inode->nr_copies, false, true);
- }
+ ret = sd_write_object(vid_to_vdi_oid(vid), 0, vdi_cmd_data.snapshot_tag,
+ SD_MAX_VDI_TAG_LEN,
+ offsetof(struct sd_inode, tag),
+ 0, inode->nr_copies, false, false);
+ if (ret != SD_RES_SUCCESS)
+ return EXIT_FAILURE;
ret = do_vdi_create(vdiname, inode->vdi_size, vid, NULL, true,
- inode->nr_copies);
+ inode->nr_copies);
if (ret == EXIT_SUCCESS && verbose) {
if (raw_output)
--
1.7.9.5
More information about the sheepdog
mailing list