All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@lst.de>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 12/21] implement generic xfs_btree_updkey
Date: Wed, 30 Jul 2008 15:09:36 +1000	[thread overview]
Message-ID: <20080730050936.GM13395@disturbed> (raw)
In-Reply-To: <20080729193110.GM19104@lst.de>

On Tue, Jul 29, 2008 at 09:31:10PM +0200, Christoph Hellwig wrote:
> From: Dave Chinner <dgc@sgi.com>
> 
> Note that there are many > 80 char lines introduced due to the
> xfs_btree_key casts.  But the places where this happens is throw-away
> code once the whole btree code gets merged into a common implementation.
> 
> The same is true for the temporary xfs_alloc_log_keys define to the new
> name.  All old users will be gone after a few patches.
> 
> [hch: split out from bigger patch and minor adaptions]
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

.....

> +/*
> + * Update keys at all levels from here to the root along the cursor's path.
> + */
> +int
> +xfs_btree_updkey(
> +	struct xfs_btree_cur	*cur,
> +	union xfs_btree_key	*keyp,
> +	int			level)
> +{
> +	struct xfs_btree_block	*block;
> +	struct xfs_buf		*bp;
> +	union xfs_btree_key	*kp;
> +	int			ptr;
> +#ifdef DEBUG
> +	int			error;
> +#endif

This can be scoped inside the for loop.

> +
> +	XFS_BTREE_TRACE_CURSOR(cur, XBT_ENTRY);
> +	XFS_BTREE_TRACE_ARGIK(cur, level, keyp);
> +
> +	ASSERT(!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) || level >= 1);
> +
> +	/*
> +	 * Go up the tree from this level toward the root.
> +	 * At each level, update the key value to the value input.
> +	 * Stop when we reach a level where the cursor isn't pointing
> +	 * at the first entry in the block.
> +	 */
> +	for (ptr = 1; ptr == 1 && level < cur->bc_nlevels; level++) {
> +		block = xfs_btree_get_block(cur, level, &bp);
> +#ifdef DEBUG
> +		error = xfs_btree_check_block(cur, block, level, bp);
> +		if (error) {
> +			XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
> +			return error;
> +		}
> +#endif

And even then I think we might not need an error variable - it can
only return EFSCORRUPTED, so:

#ifdef DEBUG
		if (xfs_btree_check_block(cur, block, level, bp)) {
			XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
			return EFSCORRUPTED;
		}
#endif

Would remove the need for the error variable.

Otherwise looks ok.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2008-07-30  5:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-29 19:31 [PATCH 12/21] implement generic xfs_btree_updkey Christoph Hellwig
2008-07-30  5:09 ` Dave Chinner [this message]
2008-08-01 19:44   ` Christoph Hellwig
2008-08-02  1:14     ` 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=20080730050936.GM13395@disturbed \
    --to=david@fromorbit.com \
    --cc=hch@lst.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.