From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id ECA78469710 for ; Wed, 10 Jun 2020 10:53:00 +0300 (MSK) Received: by mail-lj1-f194.google.com with SMTP id x18so1289019lji.1 for ; Wed, 10 Jun 2020 00:53:00 -0700 (PDT) Date: Wed, 10 Jun 2020 10:52:57 +0300 From: Cyrill Gorcunov Message-ID: <20200610075257.GO134822@grain> References: <20200421213930.28713-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH] fio/coio: handle partial writes List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tml On Wed, Jun 10, 2020 at 12:55:04AM +0200, Vladislav Shpilevoy wrote: > Hi! Thanks for the patch! > > See 4 comments below. > > On 21/04/2020 23:39, Cyrill Gorcunov wrote: > > Writting less bytes than requested is perfectly fine. > > 1. 'Writting' -> 'Writing'. Yup, thanks! > > + > > + while (left > 0) { > > + INIT_COEIO_FILE(eio); > > + chunk = left; > > + > > + ERROR_INJECT(ERRINJ_COIO_WRITE_CHUNK, { > > + chunk = 1; > > + }); > > + > > + req = eio_write(fd, (void *)buf + pos, chunk, > > 2. As it was fairly noticed by Timur in one of my > patches for lsregion - lets better avoid 'void' pointer > arithmetic. And use uint8_t * or char *. OK (though the compilers we work with support this kind of arithmetics pretty well, moreover we already depend heavilty on gcc/llvm extensions, but no problem, will update). > > + offset + pos, EIO_PRI_DEFAULT, > > + coio_complete, &eio); > > + res = coio_wait_done(req, &eio); > > + if (res < 0) { > > + pos = -1; > > 3. What if eio_write() returns EAGAIN/EINTR/WOULDBLOCK? Can it > happen at all? Can it happen, if the descriptor is not > blocking? Can it happen if the underlying FS is a network > file system, like sshfs via FUSE? > > Coio socket library handles these errors and retries them. This patch doesn't address retries. Strictly speaking we should (for example coio_preadn does). But I think it is separate issue. I'll file a bug. > > 4. Please > > - Add the issue reference, like this: > > -- > -- gh-4651: ... > -- > > - Start sentences from a capital letter, and finish with dot. Sure, thanks!