Slab cache name fixes / reiserfs boot bug fix.

Slab cache name fixes / reiserfs boot bug fix.

Post by Linus Torvald » Fri, 01 Feb 2002 09:00:16




> Patch against 2.5.3. Please apply.

Plase make some of the uglier stuff a bit cleaner.

For example:

Quote:>  static const int bvec_pool_sizes[BIOVEC_NR_POOLS] = { 1, 4, 16, 64, 128, 256 };
> +static char bvec_pool_names[BIOVEC_NR_POOLS][16];

together with a sprintf for constant strings just looks uglee.

Why not just do

        #define VEC(x)  { x, "biovec-" #x }
        static const struct {
                int size, char *name;
        } bvec_pools[BIOVEC_NR_POOLS] = {
                VEC(1), VEC(4), VEC(16),
                VEC(64), VEC(128), VEC(256)
        };

and then register them with a nice

        for (i = 0; i < BIOVEC_NR_POOLS; i++) {
                bp->slab = kmem_cache_create(
                        bvec_pools[i].name,
                        bvec_pools[i].size,
                ...

which is just simpler and doesn't have issues like fixed 16-byte arrays
etc.

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. Fix 2.5.3pre reiserfs BUG() at boot time

[resent because t-offline's outgoing mail server seems to be eating/
not delivering mail. sorry if it appears multiple times]

This patch fixes an reiserfs BUG() at boot time introduced by the
inode cleanups. The problem is that it passes a 20 char name to
kmem_cache_create() ("reiserfs_inode_cache") but kmem_cache_create()
only allows 19 character names and BUG()s for longer names.

The patch fixes this in a low tech approach.  It's required to boot
a 2.5.3preX machine with reiserfs compiled in.

-Andi

Index: fs/reiserfs/super.c
===================================================================
RCS file: /cvs/linux/fs/reiserfs/super.c,v
retrieving revision 1.17
diff -u -u -r1.17 super.c
--- fs/reiserfs/super.c 2002/01/24 14:07:54     1.17

 static int init_inodecache(void)
 {
-       reiserfs_inode_cachep = kmem_cache_create("reiserfs_inode_cache",
+       reiserfs_inode_cachep = kmem_cache_create("reiser_inode_cache",
                                             sizeof(struct reiserfs_inode_info),
                                             0, SLAB_HWCACHE_ALIGN,
                                             init_once, NULL);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. Math with exponential notation

3. [PATCH] ReiserFS Attempt 3: fix reiserfs memleaks on journal opening failures in 2.5.64

4. T3 identification

5. Sending #2: ReiserFS: fix reiserfs memleaks on journal opening failures in 2.5.64

6. udp socket message size

7. ReiserFS bug fixes

8. Unix - Frequently Asked Questions (Contents) [Frequent posting]

9. ReiserFS Bug Fixes 3 of 6 (Please apply all 6)

10. ReiserFS Bug Fixes 2 of 6

11. fix slab allocator for non zero boot cpu

12. ReiserFS file write bug fix for 2.4

13. PATCH: fix ALi 32bitisms, fix ALi FIFO, fix ALi IRQ crash