public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 06/10 v2] xfs: format log items write directly into the linear CIL buffer
Date: Thu, 12 Dec 2013 11:05:30 +1100	[thread overview]
Message-ID: <20131212000530.GU10988@dastard> (raw)
In-Reply-To: <20131211120341.GA6116@infradead.org>

On Wed, Dec 11, 2013 at 04:03:41AM -0800, Christoph Hellwig wrote:
> Instead of setting up pointers to memory locations in iop_format which then
> get copied into the CIL linear buffer after return move the copy into
> the individual inode items.  This avoids the need to always have a memory
> block in the exact same layout that gets written into the log around, and
> allow the log items to be much more flexible in their in-memory layouts.
> 
> The only caveat is that we need to properly align the data for each
> iovec so that don't have structures misaligned in subsequent iovecs.

.....

> diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
> index 384c6c4..65e054a 100644
> --- a/fs/xfs/xfs_log.h
> +++ b/fs/xfs/xfs_log.h
> @@ -31,18 +31,49 @@ struct xfs_log_vec {
>  #define XFS_LOG_VEC_ORDERED	(-1)
>  
>  static inline void *
> -xlog_copy_iovec(struct xfs_log_iovec **vecp, uint type, void *data, int len)
> +xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
> +		uint type)
>  {
>  	struct xfs_log_iovec *vec = *vecp;
>  
> +	if (vec) {
> +		ASSERT(vec - lv->lv_iovecp < lv->lv_niovecs);
> +		vec++;
> +	} else {
> +		vec = &lv->lv_iovecp[0];
> +	}
> +
>  	vec->i_type = type;
> -	vec->i_addr = data;
> -	vec->i_len = len;
> +	vec->i_addr = lv->lv_buf + lv->lv_buf_len;
>  
> -	*vecp = vec + 1;
> +	*vecp = vec;
>  	return vec->i_addr;

Can you add an assert here like this:

	ASSERT(IS_ALIGNED(vec->i_addr, sizeof(uint64_t));

So we catch any situation where the alignment ends up wrong?

Otherwise, it looks good, so consider it:

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-12-12  0:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29  8:39 [PATCH 00/10] decouple the in-memory from the on-disk log format V2 Christoph Hellwig
2013-11-29  8:39 ` [PATCH 01/10] xfs: remove duplicate code in xlog_cil_insert_format_items Christoph Hellwig
2013-12-03  0:58   ` Dave Chinner
2013-12-09 19:45   ` Ben Myers
2013-12-10 16:18     ` Christoph Hellwig
2013-11-29  8:39 ` [PATCH 02/10] xfs: refactor xfs_buf_item_format_segment Christoph Hellwig
2013-12-03  1:03   ` Dave Chinner
2013-11-29  8:39 ` [PATCH 03/10] xfs: refactor xfs_inode_item_size Christoph Hellwig
2013-12-03  1:06   ` Dave Chinner
2013-11-29  8:39 ` [PATCH 04/10] xfs: refactor xfs_inode_item_format Christoph Hellwig
2013-12-03  1:10   ` Dave Chinner
2013-11-29  8:39 ` [PATCH 05/10] xfs: introduce xlog_copy_iovec Christoph Hellwig
2013-12-03  1:21   ` Dave Chinner
2013-12-03  9:43     ` Christoph Hellwig
2013-11-29  8:39 ` [PATCH 06/10] xfs: format log items write directly into the linear CIL buffer Christoph Hellwig
2013-12-04  0:37   ` Dave Chinner
2013-12-09 19:00     ` Ben Myers
2013-12-10 16:12       ` Christoph Hellwig
2013-12-11 12:03   ` [PATCH 06/10 v2] " Christoph Hellwig
2013-12-12  0:05     ` Dave Chinner [this message]
2013-12-12 16:25     ` [PATCH 06/10 v3] " Christoph Hellwig
2013-11-29  8:39 ` [PATCH 07/10] xfs: format logged extents directly into the CIL Christoph Hellwig
2013-12-04  0:40   ` Dave Chinner
2013-11-29  8:39 ` [PATCH 08/10] xfs: remove the inode log format from the inode log item Christoph Hellwig
2013-12-04  0:44   ` Dave Chinner
2013-11-29  8:39 ` [PATCH 09/10] xfs: remove the dquot log format from the dquot " Christoph Hellwig
2013-12-04  0:47   ` Dave Chinner
2013-11-29  8:39 ` [PATCH 10/10] xfs: remove the quotaoff log format from the quotaoff " Christoph Hellwig
2013-12-04  0:49   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131212000530.GU10988@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox