Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-25 Thread Goldwyn Rodrigues
On 01/23/2018 12:35 AM, Matthew Wilcox wrote: > On Mon, Jan 22, 2018 at 08:28:54PM -0700, Jens Axboe wrote: >> On 1/22/18 8:18 PM, Goldwyn Rodrigues wrote: that their application was "already broken". I'd hate for a kernel upgrade to break them. I do wish we could make the cha

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-23 Thread Andreas Dilger
On Jan 22, 2018, at 8:28 PM, Jens Axboe wrote: > > On 1/22/18 8:18 PM, Goldwyn Rodrigues wrote: >>> that their application was "already broken". I'd hate for a kernel >>> upgrade to break them. >>> >>> I do wish we could make the change, and maybe we can. But it probably >>> needs some safe guar

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Matthew Wilcox
On Mon, Jan 22, 2018 at 08:28:54PM -0700, Jens Axboe wrote: > On 1/22/18 8:18 PM, Goldwyn Rodrigues wrote: > >> that their application was "already broken". I'd hate for a kernel > >> upgrade to break them. > >> > >> I do wish we could make the change, and maybe we can. But it probably > >> needs s

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Jens Axboe
On 1/22/18 8:18 PM, Goldwyn Rodrigues wrote: >> that their application was "already broken". I'd hate for a kernel >> upgrade to break them. >> >> I do wish we could make the change, and maybe we can. But it probably >> needs some safe guard proc entry to toggle the behavior, something we >> can dr

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Goldwyn Rodrigues
On 01/22/2018 01:13 PM, Jens Axboe wrote: > On 1/22/18 12:10 PM, Andreas Dilger wrote: >> >>> On Jan 20, 2018, at 8:07 PM, Jens Axboe wrote: >>> >>> On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: On 01/20/2018 08:11 PM, Andi Kleen wrote: > > It's likely there's a lot of code

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Jens Axboe
On 1/22/18 4:24 PM, Bart Van Assche wrote: > On Mon, 2018-01-22 at 16:14 -0700, Jens Axboe wrote: >> On 1/22/18 3:25 PM, Elliott, Robert (Persistent Memory) wrote: >>> fio engines/sg.c fio_sgio_rw_doio() has that pattern: >>> >>> ret = write(f->fd, hdr, sizeof(*hdr)); >>> if (ret < 0) >>>

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Bart Van Assche
On Mon, 2018-01-22 at 16:14 -0700, Jens Axboe wrote: > On 1/22/18 3:25 PM, Elliott, Robert (Persistent Memory) wrote: > > fio engines/sg.c fio_sgio_rw_doio() has that pattern: > > > > ret = write(f->fd, hdr, sizeof(*hdr)); > > if (ret < 0) > > return ret; > > ... > > re

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Jens Axboe
On 1/22/18 3:25 PM, Elliott, Robert (Persistent Memory) wrote: > > >> On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: >>> On 01/20/2018 08:11 PM, Andi Kleen wrote: Goldwyn Rodrigues writes: > From: Goldwyn Rodrigues > In case direct I/O encounters an error midway, it returns the error

