From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: [PATCH 07/18] io_uring: support for IO polling Date: Tue, 29 Jan 2019 13:37:09 -0700 Message-ID: <79f9f2e3-7e7d-00fa-5ce6-36787d66f865@kernel.dk> References: <20190128213538.13486-1-axboe@kernel.dk> <20190128213538.13486-8-axboe@kernel.dk> <20190129172414.GA15347@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: owner-linux-aio@kvack.org To: Jeff Moyer Cc: Christoph Hellwig , linux-aio@kvack.org, linux-block@vger.kernel.org, linux-man@vger.kernel.org, linux-api@vger.kernel.org, avi@scylladb.com List-Id: linux-man@vger.kernel.org On 1/29/19 1:35 PM, Jeff Moyer wrote: > Jens Axboe writes: > >> On 1/29/19 11:31 AM, Jens Axboe wrote: >>>> The code looks a little clumsy to me. Why not: >>>> >>>> while (!list_empty(&ctx->poll_list)) { >>>> int ret = io_do_iopoll(ctx, nr_events, min); >>>> if (ret) >>>> return ret; >>>> >>>> if (!min || *nr_events >= min) >>>> return 0; >>>> } >>>> >>>> return 1; >>> >>> I think you messed up the 0/1 here, how about this: >>> >>> while (!list_empty(&ctx->poll_list)) { >>> int ret; >>> >>> ret = io_do_iopoll(ctx, nr_events, min); >>> if (ret < 0) >>> return ret; >>> if (!min || *nr_events >= min) >>> return 1; >>> } >>> >>> return 0; >> >> Or I did... I think yours is correct. > > maybe document the return code? ;-) It is sort-of documented - <= 0 means "don't call me again", either because of an error (< 0) or because we have what we need. 1 means "I might have more". But yes, maybe a comment... -- Jens Axboe -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: aart@kvack.org