Re: [PATCH v10 02/14] fs: export variant of generic_write_checks without iov_iter

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

 



On Fri, Aug 20, 2021 at 10:59:28AM +0300, Nikolay Borisov wrote:
> 
> 
> On 18.08.21 г. 0:06, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@xxxxxx>
> > 
> > Encoded I/O in Btrfs needs to check a write with a given logical size
> > without an iov_iter that matches that size (because the iov_iter we have
> > is for the compressed data). So, factor out the parts of
> > generic_write_check() that expect an iov_iter into a new
> > __generic_write_checks() function and export that.
> > 
> > Signed-off-by: Omar Sandoval <osandov@xxxxxx>
> > ---
> >  fs/read_write.c    | 40 ++++++++++++++++++++++------------------
> >  include/linux/fs.h |  1 +
> >  2 files changed, 23 insertions(+), 18 deletions(-)
> > 
> > diff --git a/fs/read_write.c b/fs/read_write.c
> > index 0029ff2b0ca8..3bddd5ee7f64 100644
> > --- a/fs/read_write.c
> > +++ b/fs/read_write.c
> > @@ -1633,6 +1633,26 @@ int generic_write_check_limits(struct file *file, loff_t pos, loff_t *count)
> >  	return 0;
> >  }
> >  
> > +/* Like generic_write_checks(), but takes size of write instead of iter. */
> > +int __generic_write_checks(struct kiocb *iocb, loff_t *count)
> > +{
> > +	struct file *file = iocb->ki_filp;
> > +	struct inode *inode = file->f_mapping->host;
> > +
> > +	if (IS_SWAPFILE(inode))
> > +		return -ETXTBSY;
> 
>  Missing 'if(!count) return 0' from original code ?

Good catch, thanks.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux