Re: [PATCH 2/3] btrfs: fix argument type of btrfs_bio_clone_partial()

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

 



On Thu, Jul 08, 2021 at 05:00:25PM +0200, David Sterba wrote:
> On Thu, Jul 08, 2021 at 10:10:56PM +0900, Naohiro Aota wrote:
> > From: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
> > 
> > The offset and can never be negative use unsigned int instead of int type
> > for them.
> > 
> > Tested-by: Naohiro Aota <naohiro.aota@xxxxxxx>
> > Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
> > ---
> >  fs/btrfs/extent_io.c | 3 ++-
> >  fs/btrfs/extent_io.h | 3 ++-
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> > index 1f947e24091a..082f135bb3de 100644
> > --- a/fs/btrfs/extent_io.c
> > +++ b/fs/btrfs/extent_io.c
> > @@ -3153,7 +3153,8 @@ struct bio *btrfs_io_bio_alloc(unsigned int nr_iovecs)
> >  	return bio;
> >  }
> >  
> > -struct bio *btrfs_bio_clone_partial(struct bio *orig, int offset, int size)
> > +struct bio *btrfs_bio_clone_partial(struct bio *orig, unsigned int offset,
> > +				    unsigned int size)
> >  {
> >  	struct bio *bio;
> >  	struct btrfs_io_bio *btrfs_bio;
> > diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> > index 62027f551b44..f78b365b56cf 100644
> > --- a/fs/btrfs/extent_io.h
> > +++ b/fs/btrfs/extent_io.h
> > @@ -280,7 +280,8 @@ void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
> >  struct bio *btrfs_bio_alloc(u64 first_byte);
> >  struct bio *btrfs_io_bio_alloc(unsigned int nr_iovecs);
> >  struct bio *btrfs_bio_clone(struct bio *bio);
> > -struct bio *btrfs_bio_clone_partial(struct bio *orig, int offset, int size);
> > +struct bio *btrfs_bio_clone_partial(struct bio *orig, unsigned int offset,
> > +				    unsigned int size);
> 
> This is passed to bio_trim that you change to take sector_t, should this
> be the same?

btrfs_bio_clone_partial() expects byte-based value, so using sector_t
is misleading. Should we use u64 here? But the values must be <=
UINT_MAX.

> >  
> >  int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
> >  		      u64 length, u64 logical, struct page *page,
> > -- 
> > 2.32.0



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux