Re: [RESEND PATCH v9 06/14] iomap: Return -EAGAIN from iomap_write_iter()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 23, 2022 at 01:23:02PM -0700, Stefan Roesch wrote:
> 
> 
> On 6/23/22 1:18 PM, Darrick J. Wong wrote:
> > On Thu, Jun 23, 2022 at 10:51:49AM -0700, Stefan Roesch wrote:
> >> If iomap_write_iter() encounters -EAGAIN, return -EAGAIN to the caller.
> >>
> >> Signed-off-by: Stefan Roesch <shr@xxxxxx>
> >> ---
> >>  fs/iomap/buffered-io.c | 8 +++++++-
> >>  1 file changed, 7 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> >> index 83cf093fcb92..f2e36240079f 100644
> >> --- a/fs/iomap/buffered-io.c
> >> +++ b/fs/iomap/buffered-io.c
> >> @@ -830,7 +830,13 @@ static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
> >>  		length -= status;
> >>  	} while (iov_iter_count(i) && length);
> >>  
> >> -	return written ? written : status;
> >> +	if (status == -EAGAIN) {
> >> +		iov_iter_revert(i, written);
> >> +		return -EAGAIN;
> >> +	}
> >> +	if (written)
> >> +		return written;
> >> +	return status;
> > 
> > Any particular reason for decomposing the ternary into this?  It still
> > looks correct, but it doesn't seem totally necessary...
> >
> 
> Do you prefer this version?
> 
> +	if (status == -EAGAIN) {
> +		iov_iter_revert(i, written);
> +		return -EAGAIN;
> +	}
> 	return written ? written : status;

Yes, because it /does/ make it a lot more obvious that the only change
is intercepting EAGAIN to rewind the iov_iter. :)

--D

> 
>  
> > Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> > 
> > --D
> > 
> >>  }
> >>  
> >>  ssize_t
> >> -- 
> >> 2.30.2
> >>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux