From f4f23d51a6dec0a1388cda6870a74193fc070396 Mon Sep 17 00:00:00 2001 From: johann Date: Fri, 5 Dec 2008 15:13:39 +0000 Subject: [PATCH] Branch b1_8_gate b=17490 i=bzzz i=kalpak correctly handle device paths using a subdirectory in /dev when creating the per-device procfs directory under /proc/fs/ldiskfs. --- .../patches/ext3-mballoc3-core.patch | 87 ++++++++++++++-------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch b/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch index 7a26701..fa8b4ae 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch @@ -1,8 +1,8 @@ -Index: linux-2.6.18-53.1.21/include/linux/ext3_fs.h +Index: linux-2.6.22.19/include/linux/ext3_fs.h =================================================================== ---- linux-2.6.18-53.1.21.orig/include/linux/ext3_fs.h -+++ linux-2.6.18-53.1.21/include/linux/ext3_fs.h -@@ -53,6 +53,31 @@ +--- linux-2.6.22.19.orig/include/linux/ext3_fs.h ++++ linux-2.6.22.19/include/linux/ext3_fs.h +@@ -54,6 +54,31 @@ #define ext3_debug(f, a...) do {} while (0) #endif @@ -34,7 +34,7 @@ Index: linux-2.6.18-53.1.21/include/linux/ext3_fs.h /* * Special inodes numbers */ -@@ -398,6 +423,14 @@ struct ext3_inode { +@@ -412,6 +437,14 @@ struct ext3_inode { #define ext3_find_first_zero_bit ext2_find_first_zero_bit #define ext3_find_next_zero_bit ext2_find_next_zero_bit @@ -49,7 +49,7 @@ Index: linux-2.6.18-53.1.21/include/linux/ext3_fs.h /* * Maximal mount counts between two filesystem checks */ -@@ -799,6 +832,20 @@ extern unsigned long ext3_count_dirs (st +@@ -813,6 +846,20 @@ extern unsigned long ext3_count_dirs (st extern void ext3_check_inodes_bitmap (struct super_block *); extern unsigned long ext3_count_free (struct buffer_head *, unsigned); @@ -70,7 +70,7 @@ Index: linux-2.6.18-53.1.21/include/linux/ext3_fs.h /* inode.c */ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, -@@ -843,6 +890,10 @@ extern int ext3_group_extend(struct supe +@@ -859,6 +906,10 @@ extern int ext3_group_extend(struct supe ext3_fsblk_t n_blocks_count); /* super.c */ @@ -81,10 +81,10 @@ Index: linux-2.6.18-53.1.21/include/linux/ext3_fs.h extern void ext3_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); extern void __ext3_std_error (struct super_block *, const char *, int); -Index: linux-2.6.18-53.1.21/include/linux/ext3_fs_sb.h +Index: linux-2.6.22.19/include/linux/ext3_fs_sb.h =================================================================== ---- linux-2.6.18-53.1.21.orig/include/linux/ext3_fs_sb.h -+++ linux-2.6.18-53.1.21/include/linux/ext3_fs_sb.h +--- linux-2.6.22.19.orig/include/linux/ext3_fs_sb.h ++++ linux-2.6.22.19/include/linux/ext3_fs_sb.h @@ -88,6 +88,68 @@ struct ext3_sb_info { unsigned long s_ext_blocks; unsigned long s_ext_extents; @@ -154,11 +154,11 @@ Index: linux-2.6.18-53.1.21/include/linux/ext3_fs_sb.h + [(group) & (EXT3_DESC_PER_BLOCK(sb) - 1)] + #endif /* _LINUX_EXT3_FS_SB */ -Index: linux-2.6.18-53.1.21/fs/ext3/super.c +Index: linux-2.6.22.19/fs/ext3/super.c =================================================================== ---- linux-2.6.18-53.1.21.orig/fs/ext3/super.c -+++ linux-2.6.18-53.1.21/fs/ext3/super.c -@@ -391,6 +391,7 @@ static void ext3_put_super (struct super +--- linux-2.6.22.19.orig/fs/ext3/super.c ++++ linux-2.6.22.19/fs/ext3/super.c +@@ -392,6 +392,7 @@ static void ext3_put_super (struct super struct ext3_super_block *es = sbi->s_es; int i; @@ -166,16 +166,18 @@ Index: linux-2.6.18-53.1.21/fs/ext3/super.c ext3_ext_release(sb); ext3_xattr_put_super(sb); journal_destroy(sbi->s_journal); -@@ -433,6 +434,8 @@ static void ext3_put_super (struct super - invalidate_bdev(sbi->journal_bdev, 0); +@@ -434,6 +435,10 @@ static void ext3_put_super (struct super + invalidate_bdev(sbi->journal_bdev); ext3_blkdev_remove(sbi); } -+ remove_proc_entry(sb->s_id, proc_root_ext3); -+ sbi->s_dev_proc = NULL; ++ if (sbi->s_dev_proc) { ++ remove_proc_entry(sbi->s_dev_proc->name, proc_root_ext3); ++ sbi->s_dev_proc = NULL; ++ } sb->s_fs_info = NULL; kfree(sbi); return; -@@ -458,6 +461,8 @@ static struct inode *ext3_alloc_inode(st +@@ -459,6 +464,8 @@ static struct inode *ext3_alloc_inode(st ei->vfs_inode.i_version = 1; memset(&ei->i_cached_extent, 0, sizeof(ei->i_cached_extent)); @@ -184,30 +186,49 @@ Index: linux-2.6.18-53.1.21/fs/ext3/super.c return &ei->vfs_inode; } -@@ -1454,6 +1459,13 @@ static int ext3_fill_super (struct super +@@ -1434,6 +1441,7 @@ static int ext3_fill_super (struct super + unsigned long journal_devnum = 0; + unsigned long def_mount_opts; + struct inode *root; ++ char *devname; + int blocksize; + int hblock; + int db_count; +@@ -1448,6 +1456,22 @@ static int ext3_fill_super (struct super sbi->s_mount_opt = 0; sbi->s_resuid = EXT3_DEF_RESUID; sbi->s_resgid = EXT3_DEF_RESGID; -+ sbi->s_dev_proc = proc_mkdir(sb->s_id, proc_root_ext3); -+ if (sbi->s_dev_proc == NULL) { -+ printk(KERN_ERR "EXT3-fs: Unable to create %s\n", sb->s_id); -+ sb->s_fs_info = NULL; -+ kfree(sbi); -+ return -ENOMEM; ++ devname = kstrdup(sb->s_id, GFP_KERNEL); ++ if (devname) { ++ char *p = devname; ++ while ((p = strchr(p, '/'))) ++ *p = '!'; ++ sbi->s_dev_proc = proc_mkdir(devname, proc_root_ext3); ++ if (sbi->s_dev_proc == NULL) ++ printk(KERN_WARNING "EXT3-fs warning: unable to create " ++ "procfs entry for %s(%s)\n", ++ sb->s_id, devname); ++ kfree(devname); ++ } else { ++ printk(KERN_WARNING "EXT3-fs warning: cannot allocate memory " ++ "to create procfs entry for %s\n", ++ sb->s_id); + } unlock_kernel(); -@@ -1857,6 +1869,8 @@ failed_mount: +@@ -1857,6 +1881,10 @@ failed_mount: ext3_blkdev_remove(sbi); brelse(bh); out_fail: -+ remove_proc_entry(sb->s_id, proc_root_ext3); -+ sbi->s_dev_proc = NULL; ++ if (sbi->s_dev_proc) { ++ remove_proc_entry(sbi->s_dev_proc->name, proc_root_ext3); ++ sbi->s_dev_proc = NULL; ++ } sb->s_fs_info = NULL; kfree(sbi); lock_kernel(); -@@ -2782,9 +2796,46 @@ static struct file_system_type ext3_fs_t +@@ -2787,9 +2815,46 @@ static struct file_system_type ext3_fs_t .fs_flags = FS_REQUIRES_DEV, }; @@ -255,7 +276,7 @@ Index: linux-2.6.18-53.1.21/fs/ext3/super.c if (err) return err; err = init_inodecache(); -@@ -2806,6 +2857,7 @@ static void __exit exit_ext3_fs(void) +@@ -2811,6 +2876,7 @@ static void __exit exit_ext3_fs(void) unregister_filesystem(&ext3_fs_type); destroy_inodecache(); exit_ext3_xattr(); @@ -263,10 +284,10 @@ Index: linux-2.6.18-53.1.21/fs/ext3/super.c } int ext3_map_inode_page(struct inode *inode, struct page *page, -Index: linux-2.6.18-53.1.21/fs/ext3/mballoc.c +Index: linux-2.6.22.19/fs/ext3/mballoc.c =================================================================== --- /dev/null -+++ linux-2.6.18-53.1.21/fs/ext3/mballoc.c ++++ linux-2.6.22.19/fs/ext3/mballoc.c @@ -0,0 +1,4475 @@ +/* + * Copyright 2008 Sun Microsystems, Inc. -- 1.8.3.1