Received: from eggs.gnu.org ([2001:4830:134:3::10]:52272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byYMO-00076o-JO for qemu-devel@nongnu.org; Mon, 24 Oct 2016 02:03:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byYMK-0006NE-H7 for qemu-devel@nongnu.org; Mon, 24 Oct 2016 02:03:48 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:4364) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1byYMK-0006IE-7h for qemu-devel@nongnu.org; Mon, 24 Oct 2016 02:03:44 -0400 References: <1477066919-35979-1-git-send-email-pradeep.jagadeesh@huawei.com> From: Pradeep Jagadeesh Message-ID: <4c50375d-85e2-f2a4-745d-0aa3eeff9917@huawei.com> Date: Mon, 24 Oct 2016 08:02:31 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [V6] fsdev: add IO throttle support to fsdev devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , Pradeep Jagadeesh , "Aneesh Kumar K.V" , Greg Kurz Cc: qemu-devel@nongnu.org, Claudio Fontana > On Fri 21 Oct 2016 06:21:59 PM CEST, Pradeep Jagadeesh wrote: > >> +static bool fsdev_throttle_check_for_wait(FsThrottle *fst, bool is_write) >> +{ >> + return throttle_schedule_timer(&fst->ts, &fst->tt, is_write); > ^ > There's an extra whitespace there. Removed > >> +static void fsdev_throttle_schedule_next_request(FsThrottle *fst, bool is_write) >> +{ >> + if (!qemu_co_queue_empty(&fst->throttled_reqs[is_write])) { >> + if (fsdev_throttle_check_for_wait(fst, is_write)) { >> + return; >> + } >> + } >> + qemu_co_queue_next(&fst->throttled_reqs[is_write]); >> +} > > That is wrong, you're calling qemu_co_queue_next() even if the queue is > empty. That line should be inside the 'if' block. > Done! > I still think that -after the changes you made in v6- you could put the > contents of that whole function inside fsdev_co_throttle_request(), and > at the same time get rid of fsdev_throttle_check_for_wait() and call > throttle_schedule_timer() directly. The resulting code will be smaller > and probably easier to read. But those are just style decisions. I just would like to keep these functions. > >> +static int get_num_bytes(struct iovec *iov, int iovcnt) >> +{ >> + int i; >> + int bytes = 0; >> + >> + for (i = 0; i < iovcnt; i++) { >> + bytes += iov[i].iov_len; >> + } >> + return bytes; >> +} > > I overlooked that in my previous review, but 'bytes' should be unsigned > (both here and in fsdev_co_throttle_request). Done! > > I still have to review the init/cleanup functions (I'll try to do it on > monday) but else the code looks fine now. > Ok, I am out of office for whole week. I can send the next patch only on next saturday/sunday. Please let me know all your comments by then. -Pradeep > Berto >