From: Christoph Hellwig <hch@lst.de>
To: Christoph Hellwig <hch@lst.de>, xfs@oss.sgi.com
Subject: Re: [PATCH 00/26] generic btree implementation, version 3
Date: Mon, 4 Aug 2008 16:21:32 +0200 [thread overview]
Message-ID: <20080804142131.GA9892@lst.de> (raw)
In-Reply-To: <20080804015425.GE6119@disturbed>
On Mon, Aug 04, 2008 at 11:54:25AM +1000, Dave Chinner wrote:
> > I'm not sure
> > what to do with move_* - these are the most ugly helpers, so maybe
> > we should just make them memmove wrappers in the style of copy_
> > and leave all addressing to the callers.
>
> Yes, it would be nice to have them use the same interface. If
> we do that, then there's no real point for having a copy vs move
> distinction - we could just make everything use the
> memmove version and drop one of the interfaces altogether....
I've actually come up with another variant. Since what we do in the
memmove case is to move a number of entries in a single block up or down
one position I've added the following helper:
STATIC void
xfs_btree_shift_keys(
struct xfs_btree_cur *cur,
union xfs_btree_key *key
int dir,
int numkeys)
{
char *dst_key;
ASSERT(numkeys >= 0);
ASSERT(dir == 1 || dir == -1);
dst_key = (char *)key + (dir * cur->bc_ops->key_len);
memmove(dst_key, key, numkeys * cur->bc_ops->key_len);
}
and the same for ptrs and recs. This follows the original code in
spirit and is quite readable.
next prev parent reply other threads:[~2008-08-04 14:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 1:31 [PATCH 00/26] generic btree implementation, version 3 Christoph Hellwig
[not found] ` <20080804015425.GE6119@disturbed>
2008-08-04 2:02 ` Christoph Hellwig
2008-08-04 14:21 ` Christoph Hellwig [this message]
2008-08-05 0:26 ` Dave Chinner
2008-08-05 0:49 ` Christoph Hellwig
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=20080804142131.GA9892@lst.de \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox