Re: [PATCH 02/12] xfs: factor out buffer I/O failure simulation code

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

 



On Mon, Apr 20, 2020 at 12:48:40PM +1000, Dave Chinner wrote:
> On Fri, Apr 17, 2020 at 11:08:49AM -0400, Brian Foster wrote:
> > We use the same buffer I/O failure simulation code in a few
> > different places. It's not much code, but it's not necessarily
> > self-explanatory. Factor it into a helper and document it in one
> > place.
> > 
> > Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> > ---
> >  fs/xfs/xfs_buf.c      | 23 +++++++++++++++++++----
> >  fs/xfs/xfs_buf.h      |  1 +
> >  fs/xfs/xfs_buf_item.c | 22 +++-------------------
> >  fs/xfs/xfs_inode.c    |  7 +------
> >  4 files changed, 24 insertions(+), 29 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index 9ec3eaf1c618..93942d8e35dd 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -1248,6 +1248,24 @@ xfs_buf_ioerror_alert(
> >  			-bp->b_error);
> >  }
> >  
> > +/*
> > +  * To simulate an I/O failure, the buffer must be locked and held with at least
> 
> Whitespace.
> 

Fixed.

> > + * three references. The LRU reference is dropped by the stale call. The buf
> > + * item reference is dropped via ioend processing. The third reference is owned
> > + * by the caller and is dropped on I/O completion if the buffer is XBF_ASYNC.
> > + */
> > +void
> > +xfs_buf_iofail(
> > +	struct xfs_buf	*bp,
> > +	int		flags)
> > +{
> > +	bp->b_flags |= flags;
> > +	bp->b_flags &= ~XBF_DONE;
> > +	xfs_buf_stale(bp);
> > +	xfs_buf_ioerror(bp, -EIO);
> > +	xfs_buf_ioend(bp);
> > +}
> 
> This function is an IO completion function. Can we call it
> xfs_buf_ioend_fail(), please, to indicate that it both fails and
> completes the IO in progress?
> 

Works for me..

Brian

> 
> Otherwise ok.
> 
> 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