Whamcloud - gitweb
Branch b_release_1_8_0
authorbobijam <bobijam>
Thu, 7 May 2009 02:51:41 +0000 (02:51 +0000)
committerbobijam <bobijam>
Thu, 7 May 2009 02:51:41 +0000 (02:51 +0000)
b=18192
i=adilger
i=shadow
i=girish

allocate inodes for llog files in last inodes group, for avoid broking
recovery.

ldiskfs/ChangeLog
ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series
ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series
ldiskfs/kernel_patches/series/ldiskfs-2.6.22-vanilla.series
lustre/include/linux/lvfs_linux.h
lustre/mds/mds_fs.c

index 9426c90..7f1c565 100644 (file)
@@ -2,6 +2,12 @@
        * version 3.0.8
 
 Severity   : minor
+Frequency  : in recovery
+Bugzilla   : 18192
+Description: don't mix llog inodes with normal.
+Details    : allocate inodes for log in last inode group
+
+Severity   : minor
 Bugzilla   : 16114
 Description: minor fixes and cleanups
 Details    : use EXT_UNSET_BLOCK to avoid confusion with EXT_MAX_BLOCK.
diff --git a/ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.patch b/ldiskfs/kernel_patches/patches/alloc-policy-2.6-rhlel5.patch
new file mode 100644 (file)
index 0000000..d2e04e5
--- /dev/null
@@ -0,0 +1,100 @@
+Index: linux-stage/fs/ext3/ialloc.c
+===================================================================
+--- linux-stage.orig/fs/ext3/ialloc.c  2009-05-07 10:04:27.000000000 +0800
++++ linux-stage/fs/ext3/ialloc.c       2009-05-07 10:07:52.000000000 +0800
+@@ -821,6 +821,36 @@
+       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)
+ {
+Index: linux-stage/fs/ext3/namei.c
+===================================================================
+--- linux-stage.orig/fs/ext3/namei.c   2009-05-07 10:04:28.000000000 +0800
++++ linux-stage/fs/ext3/namei.c        2009-05-07 10:09:35.000000000 +0800
+@@ -146,14 +146,23 @@
+       u16 size;
+ };
++/*
++ * dentry_param used by ext3_new_inode_wantedi()
++ */
+ #define LVFS_DENTRY_PARAM_MAGIC               20070216UL
+ struct lvfs_dentry_params
+ {
+-      unsigned long   p_inum;
+-      void            *p_ptr; 
+-      u32             magic;
++      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);
+@@ -1752,8 +1761,13 @@
+       if (dentry->d_fsdata != NULL) {
+               struct lvfs_dentry_params *param = dentry->d_fsdata;
+-              if (param->magic == LVFS_DENTRY_PARAM_MAGIC)
+-                      inum = param->p_inum;
++              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);
+ }
+Index: linux-stage/include/linux/ext3_fs.h
+===================================================================
+--- linux-stage.orig/include/linux/ext3_fs.h   2009-05-07 10:04:28.000000000 +0800
++++ linux-stage/include/linux/ext3_fs.h        2009-05-07 10:09:59.000000000 +0800
+@@ -972,6 +972,7 @@
+ /* 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 *);
index 7d8f054..5d7177b 100644 (file)
@@ -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.patch
index 580e977..9face89 100644 (file)
@@ -25,3 +25,4 @@ ext3-block-bitmap-validation-2.6-rhel5.patch
 ext3-xattr-no-update-ctime-2.6.22-vanilla.patch
 ext3-get-raid-stripe-from-sb.patch
 ext3-big-endian-check-2.6-rhel5.patch
+alloc-policy-2.6-rhlel5.patch 
index 7727c30..d538f7c 100644 (file)
@@ -30,3 +30,4 @@ ext3-xattr-no-update-ctime-2.6-sles10.patch
 ext3-check-bad-inode.patch
 ext3-get-raid-stripe-from-sb.patch
 ext3-big-endian-check-2.6-sles10.patch
+alloc-policy-2.6-rhlel5.patch
index 5e7c0f2..2fba5a5 100644 (file)
@@ -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.patch
index cc89091..fa6ff92 100644 (file)
@@ -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.patch
index 05ea5a4..24bc64d 100644 (file)
@@ -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.patch
index 7a1712a..e53f1e0 100644 (file)
@@ -74,6 +74,11 @@ struct lvfs_dentry_params
         __u32            ldp_magic;
 };
 #define LVFS_DENTRY_PARAMS_INIT         { .ldp_magic = LVFS_DENTRY_PARAM_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;
 
 #define lvfs_sbdev(SB)       ((SB)->s_bdev)
 #define lvfs_sbdev_type      struct block_device *
index 81b4399..2a5f620 100644 (file)
@@ -935,8 +935,8 @@ int mds_obd_create(struct obd_export *exp, struct obdo *oa,
         struct mds_obd *mds = &exp->exp_obd->u.mds;
         struct inode *parent_inode = mds->mds_objects_dir->d_inode;
         unsigned int tmpname = ll_rand();
-        struct file *filp;
-        struct dentry *new_child;
+        struct dentry *dchild, *new_child;
+        struct lvfs_dentry_params dp = LVFS_DENTRY_PARAMS_INIT;
         struct lvfs_run_ctxt *saved = NULL;
         char fidname[LL_FID_NAMELEN];
         void *handle;
@@ -955,31 +955,32 @@ int mds_obd_create(struct obd_export *exp, struct obdo *oa,
 
         push_ctxt(saved, &exp->exp_obd->obd_lvfs_ctxt, &ucred);
 
-        sprintf(fidname, "OBJECTS/%u.%u", tmpname, current->pid);
-        filp = filp_open(fidname, O_CREAT | O_EXCL, 0666);
-        if (IS_ERR(filp)) {
-                rc = PTR_ERR(filp);
-                if (rc == -EEXIST) {
-                        CERROR("impossible object name collision %u\n",
-                               tmpname);
-                        LBUG();
-                }
-                CERROR("error creating tmp object %u: rc %d\n", tmpname, rc);
-                GOTO(out_pop, rc);
+        sprintf(fidname, "%u.%u", tmpname, current->pid);
+        dchild = lookup_one_len(fidname, mds->mds_objects_dir, strlen(fidname));
+        if (IS_ERR(dchild)) {
+                CERROR("getting neg dentry for obj: %u\n", tmpname);
+                GOTO(out_pop, rc = PTR_ERR(dchild));
+        }
+        if (dchild->d_inode != NULL) {
+                CERROR("impossible non-negative obj dentry: %u\n", tmpname);
+                LBUG();
         }
 
-        LASSERT(mds->mds_objects_dir == filp->f_dentry->d_parent);
+        dchild->d_fsdata = (void *)&dp;
+        dp.ldp_ptr   = (void *)DP_LASTGROUP_REVERSE;
+
+        LOCK_INODE_MUTEX(parent_inode);
+        rc = ll_vfs_create(parent_inode, dchild, S_IFREG | 0666, NULL);
 
-        oa->o_id = filp->f_dentry->d_inode->i_ino;
-        oa->o_generation = filp->f_dentry->d_inode->i_generation;
+        oa->o_id = dchild->d_inode->i_ino;
+        oa->o_generation = dchild->d_inode->i_generation;
         namelen = ll_fid2str(fidname, oa->o_id, oa->o_generation);
 
-        LOCK_INODE_MUTEX(parent_inode);
         new_child = lookup_one_len(fidname, mds->mds_objects_dir, namelen);
 
         if (IS_ERR(new_child)) {
                 CERROR("getting neg dentry for obj rename: %d\n", rc);
-                GOTO(out_close, rc = PTR_ERR(new_child));
+                GOTO(out_dput, rc = PTR_ERR(new_child));
         }
         if (new_child->d_inode != NULL) {
                 CERROR("impossible non-negative obj dentry " LPU64":%u!\n",
@@ -990,12 +991,11 @@ int mds_obd_create(struct obd_export *exp, struct obdo *oa,
         handle = fsfilt_start(exp->exp_obd, mds->mds_objects_dir->d_inode,
                               FSFILT_OP_RENAME, NULL);
         if (IS_ERR(handle))
-                GOTO(out_dput, rc = PTR_ERR(handle));
+                GOTO(out_dput2, rc = PTR_ERR(handle));
 
         lock_kernel();
-        rc = ll_vfs_rename(mds->mds_objects_dir->d_inode, filp->f_dentry,
-                           filp->f_vfsmnt, mds->mds_objects_dir->d_inode,
-                           new_child, filp->f_vfsmnt);
+        rc = ll_vfs_rename(parent_inode, dchild, mds->mds_vfsmnt,
+                           parent_inode, new_child, mds->mds_vfsmnt);
         unlock_kernel();
         if (rc)
                 CERROR("error renaming new object "LPU64":%u: rc %d\n",
@@ -1007,16 +1007,11 @@ int mds_obd_create(struct obd_export *exp, struct obdo *oa,
                 oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGENER;
         else if (!rc)
                 rc = err;
-out_dput:
+out_dput2:
         dput(new_child);
-out_close:
+out_dput:
+        dput(dchild);
         UNLOCK_INODE_MUTEX(parent_inode);
-        err = filp_close(filp, 0);
-        if (err) {
-                CERROR("closing tmpfile %u: rc %d\n", tmpname, rc);
-                if (!rc)
-                        rc = err;
-        }
 out_pop:
         pop_ctxt(saved, &exp->exp_obd->obd_lvfs_ctxt, &ucred);
         OBD_SLAB_FREE_PTR(saved, obd_lvfs_ctxt_cache);