<div dir="ltr">Hello<div><br></div><div>I have a question in DRBD9.</div><div><br clear="all"><div>In sender thread, if there are some unprocessed requests, then process through SEND_CANCELED mod. In a code</div><div><br></div><div><div>int drbd_sender(struct drbd_thread *thi)</div><div>{</div></div><div>...</div><div><div>/* cleanup all currently unprocessed requests */</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>if (!connection-&gt;todo.req) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>spin_lock_irq(&amp;connection-&gt;resource-&gt;req_lock);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>tl_next_request_for_connection(connection);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>spin_unlock_irq(&amp;connection-&gt;resource-&gt;req_lock);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>while (connection-&gt;todo.req) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>struct bio_and_error m;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>struct drbd_request *req = connection-&gt;todo.req;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>struct drbd_device *device = req-&gt;device;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>peer_device = conn_peer_device(connection, device-&gt;vnr);</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>spin_lock_irq(&amp;connection-&gt;resource-&gt;req_lock);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>tl_next_request_for_connection(connection);<br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>__req_mod(req, SEND_CANCELED, peer_device, &amp;m);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>spin_unlock_irq(&amp;connection-&gt;resource-&gt;req_lock);<br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>if (m.bio)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                        </span>complete_master_bio(device, &amp;m);<br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>}<br></div></div><div>...</div><div>}</div><div><br></div><div>I think two functions might be exchanged like below</div><div>__req_mod(req, SEND_CANCELED, peer_device, &amp;m);<br></div><div>tl_next_request_for_connection(connection);<br></div><div><br></div><div>Because some case(peer&#39;s rq_state with RQ_NET_QUEUE) </div><div> __req_mod(SEND_CANCELED) would call the advance_conn_req_next() function and then connection-&gt;todo.req_next could be changed to next request.</div><div><br></div><div>__req_mod() ---&gt; changed next request</div><div>tl_next_request_for_connection --&gt; adjust the current request<br></div><div><br></div><div><br></div><div>But in original case,</div><div>tl_next_request_for_connection  -&gt; current req is same next request<br></div><div>__req_mod() -&gt;  changed next request but can&#39;t adjust current request<br></div><div><br></div><div><br></div><div><br></div><div>Thanks</div><div>--</div></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=aa21wYWtAbWFudGVjaC5jby5rcg%3D%3D&amp;type=zerocontent&amp;guid=0da268b7-abca-4cec-930e-38b14d08ce5b"><font color="#ffffff" size="1">ᐧ</font></div>