@@ -192,6 +192,8 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp,
192
192
xdr_sge_no ++ ;
193
193
BUG_ON (xdr_sge_no > vec -> count );
194
194
bc -= sge_bytes ;
195
+ if (sge_no == xprt -> sc_max_sge )
196
+ break ;
195
197
}
196
198
197
199
/* Prepare WRITE WR */
@@ -209,7 +211,7 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp,
209
211
atomic_inc (& rdma_stat_write );
210
212
if (svc_rdma_send (xprt , & write_wr ))
211
213
goto err ;
212
- return 0 ;
214
+ return write_len - bc ;
213
215
err :
214
216
svc_rdma_unmap_dma (ctxt );
215
217
svc_rdma_put_context (ctxt , 0 );
@@ -225,7 +227,6 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
225
227
{
226
228
u32 xfer_len = rqstp -> rq_res .page_len + rqstp -> rq_res .tail [0 ].iov_len ;
227
229
int write_len ;
228
- int max_write ;
229
230
u32 xdr_off ;
230
231
int chunk_off ;
231
232
int chunk_no ;
@@ -239,8 +240,6 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
239
240
res_ary = (struct rpcrdma_write_array * )
240
241
& rdma_resp -> rm_body .rm_chunks [1 ];
241
242
242
- max_write = xprt -> sc_max_sge * PAGE_SIZE ;
243
-
244
243
/* Write chunks start at the pagelist */
245
244
for (xdr_off = rqstp -> rq_res .head [0 ].iov_len , chunk_no = 0 ;
246
245
xfer_len && chunk_no < arg_ary -> wc_nchunks ;
@@ -260,23 +259,21 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
260
259
write_len );
261
260
chunk_off = 0 ;
262
261
while (write_len ) {
263
- int this_write ;
264
- this_write = min (write_len , max_write );
265
262
ret = send_write (xprt , rqstp ,
266
263
ntohl (arg_ch -> rs_handle ),
267
264
rs_offset + chunk_off ,
268
265
xdr_off ,
269
- this_write ,
266
+ write_len ,
270
267
vec );
271
- if (ret ) {
268
+ if (ret <= 0 ) {
272
269
dprintk ("svcrdma: RDMA_WRITE failed, ret=%d\n" ,
273
270
ret );
274
271
return - EIO ;
275
272
}
276
- chunk_off += this_write ;
277
- xdr_off += this_write ;
278
- xfer_len -= this_write ;
279
- write_len -= this_write ;
273
+ chunk_off += ret ;
274
+ xdr_off += ret ;
275
+ xfer_len -= ret ;
276
+ write_len -= ret ;
280
277
}
281
278
}
282
279
/* Update the req with the number of chunks actually used */
@@ -293,7 +290,6 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
293
290
{
294
291
u32 xfer_len = rqstp -> rq_res .len ;
295
292
int write_len ;
296
- int max_write ;
297
293
u32 xdr_off ;
298
294
int chunk_no ;
299
295
int chunk_off ;
@@ -311,8 +307,6 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
311
307
res_ary = (struct rpcrdma_write_array * )
312
308
& rdma_resp -> rm_body .rm_chunks [2 ];
313
309
314
- max_write = xprt -> sc_max_sge * PAGE_SIZE ;
315
-
316
310
/* xdr offset starts at RPC message */
317
311
nchunks = ntohl (arg_ary -> wc_nchunks );
318
312
for (xdr_off = 0 , chunk_no = 0 ;
@@ -330,24 +324,21 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
330
324
write_len );
331
325
chunk_off = 0 ;
332
326
while (write_len ) {
333
- int this_write ;
334
-
335
- this_write = min (write_len , max_write );
336
327
ret = send_write (xprt , rqstp ,
337
328
ntohl (ch -> rs_handle ),
338
329
rs_offset + chunk_off ,
339
330
xdr_off ,
340
- this_write ,
331
+ write_len ,
341
332
vec );
342
- if (ret ) {
333
+ if (ret <= 0 ) {
343
334
dprintk ("svcrdma: RDMA_WRITE failed, ret=%d\n" ,
344
335
ret );
345
336
return - EIO ;
346
337
}
347
- chunk_off += this_write ;
348
- xdr_off += this_write ;
349
- xfer_len -= this_write ;
350
- write_len -= this_write ;
338
+ chunk_off += ret ;
339
+ xdr_off += ret ;
340
+ xfer_len -= ret ;
341
+ write_len -= ret ;
351
342
}
352
343
}
353
344
/* Update the req with the number of chunks actually used */
0 commit comments