Re: [PATCH 05/14] libxfs: make libxfs_buf_read_map return an error code

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

 



On Tue, Feb 25, 2020 at 09:55:24AM -0800, Christoph Hellwig wrote:
> On Mon, Feb 24, 2020 at 04:14:40PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > 
> > Make libxfs_buf_read_map() and libxfs_readbuf() return an error code
> > instead of making callers guess what happened based on whether or not
> > they got a buffer back.
> > 
> > Add a new SALVAGE flag so that certain utilities (xfs_db and xfs_repair)
> > can attempt salvage operations even if the verifiers failed, which was
> > the behavior before this change.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > ---
> >  db/io.c            |    4 +--
> >  libxfs/libxfs_io.h |   25 ++++++++++++------
> >  libxfs/rdwr.c      |   71 +++++++++++++++++++++++++++++++++++++++++-----------
> >  libxfs/trans.c     |   24 ++++--------------
> >  repair/da_util.c   |    3 +-
> >  5 files changed, 82 insertions(+), 45 deletions(-)
> > 
> > 
> > diff --git a/db/io.c b/db/io.c
> > index b81e9969..5c9d72bb 100644
> > --- a/db/io.c
> > +++ b/db/io.c
> > @@ -542,8 +542,8 @@ set_cur(
> >  		if (!iocur_top->bbmap)
> >  			return;
> >  		memcpy(iocur_top->bbmap, bbmap, sizeof(struct bbmap));
> > -		bp = libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b,
> > -					bbmap->nmaps, 0, ops);
> > +		libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b, bbmap->nmaps,
> > +				LIBXFS_READBUF_SALVAGE, &bp, ops);
> >  	} else {
> >  		bp = libxfs_buf_read(mp->m_ddev_targp, blknum, len, 0, ops);
> >  		iocur_top->bbmap = NULL;
> 
> I think instead of ignorining the error and checkig b_error further down
> that should be moved to work based on the return value.

Yeah, I'll add a cleanup patch for that on the end, after we convert
libxfs_buf_read.  Thanks for reviewing!

--D

> Otherwise looks good:
> 
> 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