Re: [PATCH 01/11] xfs: make xfs_buf_alloc return an error code

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

 



On Mon, Jan 20, 2020 at 08:49:03AM +1100, Dave Chinner wrote:
> On Thu, Jan 16, 2020 at 10:23:38PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > 
> > Convert _xfs_buf_alloc() to return numeric error codes like most
> > everywhere else in xfs.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> > ---
> ....
> > @@ -715,8 +718,8 @@ xfs_buf_get_map(
> >  		return NULL;
> >  	}
> >  
> > -	new_bp = _xfs_buf_alloc(target, map, nmaps, flags);
> > -	if (unlikely(!new_bp))
> > +	error = _xfs_buf_alloc(target, map, nmaps, flags, &new_bp);
> > +	if (unlikely(error))
> >  		return NULL;
> 
> You can kill the unlikely() while you are at it. They are largely
> unnecessary as the compiler already considers branches with returns
> in them as unlikely and we don't need "unlikely" as code
> documentation for error conditions like this...
> 
> >  	error = xfs_buf_allocate_memory(new_bp, flags);
> > @@ -917,8 +920,8 @@ xfs_buf_get_uncached(
> >  	DEFINE_SINGLE_BUF_MAP(map, XFS_BUF_DADDR_NULL, numblks);
> >  
> >  	/* flags might contain irrelevant bits, pass only what we care about */
> > -	bp = _xfs_buf_alloc(target, &map, 1, flags & XBF_NO_IOACCT);
> > -	if (unlikely(bp == NULL))
> > +	error = _xfs_buf_alloc(target, &map, 1, flags & XBF_NO_IOACCT, &bp);
> > +	if (unlikely(error))
> >  		goto fail;
> 
> here too.

Will fix.

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux