[sheepdog] [PATCH 5/6] sheep: refactor delete_inode

Liu Yuan namei.unix at gmail.com
Sat Apr 27 07:44:21 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

-rename it as vdi_delete_inode
-returen failure status if delete_inode fails

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/vdi.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 7230940..df42cff 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -573,16 +573,16 @@ struct deletion_work {
 
 static LIST_HEAD(deletion_work_list);
 
-static int delete_inode(struct deletion_work *dw)
+static int vdi_delete_inode(uint32_t vid)
 {
-	struct sd_inode *inode = vdi_get_inode(dw->vid);
+	struct sd_inode *inode = vdi_get_inode(vid);
 	int ret;
 
 	if (!inode)
 		return SD_RES_EIO;
 
 	memset(inode->name, 0, sizeof(inode->name));
-	ret = write_object(vid_to_vdi_oid(dw->vid), (char *)inode,
+	ret = write_object(vid_to_vdi_oid(vid), (char *)inode,
 			   SD_INODE_HEADER_SIZE, 0, false);
 	if (ret != 0) {
 		ret = SD_RES_EIO;
@@ -787,8 +787,7 @@ static int start_deletion(struct request *req, uint32_t vid)
 			sd_dprintf("snapshot chain has valid vdi, "
 				   "just mark vdi %" PRIx32 " as deleted.",
 				   dw->vid);
-			delete_inode(dw);
-			return SD_RES_SUCCESS;
+			return vdi_delete_inode(dw->vid);
 		}
 	}
 
-- 
1.7.9.5




More information about the sheepdog mailing list