[Sheepdog] [PATCH] collie: return SD_NO_SPACE when there is no free space

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon May 10 08:53:34 CEST 2010


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/store.c           |   10 ++++++++--
 include/sheepdog_proto.h |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/collie/store.c b/collie/store.c
index d4d3211..7a83ee9 100644
--- a/collie/store.c
+++ b/collie/store.c
@@ -658,7 +658,10 @@ static int store_queue_request_local(struct request *req, char *buf, uint32_t ep
 
 		ret = pwrite64(fd, buf, SD_DATA_OBJ_SIZE, 0);
 		if (ret != SD_DATA_OBJ_SIZE) {
-			ret = SD_RES_EIO;
+			if (errno == ENOSPC)
+				ret = SD_RES_NO_SPACE;
+			else
+				ret = SD_RES_EIO;
 			goto out;
 		}
 	default:
@@ -724,7 +727,10 @@ static int store_queue_request_local(struct request *req, char *buf, uint32_t ep
 	case SD_OP_CREATE_AND_WRITE_OBJ:
 		ret = pwrite64(fd, req->data, hdr->data_length, hdr->offset);
 		if (ret != hdr->data_length) {
-			ret = SD_RES_EIO;
+			if (errno == ENOSPC)
+				ret = SD_RES_NO_SPACE;
+			else
+				ret = SD_RES_EIO;
 			goto out;
 		}
 
diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index 19ace97..127a51e 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -53,6 +53,7 @@
 #define SD_RES_NO_MEM        0x12 /* Cannot allocate memory */
 #define SD_RES_FULL_VDI      0x13 /* we already have the maximum vdis */
 #define SD_RES_VER_MISMATCH  0x14 /* Protocol version mismatch */
+#define SD_RES_NO_SPACE      0x15 /* Server has no room for new objects */
 
 /*
  * Object ID rules
-- 
1.5.6.5




More information about the sheepdog mailing list