diff options
author | Dominique Martinet <dominique.martinet@cea.fr> | 2018-07-30 01:55:19 -0400 |
---|---|---|
committer | Dominique Martinet <dominique.martinet@cea.fr> | 2018-09-07 12:39:45 -0400 |
commit | 523adb6cc10b48655c0abe556505240741425b49 (patch) | |
tree | 16af209a90fefd0e5b6a0dd25ddfbca9ca4530fe /net/9p | |
parent | 6348b903d79119a8157aace08ab99521f5dba139 (diff) |
9p: embed fcall in req to round down buffer allocs
'msize' is often a power of two, or at least page-aligned, so avoiding
an overhead of two dozen bytes for each allocation will help the
allocator do its work and reduce memory fragmentation.
Link: http://lkml.kernel.org/r/1533825236-22896-1-git-send-email-asmadeus@codewreck.org
Suggested-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Reviewed-by: Greg Kurz <groug@kaod.org>
Acked-by: Jun Piao <piaojun@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/client.c | 167 | ||||
-rw-r--r-- | net/9p/trans_fd.c | 12 | ||||
-rw-r--r-- | net/9p/trans_rdma.c | 29 | ||||
-rw-r--r-- | net/9p/trans_virtio.c | 18 | ||||
-rw-r--r-- | net/9p/trans_xen.c | 12 |
5 files changed, 122 insertions, 116 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 88db45966740..ed78751aee7c 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -231,16 +231,20 @@ free_and_return: | |||
231 | return ret; | 231 | return ret; |
232 | } | 232 | } |
233 | 233 | ||
234 | static struct p9_fcall *p9_fcall_alloc(int alloc_msize) | 234 | static int p9_fcall_init(struct p9_fcall *fc, int alloc_msize) |
235 | { | 235 | { |
236 | struct p9_fcall *fc; | 236 | fc->sdata = kmalloc(alloc_msize, GFP_NOFS); |
237 | fc = kmalloc(sizeof(struct p9_fcall) + alloc_msize, GFP_NOFS); | 237 | if (!fc->sdata) |
238 | if (!fc) | 238 | return -ENOMEM; |
239 | return NULL; | ||
240 | fc->capacity = alloc_msize; | 239 | fc->capacity = alloc_msize; |
241 | fc->sdata = (char *) fc + sizeof(struct p9_fcall); | 240 | return 0; |
242 | return fc; | 241 | } |
242 | |||
243 | void p9_fcall_fini(struct p9_fcall *fc) | ||
244 | { | ||
245 | kfree(fc->sdata); | ||
243 | } | 246 | } |
247 | EXPORT_SYMBOL(p9_fcall_fini); | ||
244 | 248 | ||
245 | static struct kmem_cache *p9_req_cache; | 249 | static struct kmem_cache *p9_req_cache; |
246 | 250 | ||
@@ -263,13 +267,13 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned int max_size) | |||
263 | if (!req) | 267 | if (!req) |
264 | return NULL; | 268 | return NULL; |
265 | 269 | ||
266 | req->tc = p9_fcall_alloc(alloc_msize); | 270 | if (p9_fcall_init(&req->tc, alloc_msize)) |
267 | req->rc = p9_fcall_alloc(alloc_msize); | 271 | goto free_req; |
268 | if (!req->tc || !req->rc) | 272 | if (p9_fcall_init(&req->rc, alloc_msize)) |
269 | goto free; | 273 | goto free; |
270 | 274 | ||
271 | p9pdu_reset(req->tc); | 275 | p9pdu_reset(&req->tc); |
272 | p9pdu_reset(req->rc); | 276 | p9pdu_reset(&req->rc); |
273 | req->status = REQ_STATUS_ALLOC; | 277 | req->status = REQ_STATUS_ALLOC; |
274 | init_waitqueue_head(&req->wq); | 278 | init_waitqueue_head(&req->wq); |
275 | INIT_LIST_HEAD(&req->req_list); | 279 | INIT_LIST_HEAD(&req->req_list); |
@@ -281,7 +285,7 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned int max_size) | |||
281 | GFP_NOWAIT); | 285 | GFP_NOWAIT); |
282 | else | 286 | else |
283 | tag = idr_alloc(&c->reqs, req, 0, P9_NOTAG, GFP_NOWAIT); | 287 | tag = idr_alloc(&c->reqs, req, 0, P9_NOTAG, GFP_NOWAIT); |
284 | req->tc->tag = tag; | 288 | req->tc.tag = tag; |
285 | spin_unlock_irq(&c->lock); | 289 | spin_unlock_irq(&c->lock); |
286 | idr_preload_end(); | 290 | idr_preload_end(); |
287 | if (tag < 0) | 291 | if (tag < 0) |
@@ -290,8 +294,9 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned int max_size) | |||
290 | return req; | 294 | return req; |
291 | 295 | ||
292 | free: | 296 | free: |
293 | kfree(req->tc); | 297 | p9_fcall_fini(&req->tc); |
294 | kfree(req->rc); | 298 | p9_fcall_fini(&req->rc); |
299 | free_req: | ||
295 | kmem_cache_free(p9_req_cache, req); | 300 | kmem_cache_free(p9_req_cache, req); |
296 | return ERR_PTR(-ENOMEM); | 301 | return ERR_PTR(-ENOMEM); |
297 | } | 302 | } |
@@ -329,14 +334,14 @@ EXPORT_SYMBOL(p9_tag_lookup); | |||
329 | static void p9_free_req(struct p9_client *c, struct p9_req_t *r) | 334 | static void p9_free_req(struct p9_client *c, struct p9_req_t *r) |
330 | { | 335 | { |
331 | unsigned long flags; | 336 | unsigned long flags; |
332 | u16 tag = r->tc->tag; | 337 | u16 tag = r->tc.tag; |
333 | 338 | ||
334 | p9_debug(P9_DEBUG_MUX, "clnt %p req %p tag: %d\n", c, r, tag); | 339 | p9_debug(P9_DEBUG_MUX, "clnt %p req %p tag: %d\n", c, r, tag); |
335 | spin_lock_irqsave(&c->lock, flags); | 340 | spin_lock_irqsave(&c->lock, flags); |
336 | idr_remove(&c->reqs, tag); | 341 | idr_remove(&c->reqs, tag); |
337 | spin_unlock_irqrestore(&c->lock, flags); | 342 | spin_unlock_irqrestore(&c->lock, flags); |
338 | kfree(r->tc); | 343 | p9_fcall_fini(&r->tc); |
339 | kfree(r->rc); | 344 | p9_fcall_fini(&r->rc); |
340 | kmem_cache_free(p9_req_cache, r); | 345 | kmem_cache_free(p9_req_cache, r); |
341 | } | 346 | } |
342 | 347 | ||
@@ -368,7 +373,7 @@ static void p9_tag_cleanup(struct p9_client *c) | |||
368 | */ | 373 | */ |
369 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status) | 374 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status) |
370 | { | 375 | { |
371 | p9_debug(P9_DEBUG_MUX, " tag %d\n", req->tc->tag); | 376 | p9_debug(P9_DEBUG_MUX, " tag %d\n", req->tc.tag); |
372 | 377 | ||
373 | /* | 378 | /* |
374 | * This barrier is needed to make sure any change made to req before | 379 | * This barrier is needed to make sure any change made to req before |
@@ -378,7 +383,7 @@ void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status) | |||
378 | req->status = status; | 383 | req->status = status; |
379 | 384 | ||
380 | wake_up(&req->wq); | 385 | wake_up(&req->wq); |
381 | p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag); | 386 | p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc.tag); |
382 | } | 387 | } |
383 | EXPORT_SYMBOL(p9_client_cb); | 388 | EXPORT_SYMBOL(p9_client_cb); |
384 | 389 | ||
@@ -449,18 +454,18 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
449 | int err; | 454 | int err; |
450 | int ecode; | 455 | int ecode; |
451 | 456 | ||
452 | err = p9_parse_header(req->rc, NULL, &type, NULL, 0); | 457 | err = p9_parse_header(&req->rc, NULL, &type, NULL, 0); |
453 | if (req->rc->size >= c->msize) { | 458 | if (req->rc.size >= c->msize) { |
454 | p9_debug(P9_DEBUG_ERROR, | 459 | p9_debug(P9_DEBUG_ERROR, |
455 | "requested packet size too big: %d\n", | 460 | "requested packet size too big: %d\n", |
456 | req->rc->size); | 461 | req->rc.size); |
457 | return -EIO; | 462 | return -EIO; |
458 | } | 463 | } |
459 | /* | 464 | /* |
460 | * dump the response from server | 465 | * dump the response from server |
461 | * This should be after check errors which poplulate pdu_fcall. | 466 | * This should be after check errors which poplulate pdu_fcall. |
462 | */ | 467 | */ |
463 | trace_9p_protocol_dump(c, req->rc); | 468 | trace_9p_protocol_dump(c, &req->rc); |
464 | if (err) { | 469 | if (err) { |
465 | p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); | 470 | p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); |
466 | return err; | 471 | return err; |
@@ -470,7 +475,7 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
470 | 475 | ||
471 | if (!p9_is_proto_dotl(c)) { | 476 | if (!p9_is_proto_dotl(c)) { |
472 | char *ename; | 477 | char *ename; |
473 | err = p9pdu_readf(req->rc, c->proto_version, "s?d", | 478 | err = p9pdu_readf(&req->rc, c->proto_version, "s?d", |
474 | &ename, &ecode); | 479 | &ename, &ecode); |
475 | if (err) | 480 | if (err) |
476 | goto out_err; | 481 | goto out_err; |
@@ -486,7 +491,7 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
486 | } | 491 | } |
487 | kfree(ename); | 492 | kfree(ename); |
488 | } else { | 493 | } else { |
489 | err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode); | 494 | err = p9pdu_readf(&req->rc, c->proto_version, "d", &ecode); |
490 | err = -ecode; | 495 | err = -ecode; |
491 | 496 | ||
492 | p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); | 497 | p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); |
@@ -520,12 +525,12 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
520 | int8_t type; | 525 | int8_t type; |
521 | char *ename = NULL; | 526 | char *ename = NULL; |
522 | 527 | ||
523 | err = p9_parse_header(req->rc, NULL, &type, NULL, 0); | 528 | err = p9_parse_header(&req->rc, NULL, &type, NULL, 0); |
524 | /* | 529 | /* |
525 | * dump the response from server | 530 | * dump the response from server |
526 | * This should be after parse_header which poplulate pdu_fcall. | 531 | * This should be after parse_header which poplulate pdu_fcall. |
527 | */ | 532 | */ |
528 | trace_9p_protocol_dump(c, req->rc); | 533 | trace_9p_protocol_dump(c, &req->rc); |
529 | if (err) { | 534 | if (err) { |
530 | p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); | 535 | p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); |
531 | return err; | 536 | return err; |
@@ -540,13 +545,13 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
540 | /* 7 = header size for RERROR; */ | 545 | /* 7 = header size for RERROR; */ |
541 | int inline_len = in_hdrlen - 7; | 546 | int inline_len = in_hdrlen - 7; |
542 | 547 | ||
543 | len = req->rc->size - req->rc->offset; | 548 | len = req->rc.size - req->rc.offset; |
544 | if (len > (P9_ZC_HDR_SZ - 7)) { | 549 | if (len > (P9_ZC_HDR_SZ - 7)) { |
545 | err = -EFAULT; | 550 | err = -EFAULT; |
546 | goto out_err; | 551 | goto out_err; |
547 | } | 552 | } |
548 | 553 | ||
549 | ename = &req->rc->sdata[req->rc->offset]; | 554 | ename = &req->rc.sdata[req->rc.offset]; |
550 | if (len > inline_len) { | 555 | if (len > inline_len) { |
551 | /* We have error in external buffer */ | 556 | /* We have error in external buffer */ |
552 | if (!copy_from_iter_full(ename + inline_len, | 557 | if (!copy_from_iter_full(ename + inline_len, |
@@ -556,7 +561,7 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
556 | } | 561 | } |
557 | } | 562 | } |
558 | ename = NULL; | 563 | ename = NULL; |
559 | err = p9pdu_readf(req->rc, c->proto_version, "s?d", | 564 | err = p9pdu_readf(&req->rc, c->proto_version, "s?d", |
560 | &ename, &ecode); | 565 | &ename, &ecode); |
561 | if (err) | 566 | if (err) |
562 | goto out_err; | 567 | goto out_err; |
@@ -572,7 +577,7 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
572 | } | 577 | } |
573 | kfree(ename); | 578 | kfree(ename); |
574 | } else { | 579 | } else { |
575 | err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode); | 580 | err = p9pdu_readf(&req->rc, c->proto_version, "d", &ecode); |
576 | err = -ecode; | 581 | err = -ecode; |
577 | 582 | ||
578 | p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); | 583 | p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); |
@@ -605,7 +610,7 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq) | |||
605 | int16_t oldtag; | 610 | int16_t oldtag; |
606 | int err; | 611 | int err; |
607 | 612 | ||
608 | err = p9_parse_header(oldreq->tc, NULL, NULL, &oldtag, 1); | 613 | err = p9_parse_header(&oldreq->tc, NULL, NULL, &oldtag, 1); |
609 | if (err) | 614 | if (err) |
610 | return err; | 615 | return err; |
611 | 616 | ||
@@ -649,12 +654,12 @@ static struct p9_req_t *p9_client_prepare_req(struct p9_client *c, | |||
649 | return req; | 654 | return req; |
650 | 655 | ||
651 | /* marshall the data */ | 656 | /* marshall the data */ |
652 | p9pdu_prepare(req->tc, req->tc->tag, type); | 657 | p9pdu_prepare(&req->tc, req->tc.tag, type); |
653 | err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap); | 658 | err = p9pdu_vwritef(&req->tc, c->proto_version, fmt, ap); |
654 | if (err) | 659 | if (err) |
655 | goto reterr; | 660 | goto reterr; |
656 | p9pdu_finalize(c, req->tc); | 661 | p9pdu_finalize(c, &req->tc); |
657 | trace_9p_client_req(c, type, req->tc->tag); | 662 | trace_9p_client_req(c, type, req->tc.tag); |
658 | return req; | 663 | return req; |
659 | reterr: | 664 | reterr: |
660 | p9_free_req(c, req); | 665 | p9_free_req(c, req); |
@@ -739,7 +744,7 @@ recalc_sigpending: | |||
739 | goto reterr; | 744 | goto reterr; |
740 | 745 | ||
741 | err = p9_check_errors(c, req); | 746 | err = p9_check_errors(c, req); |
742 | trace_9p_client_res(c, type, req->rc->tag, err); | 747 | trace_9p_client_res(c, type, req->rc.tag, err); |
743 | if (!err) | 748 | if (!err) |
744 | return req; | 749 | return req; |
745 | reterr: | 750 | reterr: |
@@ -821,7 +826,7 @@ recalc_sigpending: | |||
821 | goto reterr; | 826 | goto reterr; |
822 | 827 | ||
823 | err = p9_check_zc_errors(c, req, uidata, in_hdrlen); | 828 | err = p9_check_zc_errors(c, req, uidata, in_hdrlen); |
824 | trace_9p_client_res(c, type, req->rc->tag, err); | 829 | trace_9p_client_res(c, type, req->rc.tag, err); |
825 | if (!err) | 830 | if (!err) |
826 | return req; | 831 | return req; |
827 | reterr: | 832 | reterr: |
@@ -904,10 +909,10 @@ static int p9_client_version(struct p9_client *c) | |||
904 | if (IS_ERR(req)) | 909 | if (IS_ERR(req)) |
905 | return PTR_ERR(req); | 910 | return PTR_ERR(req); |
906 | 911 | ||
907 | err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version); | 912 | err = p9pdu_readf(&req->rc, c->proto_version, "ds", &msize, &version); |
908 | if (err) { | 913 | if (err) { |
909 | p9_debug(P9_DEBUG_9P, "version error %d\n", err); | 914 | p9_debug(P9_DEBUG_9P, "version error %d\n", err); |
910 | trace_9p_protocol_dump(c, req->rc); | 915 | trace_9p_protocol_dump(c, &req->rc); |
911 | goto error; | 916 | goto error; |
912 | } | 917 | } |
913 | 918 | ||
@@ -1056,9 +1061,9 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | |||
1056 | goto error; | 1061 | goto error; |
1057 | } | 1062 | } |
1058 | 1063 | ||
1059 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid); | 1064 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", &qid); |
1060 | if (err) { | 1065 | if (err) { |
1061 | trace_9p_protocol_dump(clnt, req->rc); | 1066 | trace_9p_protocol_dump(clnt, &req->rc); |
1062 | p9_free_req(clnt, req); | 1067 | p9_free_req(clnt, req); |
1063 | goto error; | 1068 | goto error; |
1064 | } | 1069 | } |
@@ -1113,9 +1118,9 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, | |||
1113 | goto error; | 1118 | goto error; |
1114 | } | 1119 | } |
1115 | 1120 | ||
1116 | err = p9pdu_readf(req->rc, clnt->proto_version, "R", &nwqids, &wqids); | 1121 | err = p9pdu_readf(&req->rc, clnt->proto_version, "R", &nwqids, &wqids); |
1117 | if (err) { | 1122 | if (err) { |
1118 | trace_9p_protocol_dump(clnt, req->rc); | 1123 | trace_9p_protocol_dump(clnt, &req->rc); |
1119 | p9_free_req(clnt, req); | 1124 | p9_free_req(clnt, req); |
1120 | goto clunk_fid; | 1125 | goto clunk_fid; |
1121 | } | 1126 | } |
@@ -1180,9 +1185,9 @@ int p9_client_open(struct p9_fid *fid, int mode) | |||
1180 | goto error; | 1185 | goto error; |
1181 | } | 1186 | } |
1182 | 1187 | ||
1183 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); | 1188 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", &qid, &iounit); |
1184 | if (err) { | 1189 | if (err) { |
1185 | trace_9p_protocol_dump(clnt, req->rc); | 1190 | trace_9p_protocol_dump(clnt, &req->rc); |
1186 | goto free_and_error; | 1191 | goto free_and_error; |
1187 | } | 1192 | } |
1188 | 1193 | ||
@@ -1224,9 +1229,9 @@ int p9_client_create_dotl(struct p9_fid *ofid, const char *name, u32 flags, u32 | |||
1224 | goto error; | 1229 | goto error; |
1225 | } | 1230 | } |
1226 | 1231 | ||
1227 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", qid, &iounit); | 1232 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", qid, &iounit); |
1228 | if (err) { | 1233 | if (err) { |
1229 | trace_9p_protocol_dump(clnt, req->rc); | 1234 | trace_9p_protocol_dump(clnt, &req->rc); |
1230 | goto free_and_error; | 1235 | goto free_and_error; |
1231 | } | 1236 | } |
1232 | 1237 | ||
@@ -1269,9 +1274,9 @@ int p9_client_fcreate(struct p9_fid *fid, const char *name, u32 perm, int mode, | |||
1269 | goto error; | 1274 | goto error; |
1270 | } | 1275 | } |
1271 | 1276 | ||
1272 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); | 1277 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", &qid, &iounit); |
1273 | if (err) { | 1278 | if (err) { |
1274 | trace_9p_protocol_dump(clnt, req->rc); | 1279 | trace_9p_protocol_dump(clnt, &req->rc); |
1275 | goto free_and_error; | 1280 | goto free_and_error; |
1276 | } | 1281 | } |
1277 | 1282 | ||
@@ -1308,9 +1313,9 @@ int p9_client_symlink(struct p9_fid *dfid, const char *name, | |||
1308 | goto error; | 1313 | goto error; |
1309 | } | 1314 | } |
1310 | 1315 | ||
1311 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 1316 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid); |
1312 | if (err) { | 1317 | if (err) { |
1313 | trace_9p_protocol_dump(clnt, req->rc); | 1318 | trace_9p_protocol_dump(clnt, &req->rc); |
1314 | goto free_and_error; | 1319 | goto free_and_error; |
1315 | } | 1320 | } |
1316 | 1321 | ||
@@ -1506,10 +1511,10 @@ p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err) | |||
1506 | break; | 1511 | break; |
1507 | } | 1512 | } |
1508 | 1513 | ||
1509 | *err = p9pdu_readf(req->rc, clnt->proto_version, | 1514 | *err = p9pdu_readf(&req->rc, clnt->proto_version, |
1510 | "D", &count, &dataptr); | 1515 | "D", &count, &dataptr); |
1511 | if (*err) { | 1516 | if (*err) { |
1512 | trace_9p_protocol_dump(clnt, req->rc); | 1517 | trace_9p_protocol_dump(clnt, &req->rc); |
1513 | p9_free_req(clnt, req); | 1518 | p9_free_req(clnt, req); |
1514 | break; | 1519 | break; |
1515 | } | 1520 | } |
@@ -1579,9 +1584,9 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err) | |||
1579 | break; | 1584 | break; |
1580 | } | 1585 | } |
1581 | 1586 | ||
1582 | *err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); | 1587 | *err = p9pdu_readf(&req->rc, clnt->proto_version, "d", &count); |
1583 | if (*err) { | 1588 | if (*err) { |
1584 | trace_9p_protocol_dump(clnt, req->rc); | 1589 | trace_9p_protocol_dump(clnt, &req->rc); |
1585 | p9_free_req(clnt, req); | 1590 | p9_free_req(clnt, req); |
1586 | break; | 1591 | break; |
1587 | } | 1592 | } |
@@ -1623,9 +1628,9 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) | |||
1623 | goto error; | 1628 | goto error; |
1624 | } | 1629 | } |
1625 | 1630 | ||
1626 | err = p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); | 1631 | err = p9pdu_readf(&req->rc, clnt->proto_version, "wS", &ignored, ret); |
1627 | if (err) { | 1632 | if (err) { |
1628 | trace_9p_protocol_dump(clnt, req->rc); | 1633 | trace_9p_protocol_dump(clnt, &req->rc); |
1629 | p9_free_req(clnt, req); | 1634 | p9_free_req(clnt, req); |
1630 | goto error; | 1635 | goto error; |
1631 | } | 1636 | } |
@@ -1676,9 +1681,9 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, | |||
1676 | goto error; | 1681 | goto error; |
1677 | } | 1682 | } |
1678 | 1683 | ||
1679 | err = p9pdu_readf(req->rc, clnt->proto_version, "A", ret); | 1684 | err = p9pdu_readf(&req->rc, clnt->proto_version, "A", ret); |
1680 | if (err) { | 1685 | if (err) { |
1681 | trace_9p_protocol_dump(clnt, req->rc); | 1686 | trace_9p_protocol_dump(clnt, &req->rc); |
1682 | p9_free_req(clnt, req); | 1687 | p9_free_req(clnt, req); |
1683 | goto error; | 1688 | goto error; |
1684 | } | 1689 | } |
@@ -1828,11 +1833,11 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb) | |||
1828 | goto error; | 1833 | goto error; |
1829 | } | 1834 | } |
1830 | 1835 | ||
1831 | err = p9pdu_readf(req->rc, clnt->proto_version, "ddqqqqqqd", &sb->type, | 1836 | err = p9pdu_readf(&req->rc, clnt->proto_version, "ddqqqqqqd", &sb->type, |
1832 | &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail, | 1837 | &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail, |
1833 | &sb->files, &sb->ffree, &sb->fsid, &sb->namelen); | 1838 | &sb->files, &sb->ffree, &sb->fsid, &sb->namelen); |
1834 | if (err) { | 1839 | if (err) { |
1835 | trace_9p_protocol_dump(clnt, req->rc); | 1840 | trace_9p_protocol_dump(clnt, &req->rc); |
1836 | p9_free_req(clnt, req); | 1841 | p9_free_req(clnt, req); |
1837 | goto error; | 1842 | goto error; |
1838 | } | 1843 | } |
@@ -1936,9 +1941,9 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid, | |||
1936 | err = PTR_ERR(req); | 1941 | err = PTR_ERR(req); |
1937 | goto error; | 1942 | goto error; |
1938 | } | 1943 | } |
1939 | err = p9pdu_readf(req->rc, clnt->proto_version, "q", attr_size); | 1944 | err = p9pdu_readf(&req->rc, clnt->proto_version, "q", attr_size); |
1940 | if (err) { | 1945 | if (err) { |
1941 | trace_9p_protocol_dump(clnt, req->rc); | 1946 | trace_9p_protocol_dump(clnt, &req->rc); |
1942 | p9_free_req(clnt, req); | 1947 | p9_free_req(clnt, req); |
1943 | goto clunk_fid; | 1948 | goto clunk_fid; |
1944 | } | 1949 | } |
@@ -2024,9 +2029,9 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) | |||
2024 | goto error; | 2029 | goto error; |
2025 | } | 2030 | } |
2026 | 2031 | ||
2027 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); | 2032 | err = p9pdu_readf(&req->rc, clnt->proto_version, "D", &count, &dataptr); |
2028 | if (err) { | 2033 | if (err) { |
2029 | trace_9p_protocol_dump(clnt, req->rc); | 2034 | trace_9p_protocol_dump(clnt, &req->rc); |
2030 | goto free_and_error; | 2035 | goto free_and_error; |
2031 | } | 2036 | } |
2032 | if (rsize < count) { | 2037 | if (rsize < count) { |
@@ -2065,9 +2070,9 @@ int p9_client_mknod_dotl(struct p9_fid *fid, const char *name, int mode, | |||
2065 | if (IS_ERR(req)) | 2070 | if (IS_ERR(req)) |
2066 | return PTR_ERR(req); | 2071 | return PTR_ERR(req); |
2067 | 2072 | ||
2068 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 2073 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid); |
2069 | if (err) { | 2074 | if (err) { |
2070 | trace_9p_protocol_dump(clnt, req->rc); | 2075 | trace_9p_protocol_dump(clnt, &req->rc); |
2071 | goto error; | 2076 | goto error; |
2072 | } | 2077 | } |
2073 | p9_debug(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, | 2078 | p9_debug(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, |
@@ -2096,9 +2101,9 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, const char *name, int mode, | |||
2096 | if (IS_ERR(req)) | 2101 | if (IS_ERR(req)) |
2097 | return PTR_ERR(req); | 2102 | return PTR_ERR(req); |
2098 | 2103 | ||
2099 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 2104 | err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid); |
2100 | if (err) { | 2105 | if (err) { |
2101 | trace_9p_protocol_dump(clnt, req->rc); | 2106 | trace_9p_protocol_dump(clnt, &req->rc); |
2102 | goto error; | 2107 | goto error; |
2103 | } | 2108 | } |
2104 | p9_debug(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, | 2109 | p9_debug(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, |
@@ -2131,9 +2136,9 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status) | |||
2131 | if (IS_ERR(req)) | 2136 | if (IS_ERR(req)) |
2132 | return PTR_ERR(req); | 2137 | return PTR_ERR(req); |
2133 | 2138 | ||
2134 | err = p9pdu_readf(req->rc, clnt->proto_version, "b", status); | 2139 | err = p9pdu_readf(&req->rc, clnt->proto_version, "b", status); |
2135 | if (err) { | 2140 | if (err) { |
2136 | trace_9p_protocol_dump(clnt, req->rc); | 2141 | trace_9p_protocol_dump(clnt, &req->rc); |
2137 | goto error; | 2142 | goto error; |
2138 | } | 2143 | } |
2139 | p9_debug(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); | 2144 | p9_debug(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); |
@@ -2162,11 +2167,11 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock) | |||
2162 | if (IS_ERR(req)) | 2167 | if (IS_ERR(req)) |
2163 | return PTR_ERR(req); | 2168 | return PTR_ERR(req); |
2164 | 2169 | ||
2165 | err = p9pdu_readf(req->rc, clnt->proto_version, "bqqds", &glock->type, | 2170 | err = p9pdu_readf(&req->rc, clnt->proto_version, "bqqds", &glock->type, |
2166 | &glock->start, &glock->length, &glock->proc_id, | 2171 | &glock->start, &glock->length, &glock->proc_id, |
2167 | &glock->client_id); | 2172 | &glock->client_id); |
2168 | if (err) { | 2173 | if (err) { |
2169 | trace_9p_protocol_dump(clnt, req->rc); | 2174 | trace_9p_protocol_dump(clnt, &req->rc); |
2170 | goto error; | 2175 | goto error; |
2171 | } | 2176 | } |
2172 | p9_debug(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " | 2177 | p9_debug(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " |
@@ -2192,9 +2197,9 @@ int p9_client_readlink(struct p9_fid *fid, char **target) | |||
2192 | if (IS_ERR(req)) | 2197 | if (IS_ERR(req)) |
2193 | return PTR_ERR(req); | 2198 | return PTR_ERR(req); |
2194 | 2199 | ||
2195 | err = p9pdu_readf(req->rc, clnt->proto_version, "s", target); | 2200 | err = p9pdu_readf(&req->rc, clnt->proto_version, "s", target); |
2196 | if (err) { | 2201 | if (err) { |
2197 | trace_9p_protocol_dump(clnt, req->rc); | 2202 | trace_9p_protocol_dump(clnt, &req->rc); |
2198 | goto error; | 2203 | goto error; |
2199 | } | 2204 | } |
2200 | p9_debug(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); | 2205 | p9_debug(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); |
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index e2ef3c782c53..51615c0fb744 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -354,7 +354,7 @@ static void p9_read_work(struct work_struct *work) | |||
354 | goto error; | 354 | goto error; |
355 | } | 355 | } |
356 | 356 | ||
357 | if (m->req->rc == NULL) { | 357 | if (!m->req->rc.sdata) { |
358 | p9_debug(P9_DEBUG_ERROR, | 358 | p9_debug(P9_DEBUG_ERROR, |
359 | "No recv fcall for tag %d (req %p), disconnecting!\n", | 359 | "No recv fcall for tag %d (req %p), disconnecting!\n", |
360 | m->rc.tag, m->req); | 360 | m->rc.tag, m->req); |
@@ -362,7 +362,7 @@ static void p9_read_work(struct work_struct *work) | |||
362 | err = -EIO; | 362 | err = -EIO; |
363 | goto error; | 363 | goto error; |
364 | } | 364 | } |
365 | m->rc.sdata = (char *)m->req->rc + sizeof(struct p9_fcall); | 365 | m->rc.sdata = m->req->rc.sdata; |
366 | memcpy(m->rc.sdata, m->tmp_buf, m->rc.capacity); | 366 | memcpy(m->rc.sdata, m->tmp_buf, m->rc.capacity); |
367 | m->rc.capacity = m->rc.size; | 367 | m->rc.capacity = m->rc.size; |
368 | } | 368 | } |
@@ -372,7 +372,7 @@ static void p9_read_work(struct work_struct *work) | |||
372 | */ | 372 | */ |
373 | if ((m->req) && (m->rc.offset == m->rc.capacity)) { | 373 | if ((m->req) && (m->rc.offset == m->rc.capacity)) { |
374 | p9_debug(P9_DEBUG_TRANS, "got new packet\n"); | 374 | p9_debug(P9_DEBUG_TRANS, "got new packet\n"); |
375 | m->req->rc->size = m->rc.offset; | 375 | m->req->rc.size = m->rc.offset; |
376 | spin_lock(&m->client->lock); | 376 | spin_lock(&m->client->lock); |
377 | if (m->req->status != REQ_STATUS_ERROR) | 377 | if (m->req->status != REQ_STATUS_ERROR) |
378 | status = REQ_STATUS_RCVD; | 378 | status = REQ_STATUS_RCVD; |
@@ -469,8 +469,8 @@ static void p9_write_work(struct work_struct *work) | |||
469 | p9_debug(P9_DEBUG_TRANS, "move req %p\n", req); | 469 | p9_debug(P9_DEBUG_TRANS, "move req %p\n", req); |
470 | list_move_tail(&req->req_list, &m->req_list); | 470 | list_move_tail(&req->req_list, &m->req_list); |
471 | 471 | ||
472 | m->wbuf = req->tc->sdata; | 472 | m->wbuf = req->tc.sdata; |
473 | m->wsize = req->tc->size; | 473 | m->wsize = req->tc.size; |
474 | m->wpos = 0; | 474 | m->wpos = 0; |
475 | spin_unlock(&m->client->lock); | 475 | spin_unlock(&m->client->lock); |
476 | } | 476 | } |
@@ -663,7 +663,7 @@ static int p9_fd_request(struct p9_client *client, struct p9_req_t *req) | |||
663 | struct p9_conn *m = &ts->conn; | 663 | struct p9_conn *m = &ts->conn; |
664 | 664 | ||
665 | p9_debug(P9_DEBUG_TRANS, "mux %p task %p tcall %p id %d\n", | 665 | p9_debug(P9_DEBUG_TRANS, "mux %p task %p tcall %p id %d\n", |
666 | m, current, req->tc, req->tc->id); | 666 | m, current, &req->tc, req->tc.id); |
667 | if (m->err < 0) | 667 | if (m->err < 0) |
668 | return m->err; | 668 | return m->err; |
669 | 669 | ||
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index b513cffeeb3c..5b0cda1aaa7a 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c | |||
@@ -122,7 +122,7 @@ struct p9_rdma_context { | |||
122 | dma_addr_t busa; | 122 | dma_addr_t busa; |
123 | union { | 123 | union { |
124 | struct p9_req_t *req; | 124 | struct p9_req_t *req; |
125 | struct p9_fcall *rc; | 125 | struct p9_fcall rc; |
126 | }; | 126 | }; |
127 | }; | 127 | }; |
128 | 128 | ||
@@ -320,8 +320,8 @@ recv_done(struct ib_cq *cq, struct ib_wc *wc) | |||
320 | if (wc->status != IB_WC_SUCCESS) | 320 | if (wc->status != IB_WC_SUCCESS) |
321 | goto err_out; | 321 | goto err_out; |
322 | 322 | ||
323 | c->rc->size = wc->byte_len; | 323 | c->rc.size = wc->byte_len; |
324 | err = p9_parse_header(c->rc, NULL, NULL, &tag, 1); | 324 | err = p9_parse_header(&c->rc, NULL, NULL, &tag, 1); |
325 | if (err) | 325 | if (err) |
326 | goto err_out; | 326 | goto err_out; |
327 | 327 | ||
@@ -331,12 +331,13 @@ recv_done(struct ib_cq *cq, struct ib_wc *wc) | |||
331 | 331 | ||
332 | /* Check that we have not yet received a reply for this request. | 332 | /* Check that we have not yet received a reply for this request. |
333 | */ | 333 | */ |
334 | if (unlikely(req->rc)) { | 334 | if (unlikely(req->rc.sdata)) { |
335 | pr_err("Duplicate reply for request %d", tag); | 335 | pr_err("Duplicate reply for request %d", tag); |
336 | goto err_out; | 336 | goto err_out; |
337 | } | 337 | } |
338 | 338 | ||
339 | req->rc = c->rc; | 339 | req->rc.size = c->rc.size; |
340 | req->rc.sdata = c->rc.sdata; | ||
340 | p9_client_cb(client, req, REQ_STATUS_RCVD); | 341 | p9_client_cb(client, req, REQ_STATUS_RCVD); |
341 | 342 | ||
342 | out: | 343 | out: |
@@ -361,7 +362,7 @@ send_done(struct ib_cq *cq, struct ib_wc *wc) | |||
361 | container_of(wc->wr_cqe, struct p9_rdma_context, cqe); | 362 | container_of(wc->wr_cqe, struct p9_rdma_context, cqe); |
362 | 363 | ||
363 | ib_dma_unmap_single(rdma->cm_id->device, | 364 | ib_dma_unmap_single(rdma->cm_id->device, |
364 | c->busa, c->req->tc->size, | 365 | c->busa, c->req->tc.size, |
365 | DMA_TO_DEVICE); | 366 | DMA_TO_DEVICE); |
366 | up(&rdma->sq_sem); | 367 | up(&rdma->sq_sem); |
367 | kfree(c); | 368 | kfree(c); |
@@ -401,7 +402,7 @@ post_recv(struct p9_client *client, struct p9_rdma_context *c) | |||
401 | struct ib_sge sge; | 402 | struct ib_sge sge; |
402 | 403 | ||
403 | c->busa = ib_dma_map_single(rdma->cm_id->device, | 404 | c->busa = ib_dma_map_single(rdma->cm_id->device, |
404 | c->rc->sdata, client->msize, | 405 | c->rc.sdata, client->msize, |
405 | DMA_FROM_DEVICE); | 406 | DMA_FROM_DEVICE); |
406 | if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) | 407 | if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) |
407 | goto error; | 408 | goto error; |
@@ -443,9 +444,9 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) | |||
443 | **/ | 444 | **/ |
444 | if (unlikely(atomic_read(&rdma->excess_rc) > 0)) { | 445 | if (unlikely(atomic_read(&rdma->excess_rc) > 0)) { |
445 | if ((atomic_sub_return(1, &rdma->excess_rc) >= 0)) { | 446 | if ((atomic_sub_return(1, &rdma->excess_rc) >= 0)) { |
446 | /* Got one ! */ | 447 | /* Got one! */ |
447 | kfree(req->rc); | 448 | p9_fcall_fini(&req->rc); |
448 | req->rc = NULL; | 449 | req->rc.sdata = NULL; |
449 | goto dont_need_post_recv; | 450 | goto dont_need_post_recv; |
450 | } else { | 451 | } else { |
451 | /* We raced and lost. */ | 452 | /* We raced and lost. */ |
@@ -459,7 +460,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) | |||
459 | err = -ENOMEM; | 460 | err = -ENOMEM; |
460 | goto recv_error; | 461 | goto recv_error; |
461 | } | 462 | } |
462 | rpl_context->rc = req->rc; | 463 | rpl_context->rc.sdata = req->rc.sdata; |
463 | 464 | ||
464 | /* | 465 | /* |
465 | * Post a receive buffer for this request. We need to ensure | 466 | * Post a receive buffer for this request. We need to ensure |
@@ -479,7 +480,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) | |||
479 | goto recv_error; | 480 | goto recv_error; |
480 | } | 481 | } |
481 | /* remove posted receive buffer from request structure */ | 482 | /* remove posted receive buffer from request structure */ |
482 | req->rc = NULL; | 483 | req->rc.sdata = NULL; |
483 | 484 | ||
484 | dont_need_post_recv: | 485 | dont_need_post_recv: |
485 | /* Post the request */ | 486 | /* Post the request */ |
@@ -491,7 +492,7 @@ dont_need_post_recv: | |||
491 | c->req = req; | 492 | c->req = req; |
492 | 493 | ||
493 | c->busa = ib_dma_map_single(rdma->cm_id->device, | 494 | c->busa = ib_dma_map_single(rdma->cm_id->device, |
494 | c->req->tc->sdata, c->req->tc->size, | 495 | c->req->tc.sdata, c->req->tc.size, |
495 | DMA_TO_DEVICE); | 496 | DMA_TO_DEVICE); |
496 | if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) { | 497 | if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) { |
497 | err = -EIO; | 498 | err = -EIO; |
@@ -501,7 +502,7 @@ dont_need_post_recv: | |||
501 | c->cqe.done = send_done; | 502 | c->cqe.done = send_done; |
502 | 503 | ||
503 | sge.addr = c->busa; | 504 | sge.addr = c->busa; |
504 | sge.length = c->req->tc->size; | 505 | sge.length = c->req->tc.size; |
505 | sge.lkey = rdma->pd->local_dma_lkey; | 506 | sge.lkey = rdma->pd->local_dma_lkey; |
506 | 507 | ||
507 | wr.next = NULL; | 508 | wr.next = NULL; |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 7728b0acde09..3dd6ce1c0f2d 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -155,7 +155,7 @@ static void req_done(struct virtqueue *vq) | |||
155 | } | 155 | } |
156 | 156 | ||
157 | if (len) { | 157 | if (len) { |
158 | req->rc->size = len; | 158 | req->rc.size = len; |
159 | p9_client_cb(chan->client, req, REQ_STATUS_RCVD); | 159 | p9_client_cb(chan->client, req, REQ_STATUS_RCVD); |
160 | } | 160 | } |
161 | } | 161 | } |
@@ -273,12 +273,12 @@ req_retry: | |||
273 | out_sgs = in_sgs = 0; | 273 | out_sgs = in_sgs = 0; |
274 | /* Handle out VirtIO ring buffers */ | 274 | /* Handle out VirtIO ring buffers */ |
275 | out = pack_sg_list(chan->sg, 0, | 275 | out = pack_sg_list(chan->sg, 0, |
276 | VIRTQUEUE_NUM, req->tc->sdata, req->tc->size); | 276 | VIRTQUEUE_NUM, req->tc.sdata, req->tc.size); |
277 | if (out) | 277 | if (out) |
278 | sgs[out_sgs++] = chan->sg; | 278 | sgs[out_sgs++] = chan->sg; |
279 | 279 | ||
280 | in = pack_sg_list(chan->sg, out, | 280 | in = pack_sg_list(chan->sg, out, |
281 | VIRTQUEUE_NUM, req->rc->sdata, req->rc->capacity); | 281 | VIRTQUEUE_NUM, req->rc.sdata, req->rc.capacity); |
282 | if (in) | 282 | if (in) |
283 | sgs[out_sgs + in_sgs++] = chan->sg + out; | 283 | sgs[out_sgs + in_sgs++] = chan->sg + out; |
284 | 284 | ||
@@ -416,15 +416,15 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, | |||
416 | out_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); | 416 | out_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); |
417 | if (n != outlen) { | 417 | if (n != outlen) { |
418 | __le32 v = cpu_to_le32(n); | 418 | __le32 v = cpu_to_le32(n); |
419 | memcpy(&req->tc->sdata[req->tc->size - 4], &v, 4); | 419 | memcpy(&req->tc.sdata[req->tc.size - 4], &v, 4); |
420 | outlen = n; | 420 | outlen = n; |
421 | } | 421 | } |
422 | /* The size field of the message must include the length of the | 422 | /* The size field of the message must include the length of the |
423 | * header and the length of the data. We didn't actually know | 423 | * header and the length of the data. We didn't actually know |
424 | * the length of the data until this point so add it in now. | 424 | * the length of the data until this point so add it in now. |
425 | */ | 425 | */ |
426 | sz = cpu_to_le32(req->tc->size + outlen); | 426 | sz = cpu_to_le32(req->tc.size + outlen); |
427 | memcpy(&req->tc->sdata[0], &sz, sizeof(sz)); | 427 | memcpy(&req->tc.sdata[0], &sz, sizeof(sz)); |
428 | } else if (uidata) { | 428 | } else if (uidata) { |
429 | int n = p9_get_mapped_pages(chan, &in_pages, uidata, | 429 | int n = p9_get_mapped_pages(chan, &in_pages, uidata, |
430 | inlen, &offs, &need_drop); | 430 | inlen, &offs, &need_drop); |
@@ -433,7 +433,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, | |||
433 | in_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); | 433 | in_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); |
434 | if (n != inlen) { | 434 | if (n != inlen) { |
435 | __le32 v = cpu_to_le32(n); | 435 | __le32 v = cpu_to_le32(n); |
436 | memcpy(&req->tc->sdata[req->tc->size - 4], &v, 4); | 436 | memcpy(&req->tc.sdata[req->tc.size - 4], &v, 4); |
437 | inlen = n; | 437 | inlen = n; |
438 | } | 438 | } |
439 | } | 439 | } |
@@ -445,7 +445,7 @@ req_retry_pinned: | |||
445 | 445 | ||
446 | /* out data */ | 446 | /* out data */ |
447 | out = pack_sg_list(chan->sg, 0, | 447 | out = pack_sg_list(chan->sg, 0, |
448 | VIRTQUEUE_NUM, req->tc->sdata, req->tc->size); | 448 | VIRTQUEUE_NUM, req->tc.sdata, req->tc.size); |
449 | 449 | ||
450 | if (out) | 450 | if (out) |
451 | sgs[out_sgs++] = chan->sg; | 451 | sgs[out_sgs++] = chan->sg; |
@@ -464,7 +464,7 @@ req_retry_pinned: | |||
464 | * alloced memory and payload onto the user buffer. | 464 | * alloced memory and payload onto the user buffer. |
465 | */ | 465 | */ |
466 | in = pack_sg_list(chan->sg, out, | 466 | in = pack_sg_list(chan->sg, out, |
467 | VIRTQUEUE_NUM, req->rc->sdata, in_hdr_len); | 467 | VIRTQUEUE_NUM, req->rc.sdata, in_hdr_len); |
468 | if (in) | 468 | if (in) |
469 | sgs[out_sgs + in_sgs++] = chan->sg + out; | 469 | sgs[out_sgs + in_sgs++] = chan->sg + out; |
470 | 470 | ||
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 843cb823d9b9..782a07f2ad0c 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c | |||
@@ -141,7 +141,7 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) | |||
141 | struct xen_9pfs_front_priv *priv = NULL; | 141 | struct xen_9pfs_front_priv *priv = NULL; |
142 | RING_IDX cons, prod, masked_cons, masked_prod; | 142 | RING_IDX cons, prod, masked_cons, masked_prod; |
143 | unsigned long flags; | 143 | unsigned long flags; |
144 | u32 size = p9_req->tc->size; | 144 | u32 size = p9_req->tc.size; |
145 | struct xen_9pfs_dataring *ring; | 145 | struct xen_9pfs_dataring *ring; |
146 | int num; | 146 | int num; |
147 | 147 | ||
@@ -154,7 +154,7 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) | |||
154 | if (!priv || priv->client != client) | 154 | if (!priv || priv->client != client) |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | 156 | ||
157 | num = p9_req->tc->tag % priv->num_rings; | 157 | num = p9_req->tc.tag % priv->num_rings; |
158 | ring = &priv->rings[num]; | 158 | ring = &priv->rings[num]; |
159 | 159 | ||
160 | again: | 160 | again: |
@@ -176,7 +176,7 @@ again: | |||
176 | masked_prod = xen_9pfs_mask(prod, XEN_9PFS_RING_SIZE); | 176 | masked_prod = xen_9pfs_mask(prod, XEN_9PFS_RING_SIZE); |
177 | masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); | 177 | masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); |
178 | 178 | ||
179 | xen_9pfs_write_packet(ring->data.out, p9_req->tc->sdata, size, | 179 | xen_9pfs_write_packet(ring->data.out, p9_req->tc.sdata, size, |
180 | &masked_prod, masked_cons, XEN_9PFS_RING_SIZE); | 180 | &masked_prod, masked_cons, XEN_9PFS_RING_SIZE); |
181 | 181 | ||
182 | p9_req->status = REQ_STATUS_SENT; | 182 | p9_req->status = REQ_STATUS_SENT; |
@@ -229,12 +229,12 @@ static void p9_xen_response(struct work_struct *work) | |||
229 | continue; | 229 | continue; |
230 | } | 230 | } |
231 | 231 | ||
232 | memcpy(req->rc, &h, sizeof(h)); | 232 | memcpy(&req->rc, &h, sizeof(h)); |
233 | req->rc->offset = 0; | 233 | req->rc.offset = 0; |
234 | 234 | ||
235 | masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); | 235 | masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); |
236 | /* Then, read the whole packet (including the header) */ | 236 | /* Then, read the whole packet (including the header) */ |
237 | xen_9pfs_read_packet(req->rc->sdata, ring->data.in, h.size, | 237 | xen_9pfs_read_packet(req->rc.sdata, ring->data.in, h.size, |
238 | masked_prod, &masked_cons, | 238 | masked_prod, &masked_cons, |
239 | XEN_9PFS_RING_SIZE); | 239 | XEN_9PFS_RING_SIZE); |
240 | 240 | ||