* [PATCH] nbd: remove the duplicated code
@ 2019-09-10 6:36 xiubli
2019-09-10 15:56 ` Mike Christie
0 siblings, 1 reply; 3+ messages in thread
From: xiubli @ 2019-09-10 6:36 UTC (permalink / raw)
To: josef, axboe; +Cc: mchristi, linux-block, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
The followed code will do the same check, and this part is redandant.
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
drivers/block/nbd.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 478aa86fc1f2..8c10ab51a086 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1046,9 +1046,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
for (i = 0; i < config->num_connections; i++) {
struct nbd_sock *nsock = config->socks[i];
- if (!nsock->dead)
- continue;
-
mutex_lock(&nsock->tx_lock);
if (!nsock->dead) {
mutex_unlock(&nsock->tx_lock);
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nbd: remove the duplicated code
2019-09-10 6:36 [PATCH] nbd: remove the duplicated code xiubli
@ 2019-09-10 15:56 ` Mike Christie
2019-09-10 23:58 ` Xiubo Li
0 siblings, 1 reply; 3+ messages in thread
From: Mike Christie @ 2019-09-10 15:56 UTC (permalink / raw)
To: xiubli, josef, axboe; +Cc: linux-block
On 09/10/2019 01:36 AM, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
>
> The followed code will do the same check, and this part is redandant.
>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> drivers/block/nbd.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 478aa86fc1f2..8c10ab51a086 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1046,9 +1046,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
> for (i = 0; i < config->num_connections; i++) {
> struct nbd_sock *nsock = config->socks[i];
>
> - if (!nsock->dead)
> - continue;
> -
Was this check to used to speed up reconnects? For example, if a send
was stuck waiting on socket memory to free up in the network layer, then
the above check would allow us to skip past those sockets without having
to wait on the socket that was trying to send.
> mutex_lock(&nsock->tx_lock);
> if (!nsock->dead) {
> mutex_unlock(&nsock->tx_lock);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nbd: remove the duplicated code
2019-09-10 15:56 ` Mike Christie
@ 2019-09-10 23:58 ` Xiubo Li
0 siblings, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2019-09-10 23:58 UTC (permalink / raw)
To: Mike Christie, josef, axboe; +Cc: linux-block
On 2019/9/10 23:56, Mike Christie wrote:
> On 09/10/2019 01:36 AM, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> The followed code will do the same check, and this part is redandant.
>>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>> drivers/block/nbd.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>> index 478aa86fc1f2..8c10ab51a086 100644
>> --- a/drivers/block/nbd.c
>> +++ b/drivers/block/nbd.c
>> @@ -1046,9 +1046,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
>> for (i = 0; i < config->num_connections; i++) {
>> struct nbd_sock *nsock = config->socks[i];
>>
>> - if (!nsock->dead)
>> - continue;
>> -
> Was this check to used to speed up reconnects? For example, if a send
> was stuck waiting on socket memory to free up in the network layer, then
> the above check would allow us to skip past those sockets without having
> to wait on the socket that was trying to send.
>
Yeah, in this case it really could help a little bit. Or maybe in the
network layer when allocating new memories but it needs to do the memory
reclaim, which will be stuck for a long time ?
Thanks
BRs
Xiubo
>
>> mutex_lock(&nsock->tx_lock);
>> if (!nsock->dead) {
>> mutex_unlock(&nsock->tx_lock);
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-10 23:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 6:36 [PATCH] nbd: remove the duplicated code xiubli
2019-09-10 15:56 ` Mike Christie
2019-09-10 23:58 ` Xiubo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).