All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create()
Date: Fri Dec 21 11:47:35 2007	[thread overview]
Message-ID: <20071221194559.GE13171@mail.oracle.com> (raw)
In-Reply-To: <1198193387-16606-10-git-send-email-sunil.mushran@oracle.com>

On Thu, Dec 20, 2007 at 03:29:28PM -0800, Sunil Mushran wrote:
> Commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg
> from kmem_cache_create(). This patch allows one to build ocfs2 with
> kernels having/not having this change.

	I desperately want to come up with a trick here that will leave
"kmem_cache_create()" in the source, but I can't think of one.  This is
probably as good as we're going to get.

Joel
 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in             |    1 +
>  Makefile                   |    3 ++-
>  configure.in               |    6 ++++++
>  fs/ocfs2/Makefile          |    4 ++++
>  fs/ocfs2/dlm/Makefile      |    4 ++++
>  fs/ocfs2/dlm/dlmfs.c       |    2 +-
>  fs/ocfs2/dlm/dlmmaster.c   |    2 +-
>  fs/ocfs2/super.c           |    2 +-
>  fs/ocfs2/uptodate.c        |    2 +-
>  kapi-compat/include/slab.h |   10 ++++++++++
>  10 files changed, 31 insertions(+), 5 deletions(-)
>  create mode 100644 kapi-compat/include/slab.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index 4f42cca..07c5a86 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -61,6 +61,7 @@ DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>  
>  HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
>  HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
> +KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index 2a97e00..ae5947b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/fpath.h \
>  	kapi-compat/include/kmod.h \
>  	kapi-compat/include/inc_nlink.h \
> -	kapi-compat/include/drop_nlink.h
> +	kapi-compat/include/drop_nlink.h \
> +	kapi-compat/include/slab.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 81041fb..cb91de1 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -198,6 +198,12 @@ OCFS2_CHECK_KERNEL([drop_nlink() in fs.h], fs.h,
>    , drop_nlink_compat_header="drop_nlink.h", [^static inline void drop_nlink(])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $drop_nlink_compat_header"
>  
> +KMEM_CACHE_CREATE_DTOR=
> +OCFS2_CHECK_KERNEL([kmem_cache_create() with dtor arg in slab.h], slab.h,
> +  KMEM_CACHE_CREATE_DTOR=yes, , [^.*void (\*)(void \*, kmem_cache_t \*, unsigned long),])
> +AC_SUBST(KMEM_CACHE_CREATE_DTOR)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS slab.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index b6c8d03..403c1c6 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -37,6 +37,10 @@ ifdef HAS_F_PATH_DEFINED
>  EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
>  endif
>  
> +ifdef KMEM_CACHE_CREATE_DTOR
> +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
> index b4fb8e3..628ab3d 100644
> --- a/fs/ocfs2/dlm/Makefile
> +++ b/fs/ocfs2/dlm/Makefile
> @@ -20,6 +20,10 @@ ifdef DELAYED_WORK_DEFINED
>  EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
>  endif
>  
> +ifdef KMEM_CACHE_CREATE_DTOR
> +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
> +endif
> +
>  DLM_SOURCES =			\
>  	dlmast.c		\
>  	dlmconvert.c		\
> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
> index 4ce2dea..dc43923 100644
> --- a/fs/ocfs2/dlm/dlmfs.c
> +++ b/fs/ocfs2/dlm/dlmfs.c
> @@ -588,7 +588,7 @@ static int __init init_dlmfs_fs(void)
>  
>  	dlmfs_print_version();
>  
> -	dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
> +	dlmfs_inode_cache = kapi_kmem_cache_create("dlmfs_inode_cache",
>  				sizeof(struct dlmfs_inode_private),
>  				0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
>  					SLAB_MEM_SPREAD),
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 62e4a7d..a668840 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -507,7 +507,7 @@ static void dlm_mle_node_up(struct dlm_ctxt *dlm,
>  
>  int dlm_init_mle_cache(void)
>  {
> -	dlm_mle_cache = kmem_cache_create("dlm_mle_cache",
> +	dlm_mle_cache = kapi_kmem_cache_create("dlm_mle_cache",
>  					  sizeof(struct dlm_master_list_entry),
>  					  0, SLAB_HWCACHE_ALIGN,
>  					  NULL);
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index a8f90a2..f5c424d 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -1033,7 +1033,7 @@ static void ocfs2_inode_init_once(void *data,
>  
>  static int ocfs2_initialize_mem_caches(void)
>  {
> -	ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache",
> +	ocfs2_inode_cachep = kapi_kmem_cache_create("ocfs2_inode_cache",
>  				       sizeof(struct ocfs2_inode_info),
>  				       0,
>  				       (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
> diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
> index 4da8851..6248308 100644
> --- a/fs/ocfs2/uptodate.c
> +++ b/fs/ocfs2/uptodate.c
> @@ -546,7 +546,7 @@ void ocfs2_remove_from_cache(struct inode *inode,
>  
>  int __init init_ocfs2_uptodate_cache(void)
>  {
> -	ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate",
> +	ocfs2_uptodate_cachep = kapi_kmem_cache_create("ocfs2_uptodate",
>  				  sizeof(struct ocfs2_meta_cache_item),
>  				  0, SLAB_HWCACHE_ALIGN, NULL);
>  	if (!ocfs2_uptodate_cachep)
> diff --git a/kapi-compat/include/slab.h b/kapi-compat/include/slab.h
> new file mode 100644
> index 0000000..239763f
> --- /dev/null
> +++ b/kapi-compat/include/slab.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_SLAB_H
> +#define KAPI_SLAB_H
> +
> +#ifdef KMEM_CACHE_CREATE_DTOR
> +#define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e, NULL)
> +#else
> +#define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e)
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Any man who is under 30, and is not a liberal, has not heart;
 and any man who is over 30, and is not a conservative, has no brains."
         - Sir Winston Churchill 

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2007-12-21 11:47 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
2007-12-21  1:09   ` Joel Becker
2007-12-21  9:41     ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
2007-12-21 15:12   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
2007-12-24 13:32   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
2007-12-21 11:39   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
2007-12-21  0:56   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
2007-12-21  0:54   ` Joel Becker
2007-12-21  9:39     ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
2007-12-22  3:51   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
2007-12-24 13:30   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
2007-12-21 11:59   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
2007-12-22  3:51   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
2007-12-21 15:10   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
2007-12-24 13:30   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
2007-12-24 13:21   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
2007-12-21 11:47   ` Joel Becker [this message]
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
2007-12-21 15:10   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
2007-12-24 13:23   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
2007-12-21  0:56   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
2007-12-21 11:57   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
2007-12-21 11:57   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
2007-12-21 11:37   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
2007-12-21  0:54   ` Joel Becker
2007-12-21 11:51     ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
2007-12-21 11:39   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
2007-12-24 13:23   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
2007-12-21 15:14   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
2007-12-21 15:12   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
2007-12-21 12:00   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-24 13:28   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
2007-12-21 11:55   ` Joel Becker

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=20071221194559.GE13171@mail.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.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.