[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190906105210.GP5900@stefanha-x1.localdomain>
Date:   Fri, 6 Sep 2019 11:52:10 +0100
From:   Stefan Hajnoczi <stefanha@...hat.com>
To:     Vivek Goyal <vgoyal@...hat.com>
Cc:     linux-fsdevel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org, miklos@...redi.hu,
        linux-kernel@...r.kernel.org, virtio-fs@...hat.com,
        dgilbert@...hat.com, mst@...hat.com
Subject: Re: [PATCH 08/18] virtiofs: Drain all pending requests during
 ->remove time
On Thu, Sep 05, 2019 at 03:48:49PM -0400, Vivek Goyal wrote:
> +static void virtio_fs_drain_queue(struct virtio_fs_vq *fsvq)
> +{
> +	WARN_ON(fsvq->in_flight < 0);
> +
> +	/* Wait for in flight requests to finish.*/
> +	while (1) {
> +		spin_lock(&fsvq->lock);
> +		if (!fsvq->in_flight) {
> +			spin_unlock(&fsvq->lock);
> +			break;
> +		}
> +		spin_unlock(&fsvq->lock);
> +		usleep_range(1000, 2000);
> +	}
I think all contexts that call this allow sleeping so we could avoid
usleep here.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists
 
