From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv8Aa-0000zp-0i for qemu-devel@nongnu.org; Fri, 14 Oct 2016 15:29:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv8AX-0000N8-9Z for qemu-devel@nongnu.org; Fri, 14 Oct 2016 15:29:26 -0400 Sender: Paolo Bonzini References: From: Paolo Bonzini Message-ID: Date: Fri, 14 Oct 2016 21:29:02 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] bug introduced by "block: Move throttling fields from BDS to BB" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , qemu block , Kevin Wolf , Alberto Garcia On 14/10/2016 16:11, Paolo Bonzini wrote: > - ThrottleGroup *tg = container_of(blk_bs(blk)->throttle_state, > - ThrottleGroup, ts); > + BlockBackendPublic *blkp = blk_get_public(blk); > + ThrottleGroup *tg = container_of(blkp->throttle_state, ThrottleGroup, ts); > BlockBackend *token, *start; > > start = token = tg->tokens[is_write]; > > /* get next bs round in round robin style */ > token = throttle_group_next_blk(token); > - while (token != start && !blk_bs(token)->pending_reqs[is_write]) { > + while (token != start && !blkp->pending_reqs[is_write]) { > token = throttle_group_next_blk(token); > } > > > blkp isn't updated every time token is updated. BTW, the simplest fix is probably to introduce a function static inline bool blk_has_pending_reqs(BlockBackend *blk, bool is_write) Paolo