From: shadow Date: Thu, 21 Jun 2007 05:41:50 +0000 (+0000) Subject: 2.6.22 has only one visble change for patchless cleint, SLAB_CTOR_* constants is X-Git-Tag: v1_8_0_110~1515 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2f05ffc575bbb7138f13438c525af4ac25605df9;p=fs%2Flustre-release.git 2.6.22 has only one visble change for patchless cleint, SLAB_CTOR_* constants is removed. In this case we need drop using os depended interface to kmem_cache and use cfs_mem_cache API. b=12764 i=green i=wangdi --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index edaebde..5e54a4d 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -9,7 +9,7 @@ tbd Cluster File Systems, Inc. * Client support for unpatched kernels: (see http://wiki.lustre.org/index.php?title=Patchless_Client) 2.6.9-42.0.10.EL (RHEL 4) - 2.6.16 - 2.6.21 vanilla (kernel.org) + 2.6.16 - 2.6.22 vanilla (kernel.org) * Recommended e2fsprogs version: 1.39.cfs7 * Note that reiserfs quotas are disabled on SLES 10 in this kernel. * bug fixes @@ -328,9 +328,16 @@ Details : decrease the amount of synchronous RPC between clients and servers Severity : enhancement Bugzilla : 12605 Description: add #ifdef HAVE_KERNEL_CONFIG_H -Details : kernels from 2.6.21 not need include linux/config.h, but add include +Details : kernels from 2.6.19 not need include linux/config.h, but add include linux/autoconf.h in commpiler command line. +Severity : enhancement +Bugzilla : 12764 +Description: patchless client support for 2.6.22 kernel +Details : 2.6.22 has only one visble change, SLAB_CTOR_* constants is + removed. In this case we need drop using os depended interface to + kmem_cache and use cfs_mem_cache API. + -------------------------------------------------------------------------------- 2007-05-03 Cluster File Systems, Inc. diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 604e594..c865ba2 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -333,7 +333,7 @@ struct ll_readahead_state { struct list_head ras_read_beads; }; -extern kmem_cache_t *ll_file_data_slab; +extern cfs_mem_cache_t *ll_file_data_slab; struct lustre_handle; struct ll_file_data { struct ll_readahead_state fd_ras; @@ -368,7 +368,7 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1,struct inode *i2); #define LLAP_MAGIC 98764321 -extern kmem_cache_t *ll_async_page_slab; +extern cfs_mem_cache_t *ll_async_page_slab; extern size_t ll_async_page_slab_size; struct ll_async_page { int llap_magic; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 81054d1..f32fa7e 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -36,7 +36,7 @@ #include #include "llite_internal.h" -kmem_cache_t *ll_file_data_slab; +cfs_mem_cache_t *ll_file_data_slab; LIST_HEAD(ll_super_blocks); spinlock_t ll_sb_lock = SPIN_LOCK_UNLOCKED; @@ -298,9 +298,9 @@ static int client_common_fill_super(struct super_block *sb, if (!ll_async_page_slab) { ll_async_page_slab_size = size_round(sizeof(struct ll_async_page)) + err; - ll_async_page_slab = kmem_cache_create("ll_async_page", - ll_async_page_slab_size, - 0, 0, NULL, NULL); + ll_async_page_slab = cfs_mem_cache_create("ll_async_page", + ll_async_page_slab_size, + 0, 0); if (!ll_async_page_slab) GOTO(out_osc, -ENOMEM); } diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 7d4ad4c..a749101 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -54,7 +54,7 @@ pos = n, n = pos->prev ) #endif -kmem_cache_t *ll_async_page_slab = NULL; +cfs_mem_cache_t *ll_async_page_slab = NULL; size_t ll_async_page_slab_size = 0; /* SYNCHRONOUS I/O to object storage for an inode */ diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 4543b52..3bb9358 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -66,9 +66,9 @@ static int __init init_lustre_lite(void) printk(KERN_INFO "Lustre: Lustre Client File System; " "info@clusterfs.com\n"); - ll_file_data_slab = kmem_cache_create("ll_file_data", - sizeof(struct ll_file_data), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); + ll_file_data_slab = cfs_mem_cache_create("ll_file_data", + sizeof(struct ll_file_data), 0, + SLAB_HWCACHE_ALIGN); if (ll_file_data_slab == NULL) return -ENOMEM; @@ -108,10 +108,10 @@ static void __exit exit_lustre_lite(void) ll_unregister_cache(&ll_cache_definition); - rc = kmem_cache_destroy(ll_file_data_slab); + rc = cfs_mem_cache_destroy(ll_file_data_slab); LASSERTF(rc == 0, "couldn't destroy ll_file_data slab\n"); if (ll_async_page_slab) { - rc = kmem_cache_destroy(ll_async_page_slab); + rc = cfs_mem_cache_destroy(ll_async_page_slab); LASSERTF(rc == 0, "couldn't destroy ll_async_page slab\n"); } diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 6323817..dc02592 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -35,7 +35,7 @@ #include #include "llite_internal.h" -static kmem_cache_t *ll_inode_cachep; +static cfs_mem_cache_t *ll_inode_cachep; static struct inode *ll_alloc_inode(struct super_block *sb) { @@ -57,21 +57,11 @@ static void ll_destroy_inode(struct inode *inode) OBD_SLAB_FREE(ptr, ll_inode_cachep, sizeof(*ptr)); } -static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) -{ - struct ll_inode_info *lli = foo; - - if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == - SLAB_CTOR_CONSTRUCTOR) - inode_init_once(&lli->lli_vfs_inode); -} - int ll_init_inodecache(void) { - ll_inode_cachep = kmem_cache_create("lustre_inode_cache", - sizeof(struct ll_inode_info), - 0, SLAB_HWCACHE_ALIGN, - init_once, NULL); + ll_inode_cachep = cfs_mem_cache_create("lustre_inode_cache", + sizeof(struct ll_inode_info), + 0, SLAB_HWCACHE_ALIGN); if (ll_inode_cachep == NULL) return -ENOMEM; return 0; @@ -79,14 +69,10 @@ int ll_init_inodecache(void) void ll_destroy_inodecache(void) { -#ifdef HAVE_KMEM_CACHE_DESTROY_INT int rc; - - rc = kmem_cache_destroy(ll_inode_cachep); + + rc = cfs_mem_cache_destroy(ll_inode_cachep); LASSERTF(rc == 0, "ll_inode_cache: not all structures were freed\n"); -#else - kmem_cache_destroy(ll_inode_cachep); -#endif } /* exported operations */ @@ -115,9 +101,9 @@ static int __init init_lustre_lite(void) rc = ll_init_inodecache(); if (rc) return -ENOMEM; - ll_file_data_slab = kmem_cache_create("ll_file_data", - sizeof(struct ll_file_data), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); + ll_file_data_slab = cfs_mem_cache_create("ll_file_data", + sizeof(struct ll_file_data), 0, + SLAB_HWCACHE_ALIGN); if (ll_file_data_slab == NULL) { ll_destroy_inodecache(); return -ENOMEM; @@ -152,9 +138,7 @@ static int __init init_lustre_lite(void) static void __exit exit_lustre_lite(void) { -#ifdef HAVE_KMEM_CACHE_DESTROY_INT int rc; -#endif lustre_register_client_fill_super(NULL); lustre_register_client_process_config(NULL); @@ -162,19 +146,12 @@ static void __exit exit_lustre_lite(void) ll_unregister_cache(&ll_cache_definition); ll_destroy_inodecache(); -#ifdef HAVE_KMEM_CACHE_DESTROY_INT - rc = kmem_cache_destroy(ll_file_data_slab); + rc = cfs_mem_cache_destroy(ll_file_data_slab); LASSERTF(rc == 0, "couldn't destroy ll_file_data slab\n"); -#else - kmem_cache_destroy(ll_file_data_slab); -#endif + if (ll_async_page_slab) { -#ifdef HAVE_KMEM_CACHE_DESTROY_INT - rc = kmem_cache_destroy(ll_async_page_slab); + rc = cfs_mem_cache_destroy(ll_async_page_slab); LASSERTF(rc == 0, "couldn't destroy ll_async_page slab\n"); -#else - kmem_cache_destroy(ll_async_page_slab); -#endif } if (proc_lustre_fs_root) diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 90c92ac..e84cd05 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -77,7 +77,7 @@ #define fsfilt_ext3_journal_stop(handle) ext3_journal_stop(handle) #endif -static kmem_cache_t *fcb_cache; +static cfs_mem_cache_t *fcb_cache; struct fsfilt_cb_data { struct journal_callback cb_jcb; /* jbd private data - MUST BE FIRST */ @@ -2113,9 +2113,8 @@ static int __init fsfilt_ext3_init(void) { int rc; - fcb_cache = kmem_cache_create("fsfilt_ext3_fcb", - sizeof(struct fsfilt_cb_data), 0, - 0, NULL, NULL); + fcb_cache = cfs_mem_cache_create("fsfilt_ext3_fcb", + sizeof(struct fsfilt_cb_data), 0, 0); if (!fcb_cache) { CERROR("error allocating fsfilt journal callback cache\n"); GOTO(out, rc = -ENOMEM); @@ -2124,7 +2123,7 @@ static int __init fsfilt_ext3_init(void) rc = fsfilt_register_ops(&fsfilt_ext3_ops); if (rc) { - int err = kmem_cache_destroy(fcb_cache); + int err = cfs_mem_cache_destroy(fcb_cache); LASSERTF(err == 0, "error destroying new cache: rc %d\n", err); } out: @@ -2136,7 +2135,7 @@ static void __exit fsfilt_ext3_exit(void) int rc; fsfilt_unregister_ops(&fsfilt_ext3_ops); - rc = kmem_cache_destroy(fcb_cache); + rc = cfs_mem_cache_destroy(fcb_cache); LASSERTF(rc == 0, "couldn't destroy fcb_cache slab\n"); } diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index b2c17e8..9b3790a 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -518,20 +518,21 @@ int obd_init_caches(void) LASSERT(obd_device_cachep == NULL); obd_device_cachep = cfs_mem_cache_create("ll_obd_dev_cache", - sizeof(struct obd_device), 0, 0); + sizeof(struct obd_device), + 0, 0); if (!obd_device_cachep) GOTO(out, -ENOMEM); LASSERT(obdo_cachep == NULL); obdo_cachep = cfs_mem_cache_create("ll_obdo_cache", sizeof(struct obdo), - 0, 0); + 0, 0); if (!obdo_cachep) GOTO(out, -ENOMEM); LASSERT(import_cachep == NULL); import_cachep = cfs_mem_cache_create("ll_import_cache", - sizeof(struct obd_import), - 0, 0); + sizeof(struct obd_import), + 0, 0); if (!import_cachep) GOTO(out, -ENOMEM); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index f066f76..2cd555c 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -64,7 +64,7 @@ #include "filter_internal.h" static struct lvfs_callback_ops filter_lvfs_ops; -kmem_cache_t *ll_fmd_cachep; +cfs_mem_cache_t *ll_fmd_cachep; static void filter_commit_cb(struct obd_device *obd, __u64 transno, void *cb_data, int error) @@ -3454,9 +3454,9 @@ static int __init obdfilter_init(void) if (obdfilter_created_scratchpad == NULL) return -ENOMEM; - ll_fmd_cachep = kmem_cache_create("ll_fmd_cache", - sizeof(struct filter_mod_data), - 0, 0, NULL, NULL); + ll_fmd_cachep = cfs_mem_cache_create("ll_fmd_cache", + sizeof(struct filter_mod_data), + 0, 0); if (!ll_fmd_cachep) GOTO(out, rc = -ENOMEM); @@ -3468,7 +3468,7 @@ static int __init obdfilter_init(void) if (rc) { int err; - err = kmem_cache_destroy(ll_fmd_cachep); + err = cfs_mem_cache_destroy(ll_fmd_cachep); LASSERTF(err == 0, "Cannot destroy ll_fmd_cachep: rc %d\n",err); ll_fmd_cachep = NULL; out: @@ -3489,7 +3489,7 @@ static void __exit obdfilter_exit(void) PORTAL_SYMBOL_PUT(filter_quota_interface); if (ll_fmd_cachep) { - int rc = kmem_cache_destroy(ll_fmd_cachep); + int rc = cfs_mem_cache_destroy(ll_fmd_cachep); LASSERTF(rc == 0, "Cannot destroy ll_fmd_cachep: rc %d\n", rc); ll_fmd_cachep = NULL; } diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 84e413d..2033971 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -36,7 +36,7 @@ unsigned long default_btune_ratio = 50; /* 50 percentage */ unsigned long default_iunit_sz = 5000; /* 5000 inodes */ unsigned long default_itune_ratio = 50; /* 50 percentage */ -kmem_cache_t *qunit_cachep = NULL; +cfs_mem_cache_t *qunit_cachep = NULL; struct list_head qunit_hash[NR_DQHASH]; spinlock_t qunit_hash_lock = SPIN_LOCK_UNLOCKED; @@ -71,13 +71,9 @@ void qunit_cache_cleanup(void) spin_unlock(&qunit_hash_lock); if (qunit_cachep) { -#ifdef HAVE_KMEM_CACHE_DESTROY_INT int rc; - rc = kmem_cache_destroy(qunit_cachep); + rc = cfs_mem_cache_destroy(qunit_cachep); LASSERTF(rc == 0, "couldn't destory qunit_cache slab\n"); -#else - kmem_cache_destroy(qunit_cachep); -#endif qunit_cachep = NULL; } EXIT; @@ -89,9 +85,9 @@ int qunit_cache_init(void) ENTRY; LASSERT(qunit_cachep == NULL); - qunit_cachep = kmem_cache_create("ll_qunit_cache", - sizeof(struct lustre_qunit), - 0, 0, NULL, NULL); + qunit_cachep = cfs_mem_cache_create("ll_qunit_cache", + sizeof(struct lustre_qunit), + 0, 0); if (!qunit_cachep) RETURN(-ENOMEM); diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 5c915f4..df60c3b 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -656,8 +656,8 @@ int osc_quota_init(void) LASSERT(qinfo_cachep == NULL); qinfo_cachep = cfs_mem_cache_create("osc_quota_info", - sizeof(struct osc_quota_info), - 0, 0); + sizeof(struct osc_quota_info), + 0, 0); if (!qinfo_cachep) RETURN(-ENOMEM); diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index b435225..40b359a 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -39,7 +39,7 @@ static struct list_head lustre_dquot_hash[NR_DQHASH]; static spinlock_t dquot_hash_lock = SPIN_LOCK_UNLOCKED; -kmem_cache_t *lustre_dquot_cachep; +cfs_mem_cache_t *lustre_dquot_cachep; int lustre_dquot_init(void) { @@ -47,9 +47,9 @@ int lustre_dquot_init(void) ENTRY; LASSERT(lustre_dquot_cachep == NULL); - lustre_dquot_cachep = kmem_cache_create("lustre_dquot_cache", - sizeof(struct lustre_dquot), - 0, 0, NULL, NULL); + lustre_dquot_cachep = cfs_mem_cache_create("lustre_dquot_cache", + sizeof(struct lustre_dquot), + 0, 0); if (!lustre_dquot_cachep) return (-ENOMEM); @@ -69,13 +69,9 @@ void lustre_dquot_exit(void) LASSERT(list_empty(lustre_dquot_hash + i)); } if (lustre_dquot_cachep) { -#ifdef HAVE_KMEM_CACHE_DESTROY_INT int rc; - rc = kmem_cache_destroy(lustre_dquot_cachep); + rc = cfs_mem_cache_destroy(lustre_dquot_cachep); LASSERTF(rc == 0,"couldn't destroy lustre_dquot_cachep slab\n"); -#else - kmem_cache_destroy(lustre_dquot_cachep); -#endif lustre_dquot_cachep = NULL; } EXIT;