@@ -169,10 +169,9 @@ static void prepare_message_data(struct ceph_msg *msg, u32 data_len)
169169 * Prepare footer for currently outgoing message, and finish things
170170 * off. Assumes out_kvec* are already valid.. we just add on to the end.
171171 */
172- static void prepare_write_message_footer (struct ceph_connection * con )
172+ static void prepare_write_message_footer (struct ceph_connection * con ,
173+ struct ceph_msg * m )
173174{
174- struct ceph_msg * m = con -> out_msg ;
175-
176175 m -> footer .flags |= CEPH_MSG_FOOTER_COMPLETE ;
177176
178177 dout ("prepare_write_message_footer %p\n" , con );
@@ -230,31 +229,31 @@ static void prepare_write_message(struct ceph_connection *con)
230229
231230 /* fill in hdr crc and finalize hdr */
232231 crc = crc32c (0 , & m -> hdr , offsetof(struct ceph_msg_header , crc ));
233- con -> out_msg -> hdr .crc = cpu_to_le32 (crc );
234- memcpy (& con -> v1 .out_hdr , & con -> out_msg -> hdr , sizeof (con -> v1 .out_hdr ));
232+ m -> hdr .crc = cpu_to_le32 (crc );
233+ memcpy (& con -> v1 .out_hdr , & m -> hdr , sizeof (con -> v1 .out_hdr ));
235234
236235 /* fill in front and middle crc, footer */
237236 crc = crc32c (0 , m -> front .iov_base , m -> front .iov_len );
238- con -> out_msg -> footer .front_crc = cpu_to_le32 (crc );
237+ m -> footer .front_crc = cpu_to_le32 (crc );
239238 if (m -> middle ) {
240239 crc = crc32c (0 , m -> middle -> vec .iov_base ,
241240 m -> middle -> vec .iov_len );
242- con -> out_msg -> footer .middle_crc = cpu_to_le32 (crc );
241+ m -> footer .middle_crc = cpu_to_le32 (crc );
243242 } else
244- con -> out_msg -> footer .middle_crc = 0 ;
243+ m -> footer .middle_crc = 0 ;
245244 dout ("%s front_crc %u middle_crc %u\n" , __func__ ,
246- le32_to_cpu (con -> out_msg -> footer .front_crc ),
247- le32_to_cpu (con -> out_msg -> footer .middle_crc ));
248- con -> out_msg -> footer .flags = 0 ;
245+ le32_to_cpu (m -> footer .front_crc ),
246+ le32_to_cpu (m -> footer .middle_crc ));
247+ m -> footer .flags = 0 ;
249248
250249 /* is there a data payload? */
251- con -> out_msg -> footer .data_crc = 0 ;
250+ m -> footer .data_crc = 0 ;
252251 if (m -> data_length ) {
253- prepare_message_data (con -> out_msg , m -> data_length );
252+ prepare_message_data (m , m -> data_length );
254253 con -> v1 .out_more = 1 ; /* data + footer will follow */
255254 } else {
256255 /* no, queue up footer too and be done */
257- prepare_write_message_footer (con );
256+ prepare_write_message_footer (con , m );
258257 }
259258
260259 ceph_con_flag_set (con , CEPH_CON_F_WRITE_PENDING );
@@ -461,9 +460,9 @@ static int write_partial_kvec(struct ceph_connection *con)
461460 * 0 -> socket full, but more to do
462461 * <0 -> error
463462 */
464- static int write_partial_message_data (struct ceph_connection * con )
463+ static int write_partial_message_data (struct ceph_connection * con ,
464+ struct ceph_msg * msg )
465465{
466- struct ceph_msg * msg = con -> out_msg ;
467466 struct ceph_msg_data_cursor * cursor = & msg -> cursor ;
468467 bool do_datacrc = !ceph_test_opt (from_msgr (con -> msgr ), NOCRC );
469468 u32 crc ;
@@ -515,7 +514,7 @@ static int write_partial_message_data(struct ceph_connection *con)
515514 else
516515 msg -> footer .flags |= CEPH_MSG_FOOTER_NOCRC ;
517516 con_out_kvec_reset (con );
518- prepare_write_message_footer (con );
517+ prepare_write_message_footer (con , msg );
519518
520519 return 1 ; /* must return > 0 to indicate success */
521520}
@@ -1471,6 +1470,7 @@ int ceph_con_v1_try_read(struct ceph_connection *con)
14711470 */
14721471int ceph_con_v1_try_write (struct ceph_connection * con )
14731472{
1473+ struct ceph_msg * msg ;
14741474 int ret = 1 ;
14751475
14761476 dout ("try_write start %p state %d\n" , con , con -> state );
@@ -1517,14 +1517,15 @@ int ceph_con_v1_try_write(struct ceph_connection *con)
15171517 }
15181518
15191519 /* msg pages? */
1520- if (con -> out_msg ) {
1520+ msg = con -> out_msg ;
1521+ if (msg ) {
15211522 if (con -> v1 .out_msg_done ) {
1522- ceph_msg_put (con -> out_msg );
1523+ ceph_msg_put (msg );
15231524 con -> out_msg = NULL ; /* we're done with this one */
15241525 goto do_next ;
15251526 }
15261527
1527- ret = write_partial_message_data (con );
1528+ ret = write_partial_message_data (con , msg );
15281529 if (ret == 1 )
15291530 goto more ; /* we need to send the footer, too! */
15301531 if (ret == 0 )
@@ -1563,10 +1564,8 @@ int ceph_con_v1_try_write(struct ceph_connection *con)
15631564 return ret ;
15641565}
15651566
1566- void ceph_con_v1_revoke (struct ceph_connection * con )
1567+ void ceph_con_v1_revoke (struct ceph_connection * con , struct ceph_msg * msg )
15671568{
1568- struct ceph_msg * msg = con -> out_msg ;
1569-
15701569 WARN_ON (con -> v1 .out_skip );
15711570 /* footer */
15721571 if (con -> v1 .out_msg_done ) {
0 commit comments