[sheepdog] [PATCH v1] sheep/http: remove unnecessary code

Bingpeng Zhu nkuzbp at foxmail.com
Thu Jul 24 14:47:49 CEST 2014


In function onode_populate_extents, it is unnecessary to
add last_ext->data_len, since last_ext->data_len equals
zero in that condition.

Signed-off-by: Bingpeng Zhu <nkuzbp at foxmail.com>
---
 sheep/http/kv.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sheep/http/kv.c b/sheep/http/kv.c
index 6805f12..e92faff 100644
--- a/sheep/http/kv.c
+++ b/sheep/http/kv.c
@@ -732,9 +732,8 @@ static int onode_populate_extents(struct kv_onode *onode,
 
 	data_buf = xmalloc(write_buffer_size);
 	if (last_ext->data_len == 0 && onode->nr_extent == 1) {
-		offset = last_ext->start * SD_DATA_OBJ_SIZE +
-			 last_ext->data_len;
-		last_ext->data_len += req->data_length;
+		offset = last_ext->start * SD_DATA_OBJ_SIZE;
+		last_ext->data_len = req->data_length;
 	} else if (last_ext->data_len > 0) {
 		offset = last_ext->start * SD_DATA_OBJ_SIZE +
 			 last_ext->data_len;
-- 
1.7.1







More information about the sheepdog mailing list