]> git.pld-linux.org Git - packages/shfs.git/blame - shfs-kmem_cache.patch
- drop userspace dep on kernel
[packages/shfs.git] / shfs-kmem_cache.patch
CommitLineData
f0c36396 1diff -urp shfs-0.35./shfs/Linux-2.6/fcache.c shfs-0.35/shfs/Linux-2.6/fcache.c
2--- shfs-0.35./shfs/Linux-2.6/fcache.c 2008-03-09 02:36:50.429634000 +0100
3+++ shfs-0.35/shfs/Linux-2.6/fcache.c 2008-03-09 03:26:46.223740971 +0100
4@@ -29,12 +29,16 @@ struct shfs_file {
5 char *data;
6 };
7
8-kmem_cache_t *file_cache = NULL;
9+struct kmem_cache *file_cache = NULL;
10
11 void
12 fcache_init(void)
13 {
14+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
15 file_cache = kmem_cache_create("shfs_file", sizeof(struct shfs_file), 0, 0, NULL, NULL);
16+#else
3e018e8e 17+ file_cache = kmem_cache_create("shfs_file", sizeof(struct shfs_file), 0, SLAB_HWCACHE_ALIGN, NULL);
f0c36396 18+#endif
19 DEBUG("file_cache: %p\n", file_cache);
20 }
21
f0c36396 22diff -urp shfs-0.35./shfs/Linux-2.6/inode.c shfs-0.35/shfs/Linux-2.6/inode.c
23--- shfs-0.35./shfs/Linux-2.6/inode.c 2008-03-09 02:36:50.429634000 +0100
24+++ shfs-0.35/shfs/Linux-2.6/inode.c 2008-03-09 03:26:23.725287472 +0100
25@@ -30,7 +30,7 @@ int debug_level;
26 unsigned long alloc;
27 #endif
28
29-kmem_cache_t *inode_cache = NULL;
30+struct kmem_cache *inode_cache = NULL;
31
32 void
33 shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr)
3e018e8e 34@@ -67,7 +67,11 @@ shfs_set_inode_attr(struct inode *inode,
35
36 if (!timespec_equal(&inode->i_mtime, &last_time) || inode->i_size != last_size) {
37 DEBUG("inode changed (%ld/%ld, %lu/%lu)\n", inode->i_mtime.tv_sec, last_time.tv_sec, (unsigned long)inode->i_size, (unsigned long)last_size);
38+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
39+ invalidate_mapping_pages(inode->i_mapping, 0, -1);
40+#else
41 invalidate_inode_pages(inode->i_mapping);
42+#endif
43 fcache_file_clear(inode);
44 }
45 }
46@@ -176,7 +180,11 @@ shfs_refresh_inode(struct dentry *dentry
47 * But we do want to invalidate the caches ...
48 */
49 if (!S_ISDIR(inode->i_mode))
50+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
51+ invalidate_mapping_pages(inode->i_mapping, 0, -1);
52+#else
53 invalidate_inode_pages(inode->i_mapping);
54+#endif
55 else
56 shfs_invalid_dir_cache(inode);
57 result = -EIO;
f0c36396 58@@ -388,8 +388,12 @@ init_shfs(void)
59 {
60 printk(KERN_NOTICE "SHell File System, (c) 2002-2004 Miroslav Spousta\n");
61 fcache_init();
62+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
63 inode_cache = kmem_cache_create("shfs_inode", sizeof(struct shfs_inode_info), 0, 0, NULL, NULL);
64-
65+#else
3e018e8e 66+ inode_cache = kmem_cache_create("shfs_inode", sizeof(struct shfs_inode_info), 0, SLAB_HWCACHE_ALIGN, NULL);
f0c36396 67+#endif
68+
69 debug_level = 0;
70 #ifdef ENABLE_DEBUG
71 alloc = 0;
f0c36396 72diff -urp shfs-0.35./shfs/Linux-2.6/shfs_debug.h shfs-0.35/shfs/Linux-2.6/shfs_debug.h
73--- shfs-0.35./shfs/Linux-2.6/shfs_debug.h 2004-06-01 15:16:19.000000000 +0200
74+++ shfs-0.35/shfs/Linux-2.6/shfs_debug.h 2008-03-09 03:20:49.748240839 +0100
75@@ -19,7 +19,7 @@ extern int debug_level;
76 extern unsigned long alloc;
77
78 static inline void *
79-__kmem_malloc_debug(char *s, kmem_cache_t *cache, int flags)
80+__kmem_malloc_debug(char *s, struct kmem_cache *cache, int flags)
81 {
82 if (debug_level >= SHFS_ALLOC) {
83 void *x = kmem_cache_alloc(cache, flags);
84@@ -32,7 +32,7 @@ __kmem_malloc_debug(char *s, kmem_cache_
85 }
86
87 static inline void
88-__kmem_free_debug(char *s, kmem_cache_t *cache, void *p)
89+__kmem_free_debug(char *s, struct kmem_cache *cache, void *p)
90 {
91 if (debug_level >= SHFS_ALLOC) {
92 VERBOSE("free (%s): %p\n", s, p);
93diff -urp shfs-0.35./shfs/Linux-2.6/shfs_fs.h shfs-0.35/shfs/Linux-2.6/shfs_fs.h
94--- shfs-0.35./shfs/Linux-2.6/shfs_fs.h 2008-03-09 02:36:50.429634000 +0100
95+++ shfs-0.35/shfs/Linux-2.6/shfs_fs.h 2008-03-09 03:20:49.748240839 +0100
96@@ -73,10 +73,10 @@ int shfs_fill_cache(struct file*, void*,
97
98 /* shfs/fcache.c */
99 #include <linux/slab.h>
100-extern kmem_cache_t *file_cache;
101-extern kmem_cache_t *dir_head_cache;
102-extern kmem_cache_t *dir_entry_cache;
103-extern kmem_cache_t *dir_name_cache;
104+extern struct kmem_cache *file_cache;
105+extern struct kmem_cache *dir_head_cache;
106+extern struct kmem_cache *dir_entry_cache;
107+extern struct kmem_cache *dir_name_cache;
108 void fcache_init(void);
109 void fcache_finish(void);
110 int fcache_file_open(struct file*);
This page took 0.090492 seconds and 4 git commands to generate.