Re: [PATCH 6/9] xfs: make xfs_buf_get_map return an error code

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

 



On Thu, Jan 16, 2020 at 08:28:56AM -0800, Christoph Hellwig wrote:
> >  	error = xfs_buf_find(target, map, nmaps, flags, NULL, &bp);
> > -
> >  	switch (error) {
> >  	case 0:
> >  		/* cache hit */
> >  		goto found;
> > -	case -EAGAIN:
> > -		/* cache hit, trylock failure, caller handles failure */
> > -		ASSERT(flags & XBF_TRYLOCK);
> > -		return NULL;
> >  	case -ENOENT:
> >  		/* cache miss, go for insert */
> >  		break;
> > +	case -EAGAIN:
> > +		/* cache hit, trylock failure, caller handles failure */
> > +		ASSERT(flags & XBF_TRYLOCK);
> > +		/* fall through */
> >  	case -EFSCORRUPTED:
> >  	default:
> > -		/*
> > -		 * None of the higher layers understand failure types
> > -		 * yet, so return NULL to signal a fatal lookup error.
> > -		 */
> > -		return NULL;
> > +		return error;
> 
> I think two little if statements would be cleaner with two ifs instead
> of the switch statement:
> 
> 	if (!error)
> 		goto found;
> 	if (error != -ENOENT)
> 		return error;
> 
> Otherwise looks good:

Will fix.

--D

> Reviewed-by: Christoph Hellwig <hch@xxxxxx>



[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