[sheepdog] [PATCH v2 06/10] sheep: try to recover only from the target epoch

MORITA Kazutaka morita.kazutaka at gmail.com
Thu May 9 04:38:55 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Now we have a stale object with an appropriate suffix, so no need to try to read
from the newer epoch.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/plain_store.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index cb2fd90..c44a42f 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -255,7 +255,6 @@ int default_read(uint64_t oid, const struct siocb *iocb)
 {
 	int ret;
 	char path[PATH_MAX];
-	uint32_t epoch = sys_epoch();
 
 	get_obj_path(oid, path);
 	ret = default_read_from_path(oid, path, iocb);
@@ -264,9 +263,8 @@ int default_read(uint64_t oid, const struct siocb *iocb)
 	 * If the request is againt the older epoch, try to read from
 	 * the stale directory
 	 */
-	while (ret == SD_RES_NO_OBJ && iocb->epoch < epoch) {
-		epoch--;
-		get_stale_obj_path(oid, epoch, path);
+	if (ret == SD_RES_NO_OBJ && iocb->epoch < sys_epoch()) {
+		get_stale_obj_path(oid, iocb->epoch, path);
 		ret = default_read_from_path(oid, path, iocb);
 	}
 
-- 
1.7.9.5




More information about the sheepdog mailing list