Re: [PATCH 9/9] xfs: log head and tail aren't reliable during shutdown

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

 



On Fri, Jul 02, 2021 at 09:53:15AM +0100, Christoph Hellwig wrote:
> > +	if (tail_cycle == head_cycle && head_bytes >= tail_bytes) {
> > +		return log->l_logsize - (head_bytes - tail_bytes);
> > +	} else if (tail_cycle + 1 < head_cycle) {
> >  		return 0;
> > +	} else if (xlog_is_shutdown(log)) {
> > +		/* Ignore potential inconsistency when shutdown. */
> > +		return log->l_logsize;
> > +	} else if (tail_cycle < head_cycle) {
> >  		ASSERT(tail_cycle == (head_cycle - 1));
> > +		return tail_bytes - head_bytes;
> >  	}
> 
> Drop the else after the returns to make this a little easier to follow:
> 
> 	if (tail_cycle == head_cycle && head_bytes >= tail_bytes)
> 		return log->l_logsize - (head_bytes - tail_bytes);
> 	if (tail_cycle + 1 < head_cycle)
> 		return 0;
> 
> 	/* Ignore potential inconsistency when shutdown. */
> 	if (xlog_is_shutdown(log)) {
> 		return log->l_logsize;
> 
> 	if (tail_cycle < head_cycle) {
> 		ASSERT(tail_cycle == (head_cycle - 1));
> 		return tail_bytes - head_bytes;
> 	}

Yup, that's better. I'll fix it.

-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