From 86d4fdef3d57e265d2f80c9981dd3deecc5477be Mon Sep 17 00:00:00 2001 From: shadow Date: Wed, 22 Apr 2009 18:03:59 +0000 Subject: [PATCH] allocate inodes for llog files in last inodes group, for avoid broking recovery. Branch HEAD b=18192 i=adilger i=shadow i=girish --- ldiskfs/ChangeLog | 6 + .../patches/alloc-policy-2.6-rhlel5.diff | 122 +++++++++++++++++++++ .../kernel_patches/series/ldiskfs-2.6-rhel4.series | 1 + .../kernel_patches/series/ldiskfs-2.6-rhel5.series | 1 + .../series/ldiskfs-2.6-sles10.series | 1 + .../kernel_patches/series/ldiskfs-2.6-suse.series | 1 + .../series/ldiskfs-2.6.18-vanilla.series | 1 + .../series/ldiskfs-2.6.22-vanilla.series | 1 + 8 files changed, 134 insertions(+) create mode 100644 ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.diff diff --git a/ldiskfs/ChangeLog b/ldiskfs/ChangeLog index 5822805..851b0e7 100644 --- a/ldiskfs/ChangeLog +++ b/ldiskfs/ChangeLog @@ -7,6 +7,12 @@ Bugzilla : Description: Details : +Severity : minor +Frequency : in recovery +Bugzilla : 18192 +Description: don't mix llog inodes with normal. +Details : allocate inodes for log in last inode group + ------------------------------------------------------------------------------- 2009-04-20 Sun Microsystems, Inc. diff --git a/ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.diff b/ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.diff new file mode 100644 index 0000000..381a3c7 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.diff @@ -0,0 +1,122 @@ +diff -rp ldiskfs/linux-stage/fs/ext3/ialloc.c ldiskfs.new/linux-stage/fs/ext3/ialloc.c +*** linux-stage/fs/ext3/ialloc.c 2009-04-10 08:44:23.000000000 +0300 +--- linux-stage/fs/ext3/ialloc.c 2009-04-10 08:39:37.000000000 +0300 +*************** fail_drop: +*** 821,826 **** +--- 821,856 ---- + return ERR_PTR(err); + } + ++ unsigned long ext3_find_reverse(struct super_block *sb) ++ { ++ struct ext3_group_desc *desc; ++ struct buffer_head *bitmap_bh = NULL; ++ int group; ++ unsigned long ino, offset; ++ ++ for (offset = (EXT3_INODES_PER_GROUP(sb) >> 1); offset >= 0; ++ offset >>= 1) { ++ for (group = EXT3_SB(sb)->s_groups_count - 1; group >= 0; ++ --group) { ++ desc = ext3_get_group_desc(sb, group, NULL); ++ if (desc->bg_free_inodes_count == 0) ++ continue; ++ ++ bitmap_bh = read_inode_bitmap(sb, group); ++ if (!bitmap_bh) ++ continue; ++ ++ ino = ext3_find_next_zero_bit((unsigned long *) ++ bitmap_bh->b_data, ++ EXT3_INODES_PER_GROUP(sb), offset); ++ if (ino < EXT3_INODES_PER_GROUP(sb)) ++ return(group * EXT3_INODES_PER_GROUP(sb) + ++ ino + 1); ++ } ++ } ++ return 0; ++ } ++ + /* Verify that we are loading a valid orphan from disk */ + struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino) + { +diff -rp ldiskfs/linux-stage/fs/ext3/namei.c ldiskfs.new/linux-stage/fs/ext3/namei.c +*** linux-stage/fs/ext3/namei.c 2009-04-10 08:44:23.000000000 +0300 +--- linux-stage/fs/ext3/namei.c 2009-04-10 08:39:37.000000000 +0300 +*************** struct dx_map_entry +*** 146,159 **** + u16 size; + }; + + #define LVFS_DENTRY_PARAM_MAGIC 20070216UL + struct lvfs_dentry_params + { +! unsigned long p_inum; +! void *p_ptr; +! u32 magic; + }; + + #ifdef CONFIG_EXT3_INDEX + static inline unsigned dx_get_block (struct dx_entry *entry); + static void dx_set_block (struct dx_entry *entry, unsigned value); +--- 146,168 ---- + u16 size; + }; + ++ /* ++ * dentry_param used by ext3_new_inode_wantedi() ++ */ + #define LVFS_DENTRY_PARAM_MAGIC 20070216UL + struct lvfs_dentry_params + { +! unsigned long ldp_inum; +! long ldp_flags; +! u32 ldp_magic; + }; + ++ /* Only use the least 3 bits of ldp_flags for goal policy */ ++ typedef enum { ++ DP_GOAL_POLICY = 0, ++ DP_LASTGROUP_REVERSE = 1, ++ } dp_policy_t; ++ + #ifdef CONFIG_EXT3_INDEX + static inline unsigned dx_get_block (struct dx_entry *entry); + static void dx_set_block (struct dx_entry *entry, unsigned value); +*************** static struct inode * ext3_new_inode_wan +*** 1752,1759 **** + if (dentry->d_fsdata != NULL) { + struct lvfs_dentry_params *param = dentry->d_fsdata; + +! if (param->magic == LVFS_DENTRY_PARAM_MAGIC) +! inum = param->p_inum; + } + return ext3_new_inode(handle, dir, mode, inum); + } +--- 1761,1773 ---- + if (dentry->d_fsdata != NULL) { + struct lvfs_dentry_params *param = dentry->d_fsdata; + +! if (param->ldp_magic == LVFS_DENTRY_PARAM_MAGIC) { +! if ((dp_policy_t)(param->ldp_flags & 0x7) == +! DP_LASTGROUP_REVERSE) +! inum = ext3_find_reverse(dir->i_sb); +! else /* DP_GOAL_POLICY */ +! inum = param->ldp_inum; +! } + } + return ext3_new_inode(handle, dir, mode, inum); + } +diff -rp ldiskfs/linux-stage/include/linux/ext3_fs.h ldiskfs.new/linux-stage/include/linux/ext3_fs.h +*** linux-stage/include/linux/ext3_fs.h 2009-04-10 08:44:23.000000000 +0300 +--- linux-stage/include/linux/ext3_fs.h 2009-04-10 08:39:37.000000000 +0300 +*************** extern int ext3fs_dirhash(const char *na +*** 977,982 **** +--- 977,983 ---- + /* ialloc.c */ + extern struct inode * ext3_new_inode (handle_t *, struct inode *, int, + unsigned long); ++ extern unsigned long ext3_find_reverse(struct super_block *); + extern void ext3_free_inode (handle_t *, struct inode *); + extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); + extern unsigned long ext3_count_free_inodes (struct super_block *); diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series index 7d8f054..fded7f5 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series @@ -30,3 +30,4 @@ ext3-check-bad-inode.patch ext3-fiemap-fix-rhel4.patch ext3-get-raid-stripe-from-sb.patch ext3-big-endian-check-2.6-rhel4.patch +alloc-policy-2.6-rhlel5.diff diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series index 330b52e..86b890d 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series @@ -26,3 +26,4 @@ ext3-xattr-no-update-ctime-2.6.22-vanilla.patch ext3-journal-chksum-2.6.18-vanilla.patch ext3-get-raid-stripe-from-sb.patch ext3-big-endian-check-2.6-rhel5.patch +alloc-policy-2.6-rhlel5.diff diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series index c6934bbd8..7db41e5 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series @@ -31,3 +31,4 @@ ext3-check-bad-inode.patch ext3-journal-chksum-2.6.18-vanilla.patch ext3-get-raid-stripe-from-sb.patch ext3-big-endian-check-2.6-sles10.patch +alloc-policy-2.6-rhlel5.diff diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series index 5e7c0f2..74bea96 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series @@ -28,3 +28,4 @@ ext3-xattr-no-update-ctime-suse.patch ext3-check-bad-inode.patch ext3-get-raid-stripe-from-sb-2.6-suse.patch ext3-big-endian-check-2.6-suse.patch +alloc-policy-2.6-rhlel5.diff diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series index cc89091..843efb8 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series @@ -23,3 +23,4 @@ ext3-max-dir-size.patch ext3-print-inum-in-htree-warning.patch ext3-xattr-no-update-ctime-2.6.22-vanilla.patch ext3-check-bad-inode.patch +alloc-policy-2.6-rhlel5.diff diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6.22-vanilla.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6.22-vanilla.series index 05ea5a4..ba4df9a 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6.22-vanilla.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6.22-vanilla.series @@ -26,3 +26,4 @@ ext3-xattr-no-update-ctime-2.6.22-vanilla.patch ext3-check-bad-inode.patch ext3-get-raid-stripe-from-sb.patch ext3-big-endian-check-2.6.22-vanilla.patch +alloc-policy-2.6-rhlel5.diff -- 1.8.3.1