Hi pete,
Agreed. What I meant to say was that the kmem_cache_create interface
may be deprecated soon. Instead of phasing out an argument, a BUG() in
the kernel ensures that 3rd party folks such as us fix this issue
before the actual release of the 2.6.22 kernel.
How about the following patch? I have only compile tested it and made
sure that it loads on my machine. But I don't run the latest kernels
and so that is not such a good test..:)
thanks,
Murali
On 6/27/07, Pete Wyckoff <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote on Wed, 27 Jun 2007 08:14 -0700:
> Ah pete! thanks for the clarification. I was looking at 2.6.21 hoping
> that that would be the latest.
> It does look like a new ish kernel feature. I am sorta out of the loop
> on the newest kernel issues :(
> Let me look at the code a little bit and work on a patch and send it
> later today.
> Basically, SLAB is deprecated. We need to find out an alternate
> way/interface.
The verdict is still quite out on SLAB vs the other allocators. But
regardless, they'll all have the same interface. And that interface
no longer accepts a destructor function. We might as well get used
to it.
Regarding us wasting our time with these pre-release kernels.
Agreed it's a major pain to deal with, and we don't want to waste
time adapting to the daily changes in linux, especially as
reversions are not completely uncommon. But for modifications that
are likely to stick, including the previous slab one mvdv ran into
at compile time, it's a question of fix it now or fix it later.
We could always just dump the code and go with the fuse version. :)
-- Pete
--- src/kernel/linux-2.6/pvfs2-kernel.h.old 2007-06-27 10:03:39.784768000 -0700
+++ src/kernel/linux-2.6/pvfs2-kernel.h 2007-06-27 10:09:27.818449000 -0700
@@ -363,7 +363,7 @@ typedef struct
typedef struct
{
PVFS_object_ref refn;
- char *link_target;
+ char link_target[PVFS_NAME_MAX];
/*
* Reading/Writing Extended attributes need to acquire the appropriate
* reader/writer semaphore on the pvfs2_inode_t structure.
--- src/kernel/linux-2.6/pvfs2-utils.c.old 2007-06-27 10:07:24.750515000 -0700
+++ src/kernel/linux-2.6/pvfs2-utils.c 2007-06-27 10:08:49.012681000 -0700
@@ -288,17 +288,7 @@ int copy_attributes_to_inode(
/* copy link target to inode private data */
if (pvfs2_inode && symname)
{
- if (pvfs2_inode->link_target)
- {
- kfree(pvfs2_inode->link_target);
- pvfs2_inode->link_target = NULL;
- }
- pvfs2_inode->link_target = kmalloc(
- (strlen(symname) + 1), PVFS2_GFP_FLAGS);
- if (pvfs2_inode->link_target)
- {
- strcpy(pvfs2_inode->link_target, symname);
- }
+ strncpy(pvfs2_inode->link_target, symname, PVFS_NAME_MAX);
gossip_debug(GOSSIP_UTILS_DEBUG, "Copied attr link target %s\n",
pvfs2_inode->link_target);
}
@@ -1956,7 +1946,7 @@ void pvfs2_inode_initialize(pvfs2_inode_
pvfs2_inode->refn.handle = PVFS_HANDLE_NULL;
pvfs2_inode->refn.fs_id = PVFS_FS_ID_NULL;
pvfs2_inode->last_failed_block_index_read = 0;
- pvfs2_inode->link_target = NULL;
+ memset(pvfs2_inode->link_target, 0, sizeof(pvfs2_inode->link_target));
pvfs2_inode->error_code = 0;
SetInitFlag(pvfs2_inode);
}
@@ -1964,7 +1954,6 @@ void pvfs2_inode_initialize(pvfs2_inode_
/*
this is called from super:pvfs2_destroy_inode.
- pvfs2_inode_cache_dtor frees the link_target if any
*/
void pvfs2_inode_finalize(pvfs2_inode_t *pvfs2_inode)
{
--- src/kernel/linux-2.6/pvfs2-cache.c.old 2007-06-27 10:04:45.093006000 -0700
+++ src/kernel/linux-2.6/pvfs2-cache.c 2007-06-27 10:09:26.749393000 -0700
@@ -296,20 +296,6 @@ static void pvfs2_inode_cache_ctor(
}
}
-static void pvfs2_inode_cache_dtor(
- void *old_pvfs2_inode,
- pvfs2_kmem_cache_t * cachep,
- unsigned long flags)
-{
- pvfs2_inode_t *pvfs2_inode = (pvfs2_inode_t *)old_pvfs2_inode;
-
- if (pvfs2_inode && pvfs2_inode->link_target)
- {
- kfree(pvfs2_inode->link_target);
- pvfs2_inode->link_target = NULL;
- }
-}
-
static inline void add_to_pinode_list(pvfs2_inode_t *pvfs2_inode)
{
spin_lock(&pvfs2_inode_list_lock);
@@ -331,7 +317,7 @@ int pvfs2_inode_cache_initialize(void)
pvfs2_inode_cache = kmem_cache_create(
"pvfs2_inode_cache", sizeof(pvfs2_inode_t), 0,
PVFS2_CACHE_CREATE_FLAGS, pvfs2_inode_cache_ctor,
- pvfs2_inode_cache_dtor);
+ NULL);
if (!pvfs2_inode_cache)
{
_______________________________________________
Pvfs2-users mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users