Subject: Re: [PATCHSET] Add support for simplified async direct-io To: Christoph Hellwig References: <1479144519-15738-1-git-send-email-axboe@fb.com> <20161114173728.GA22167@infradead.org> <71ce9ae3-214d-b248-3507-cc96bea41a9b@fb.com> <20161114180052.GA24476@infradead.org> <4f30a528-9996-4c6a-9513-8aa2054e4d4b@fb.com> <20161114180503.GA31126@infradead.org> <20161114181119.GA9396@infradead.org> Cc: axboe@kernel.dk, linux-block@vger.kernel.org From: Jens Axboe Message-ID: <47ed731e-91c7-0641-5ce8-401ed4ce7c8d@fb.com> Date: Mon, 14 Nov 2016 11:17:09 -0700 MIME-Version: 1.0 In-Reply-To: <20161114181119.GA9396@infradead.org> Content-Type: text/plain; charset=windows-1252; format=flowed List-ID: On 11/14/2016 11:11 AM, Christoph Hellwig wrote: > On Mon, Nov 14, 2016 at 11:08:46AM -0700, Jens Axboe wrote: >> It'd be cleaner to loop one level out, and avoid all that 'dio' stuff >> instead. And then still retain the separate parts of the sync and async. >> There's nothing to share there imho, and it just makes the code harder >> to read. > > How do you avoid it for the async case? We can only call ki_complete > once all bios have finished, which means we need a tracking structure > for it. For the synchronous case we could in theory wait for the > previous bio before sending the next, but there are plenty of RAID > arrays that would prefer > 1MB I/O. And we can pretty much reuse the > async case for this anyway. Just make the limit reasonable - with a order 1 alloc, we have 256 pages, or 1MB of IO. Loop around that. We could play tricks with bio reuse and using the ref count for knowing when it'd be done. -- Jens Axboe