Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Add some more verbose logging of the cases that get clients into recovery.
[fs/lustre-release.git]
/
lustre
/
ptlrpc
/
pack_generic.c
diff --git
a/lustre/ptlrpc/pack_generic.c
b/lustre/ptlrpc/pack_generic.c
index
b110462
..
38399a1
100644
(file)
--- a/
lustre/ptlrpc/pack_generic.c
+++ b/
lustre/ptlrpc/pack_generic.c
@@
-22,10
+22,9
@@
*
*/
*
*/
-#define EXPORT_SYMTAB
-
#define DEBUG_SUBSYSTEM S_CLASS
#define DEBUG_SUBSYSTEM S_CLASS
+#include <linux/obd_support.h>
#include <linux/lustre_net.h>
int lustre_pack_msg(int count, int *lens, char **bufs, int *len,
#include <linux/lustre_net.h>
int lustre_pack_msg(int count, int *lens, char **bufs, int *len,
@@
-38,7
+37,7
@@
int lustre_pack_msg(int count, int *lens, char **bufs, int *len,
for (i = 0; i < count; i++)
size += size_round(lens[i]);
for (i = 0; i < count; i++)
size += size_round(lens[i]);
- *len = size
of(*m) + count * sizeof(__u32
) + size;
+ *len = size
_round(sizeof(*m) + count * sizeof(__u32)
) + size;
OBD_ALLOC(*msg, *len);
if (!*msg)
OBD_ALLOC(*msg, *len);
if (!*msg)
@@
-49,7
+48,7
@@
int lustre_pack_msg(int count, int *lens, char **bufs, int *len,
for (i = 0; i < count; i++)
m->buflens[i] = HTON__u32(lens[i]);
for (i = 0; i < count; i++)
m->buflens[i] = HTON__u32(lens[i]);
- ptr = (char *)m + size
of(*m) + sizeof(__u32) * count
;
+ ptr = (char *)m + size
_round(sizeof(*m) + count * sizeof(__u32))
;
for (i = 0; i < count; i++) {
char *tmp = NULL;
if (bufs)
for (i = 0; i < count; i++) {
char *tmp = NULL;
if (bufs)
@@
-64,12
+63,12
@@
int lustre_pack_msg(int count, int *lens, char **bufs, int *len,
* with the given sub-buffer lengths. */
int lustre_msg_size(int count, int *lengths)
{
* with the given sub-buffer lengths. */
int lustre_msg_size(int count, int *lengths)
{
- int size =
sizeof(struct lustre_msg)
, i;
+ int size =
0
, i;
for (i = 0; i < count; i++)
size += size_round(lengths[i]);
for (i = 0; i < count; i++)
size += size_round(lengths[i]);
- size +=
count * sizeof(__u32
);
+ size +=
size_round(sizeof(struct lustre_msg) + count * sizeof(__u32)
);
return size;
}
return size;
}
@@
-78,20
+77,18
@@
int lustre_unpack_msg(struct lustre_msg *m, int len)
{
int required_len, i;
{
int required_len, i;
- required_len = size
of(*m
);
+ required_len = size
_round(sizeof(*m)
);
if (len < required_len)
RETURN(-EINVAL);
m->opc = NTOH__u32(m->opc);
if (len < required_len)
RETURN(-EINVAL);
m->opc = NTOH__u32(m->opc);
- m->xid = NTOH__u32(m->xid);
m->status = NTOH__u32(m->status);
m->type = NTOH__u32(m->type);
m->status = NTOH__u32(m->status);
m->type = NTOH__u32(m->type);
- m->connid = NTOH__u32(m->connid);
m->bufcount = NTOH__u32(m->bufcount);
m->bufcount = NTOH__u32(m->bufcount);
- m->last_
rcvd = NTOH__u32(m->last_rcv
d);
- m->last_committed = NTOH__u
32
(m->last_committed);
+ m->last_
xid = NTOH__u64(m->last_xi
d);
+ m->last_committed = NTOH__u
64
(m->last_committed);
- required_len
+= m->bufcount * sizeof(__u32
);
+ required_len
= size_round(sizeof(*m) + m->bufcount * sizeof(__u32)
);
if (len < required_len)
RETURN(-EINVAL);
if (len < required_len)
RETURN(-EINVAL);
@@
-112,8
+109,15
@@
void *lustre_msg_buf(struct lustre_msg *m, int n)
{
int i, offset;
{
int i, offset;
+ if (!m) {
+ CERROR("no message buffer!\n");
+ LBUG();
+ return NULL;
+ }
+
if (n < 0 || n >= m->bufcount) {
if (n < 0 || n >= m->bufcount) {
- CERROR("referencing bad sub buffer!\n");
+ CERROR("referencing bad sub buffer (requested %d, count is "
+ "%d)!\n", n, m->bufcount);
LBUG();
return NULL;
}
LBUG();
return NULL;
}
@@
-121,7
+125,7
@@
void *lustre_msg_buf(struct lustre_msg *m, int n)
if (m->buflens[n] == 0)
return NULL;
if (m->buflens[n] == 0)
return NULL;
- offset = size
of(*m) + m->bufcount * sizeof(__u32
);
+ offset = size
_round(sizeof(*m) + m->bufcount * sizeof(__u32)
);
for (i = 0; i < n; i++)
offset += size_round(m->buflens[i]);
for (i = 0; i < n; i++)
offset += size_round(m->buflens[i]);