All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Rick Peralta <fbp@tiac.net>
Cc: Jeff Garzik <jeff@garzik.org>,
	Project Hail List <hail-devel@vger.kernel.org>
Subject: Re: [Patch] chunkd: use port xxx82 to build
Date: Fri, 7 Aug 2009 18:55:56 -0600	[thread overview]
Message-ID: <20090807185556.65b19934@redhat.com> (raw)
In-Reply-To: <22384029.1249688189096.JavaMail.root@elwamui-mouette.atl.sa.earthlink.net>

On Fri, 7 Aug 2009 19:36:28 -0400 (EDT), Rick Peralta <fbp@tiac.net> wrote:

> I was looking from net_write() & net_read() to see where they were
> called and what was passed to them.  struct chunksrv_req & struct
> chunksrv_resp_get seem to be the primary structures.

I didn't know how serious you were about it, so I went ahead and
looked at the endian stuff. The immediate issue - the hang of
basic-object - was addressed with the following fix:

diff --git a/server/object.c b/server/object.c
index 4eb62f7..6ea1500 100644
--- a/server/object.c
+++ b/server/object.c
@@ -290,7 +290,7 @@ bool object_get(struct client *cli, bool want_body)
 
 	cli->in_len = obj->size;
 
-	resp->req.data_len = GUINT32_TO_LE(obj->size);
+	resp->req.data_len = GUINT64_TO_LE((uint64_t)obj->size);
 	memcpy(resp->req.checksum, obj->hashstr, sizeof(obj->hashstr));
 	resp->req.checksum[sizeof(obj->hashstr)] = 0;
 	resp->mtime = GUINT64_TO_LE(obj->mtime);
diff --git a/server/server.c b/server/server.c
index 2ad3db2..161dc67 100644
--- a/server/server.c
+++ b/server/server.c
@@ -639,7 +639,7 @@ static bool cli_resp_xml(struct client *cli, GList *content)
 {
 	int rc;
 	bool rcb;
-	int content_len = strlist_len(content);
+	size_t content_len = strlist_len(content);
 	struct chunksrv_req *resp = NULL;
 
 	resp = malloc(sizeof(*resp));
@@ -650,7 +650,7 @@ static bool cli_resp_xml(struct client *cli, GList *content)
 
 	memcpy(resp, &cli->creq, sizeof(cli->creq));
 
-	resp->data_len = GUINT64_TO_LE(content_len);
+	resp->data_len = GUINT64_TO_LE((uint64_t)content_len);
 
 	cli->state = evt_recycle;
 

We have two problems above:

 #1 the result of byteswap must not be allowed to be type-promoted,
    sign-extended, or otherwise changed by the language. Only bit-to-bit
    assignment will do. Therefore, we must only use 64-bit conversions
    when assigning to req->data_len.

 #2 for some reason swapping of a 32-bit value does not work either,
    I suspect clipping when shifting. So I had to fix that too.

With the above, basic-object passes, test advance further, and then
large-object fails like so:

test failed on line 134

        rcb = stc_get_start(stc, key, &rfd, &len);
        OK(len == (N_BUFS * BUFSZ));   <------- fails. how much is len?

Curiously, it fails on 32-bit PPC only and works on ppc64.

With this, I'm going to quit stepping on your toes and go work on
CLD interface for Chunkd, then data replication in tabled.
Sorry for the interference.

Good luck,
-- Pete

  parent reply	other threads:[~2009-08-08  0:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 23:36 [Patch] chunkd: use port xxx82 to build Rick Peralta
2009-08-07 23:47 ` Jeff Garzik
2009-08-08  0:55 ` Pete Zaitcev [this message]
2009-08-10 17:37   ` Jeff Garzik
2009-08-10 18:07     ` Pete Zaitcev
2009-08-12  6:49   ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2009-08-13 16:59 Rick Peralta
2009-08-13 14:46 Rick Peralta
2009-08-13 15:27 ` Jeff Garzik
2009-08-12 23:42 Rick Peralta
2009-08-13  0:11 ` Jeff Garzik
2009-08-08  4:24 Rick Peralta
2009-08-08  4:47 ` Jeff Garzik
2009-08-08  3:27 Rick Peralta
2009-08-08  3:38 ` Jeff Garzik
2009-08-07 14:11 Rick Peralta
2009-08-07 14:16 ` Fabian Deutsch
2009-08-07 14:23 ` Jeff Garzik
     [not found] <16874317.1249435954950.JavaMail.root@mswamui-andean.atl.sa.earthlink.net>
     [not found] ` <4A78E306.7000707@garzik.org>
2009-08-05  1:43   ` Pete Zaitcev
2009-08-05  1:50     ` Jeff Garzik
2009-08-05  0:34 Pete Zaitcev
2009-08-05  0:57 ` Jeff Garzik
2009-08-05  1:00   ` Jeff Garzik
2009-08-05  1:11     ` Pete Zaitcev
2009-08-05  1:26       ` Jeff Garzik
2009-08-05  1:04   ` Pete Zaitcev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090807185556.65b19934@redhat.com \
    --to=zaitcev@redhat.com \
    --cc=fbp@tiac.net \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.