RE: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Elliott, Robert (Persistent Memory)
> On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: > > On 01/20/2018 08:11 PM, Andi Kleen wrote: > >> Goldwyn Rodrigues writes: > >>> From: Goldwyn Rodrigues > >>> In case direct I/O encounters an error midway, it returns the error. > >>> Instead it should be returning the number of bytes transferr

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Jens Axboe
On 1/22/18 12:10 PM, Andreas Dilger wrote: > >> On Jan 20, 2018, at 8:07 PM, Jens Axboe wrote: >> >> On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: >>> >>> >>> On 01/20/2018 08:11 PM, Andi Kleen wrote: It's likely there's a lot of code in user space that does if (write(...,

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Andreas Dilger
> On Jan 20, 2018, at 8:07 PM, Jens Axboe wrote: > > On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: >> >> >> On 01/20/2018 08:11 PM, Andi Kleen wrote: >>> >>> It's likely there's a lot of code in user space that does >>> >>> if (write(..., N) < 0) handle error >>> >>> With your change it

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-22 Thread Andi Kleen
> The only way I can think is that a DIO write should check early enough > that the write(N) will complete with N bytes without an error. Is it > possible to completely guarantee that? Probably not. > > Leaving it as it is incorrect as quoted in the artificial test case. You > should not be chan

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-21 Thread Goldwyn Rodrigues
On 01/20/2018 09:07 PM, Jens Axboe wrote: > On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: >> >> >> On 01/20/2018 08:11 PM, Andi Kleen wrote: >>> Goldwyn Rodrigues writes: >>> From: Goldwyn Rodrigues In case direct I/O encounters an error midway, it returns the error. Instead

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-20 Thread Jens Axboe
On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote: > > > On 01/20/2018 08:11 PM, Andi Kleen wrote: >> Goldwyn Rodrigues writes: >> >>> From: Goldwyn Rodrigues >>> >>> In case direct I/O encounters an error midway, it returns the error. >>> Instead it should be returning the number of bytes transferre

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-20 Thread Goldwyn Rodrigues
On 01/20/2018 01:47 PM, Al Viro wrote: > On Fri, Jan 19, 2018 at 06:33:56AM +, Al Viro wrote: >>> For both patches, >>> Reviewed-by: Darrick J. Wong >> >> Applied; will be in -next tomorrow morning after the tree I'm putting >> together >> gets through local beating. > > FWIW, it consisten

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-20 Thread Goldwyn Rodrigues
On 01/20/2018 08:11 PM, Andi Kleen wrote: > Goldwyn Rodrigues writes: > >> From: Goldwyn Rodrigues >> >> In case direct I/O encounters an error midway, it returns the error. >> Instead it should be returning the number of bytes transferred so far. > > It's likely there's a lot of code in user

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-20 Thread Andi Kleen
Goldwyn Rodrigues writes: > From: Goldwyn Rodrigues > > In case direct I/O encounters an error midway, it returns the error. > Instead it should be returning the number of bytes transferred so far. It's likely there's a lot of code in user space that does if (write(..., N) < 0) handle err

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-20 Thread Al Viro
On Fri, Jan 19, 2018 at 06:33:56AM +, Al Viro wrote: > > For both patches, > > Reviewed-by: Darrick J. Wong > > Applied; will be in -next tomorrow morning after the tree I'm putting together > gets through local beating. FWIW, it consistently blows generic/250 and generic/252.

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-18 Thread Al Viro
On Thu, Jan 18, 2018 at 10:31:18PM -0800, Darrick J. Wong wrote: > On Fri, Jan 19, 2018 at 02:59:51PM +1100, Dave Chinner wrote: > > On Fri, Jan 19, 2018 at 02:13:53AM +, Al Viro wrote: > > > On Thu, Jan 18, 2018 at 06:57:40PM -0600, Goldwyn Rodrigues wrote: > > > > From: Goldwyn Rodrigues > >

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-18 Thread Darrick J. Wong
On Fri, Jan 19, 2018 at 02:59:51PM +1100, Dave Chinner wrote: > On Fri, Jan 19, 2018 at 02:13:53AM +, Al Viro wrote: > > On Thu, Jan 18, 2018 at 06:57:40PM -0600, Goldwyn Rodrigues wrote: > > > From: Goldwyn Rodrigues > > > > > > In case direct I/O encounters an error midway, it returns the e

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-18 Thread Dave Chinner
On Fri, Jan 19, 2018 at 02:13:53AM +, Al Viro wrote: > On Thu, Jan 18, 2018 at 06:57:40PM -0600, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > In case direct I/O encounters an error midway, it returns the error. > > Instead it should be returning the number of bytes transferred

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-18 Thread Al Viro
On Thu, Jan 18, 2018 at 06:57:40PM -0600, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > In case direct I/O encounters an error midway, it returns the error. > Instead it should be returning the number of bytes transferred so far. > > Test case for filesystems (with ENOSPC): > 1. Create

[PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-18 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues In case direct I/O encounters an error midway, it returns the error. Instead it should be returning the number of bytes transferred so far. Test case for filesystems (with ENOSPC): 1. Create an almost full filesystem 2. Create a file, say /mnt/lastfile, until the filesyst