From: Muli Ben-Yehuda <mulix@mulix.org>
To: David Howells <dhowells@warthog.cambridge.redhat.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PAG support only
Date: Wed, 14 May 2003 15:35:24 +0300 [thread overview]
Message-ID: <20030514123524.GK20083@actcom.co.il> (raw)
In-Reply-To: <19000.1052906076@warthog.warthog>
[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]
On Wed, May 14, 2003 at 10:54:36AM +0100, David Howells wrote:
>
> Muli Ben-Yehuda wrote:
>
> > > + * VFS session authentication token cache
> > ...
> >
> > If you know the type of the data, why keep it all in one binary blob,
> > instead of a struct? cache effects?
>
> No. We _don't_ know the type of the data. A filesystem entrusts us with a
> token to keep in the PAG on its behalf. However, since this is meant to be a
> generic mechanism, it's entirely dependent on the fs as to what's in
> the blob.
But you do know the type of the data in the blob... it's char* fsname,
const void* key and const void* data, according to your code.
You do
void* blob = kmalloc(fsname size + key size + data size)
memcpy(blob, fsname, fsname size)
memcpy(blob + fsname offset, key, key size)
mempcy(blob + fsname offset + key offset, data, data size)
I suggest
struct fsblob {
const char* fsname;
const void* key;
size_t keysize;
const void* data;
size_t datasize;
};
struct fsblob b;
b->fsname = kmalloc(fsname size)
memcpy(b->fsname, fsname, fsname size)
etc.
Your method loses on additional complexity, and wins on
speed. However, unless it's really, really speed sensitive code, I
would go for KISS any day.
> > Nothing in this patch appears to be using it. You aren't taking a
> > reference to the token here, what's protecting it from disappearing
> > after the return and before the caller gets a chance to do something
> > with it?
>
> Thanks. Fixed.
My pleasure.
--
Muli Ben-Yehuda
http://www.mulix.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2003-05-14 12:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-13 16:33 [PATCH] PAG support only David Howells
2003-05-13 16:48 ` Jeff Garzik
2003-05-13 20:37 ` Christoph Hellwig
2003-05-13 22:27 ` [OpenAFS-devel] " Nathan Neulinger
2003-05-14 5:33 ` Christoph Hellwig
2003-05-16 15:24 ` Derek Atkins
2003-05-14 8:17 ` David Howells
2003-05-14 8:39 ` Christoph Hellwig
2003-05-14 4:57 ` Muli Ben-Yehuda
2003-05-14 9:54 ` David Howells
2003-05-14 12:35 ` Muli Ben-Yehuda [this message]
2003-05-14 13:17 ` David Howells
[not found] <20030513175240.6313ea92.akpm@digeo.com>
2003-05-14 9:44 ` David Howells
2003-05-14 10:00 ` Andrew Morton
2003-05-14 10:01 ` Miles Bader
-- strict thread matches above, loose matches on Subject: below --
2003-05-14 16:04 Chuck Ebbert
2003-05-14 16:20 ` William Lee Irwin III
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=20030514123524.GK20083@actcom.co.il \
--to=mulix@mulix.org \
--cc=dhowells@warthog.cambridge.redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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