Re: [PATCH 03/10] xfs: hide log iovec alignment constraints

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

 



On Tue, May 03, 2022 at 03:45:29PM -0700, Darrick J. Wong wrote:
> On Wed, May 04, 2022 at 08:17:21AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > 
> > Callers currently have to round out the size of buffers to match the
> > aligment constraints of log iovecs and xlog_write(). They should not
> > need to know this detail, so introduce a new function to calculate
> > the iovec length (for use in ->iop_size implementations). Also
> > modify xlog_finish_iovec() to round up the length to the correct
> > alignment so the callers don't need to do this, either.
> > 
> > Convert the only user - inode forks - of this alignment rounding to
> > use the new interface.
....
> >  static inline void
> > -xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec, int len)
> > +xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec,
> > +		int data_len)
> >  {
> >  	struct xlog_op_header	*oph = vec->i_addr;
> > -
> > -	/* opheader tracks payload length, logvec tracks region length */
> > +	int			len;
> > +
> > +	/*
> > +	 * Always round up the length to the correct alignment so callers don't
> > +	 * need to know anything about this log vec layout requirement. This
> > +	 * means we have to zero the area the data to be written does not cover.
> > +	 * This is complicated by fact the payload region is offset into the
> > +	 * logvec region by the opheader that tracks the payload.
> > +	 */
> > +	len = xlog_calc_iovec_len(data_len);
> > +	if (len - data_len != 0) {
> > +		char	*buf = vec->i_addr + sizeof(struct xlog_op_header);
> > +
> > +		memset(buf + data_len, 0, len - data_len);
> 
> Assuming this is the replacement for the kzalloc/kzrealloc calls above
> so that we don't write junk to disk,

Yes, exactly that.

> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

Thanks!

-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