Whamcloud - gitweb
LU-8364 ldiskfs: fixes for failover mode
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel6.3 / ext4-osd-iop-common.patch
index 1f1fb2a..e8718f9 100644 (file)
@@ -1,20 +1,14 @@
 --- a/fs/ext4/ext4.h
 +++ b/fs/ext4/ext4.h
-@@ -1778,6 +1778,19 @@ extern int ext4_orphan_add(handle_t *, s
+@@ -1778,6 +1778,13 @@ extern int ext4_orphan_add(handle_t *, s
  extern int ext4_orphan_del(handle_t *, struct inode *);
  extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
                                __u32 start_minor_hash, __u32 *next_hash);
 +extern struct inode *ext4_create_inode(handle_t *handle,
 +                                     struct inode * dir, int mode);
-+extern int ext4_add_entry(handle_t *handle, struct dentry *dentry,
-+                        struct inode *inode);
 +extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
 +                           struct ext4_dir_entry_2 * de_del,
 +                           struct buffer_head * bh);
-+extern struct buffer_head * ext4_find_entry(struct inode *dir,
-+                                          const struct qstr *d_name,
-+                                          struct ext4_dir_entry_2 ** res_dir);
-+#define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir)
 +extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
 +                             struct inode *inode);
  
  #include <linux/fs.h>
  #include <linux/pagemap.h>
  #include <linux/jbd2.h>
-@@ -873,9 +874,9 @@ static inline int search_dirblock(struct
-  * The returned buffer_head has ->b_count elevated.  The caller is expected
-  * to brelse() it when appropriate.
-  */
--static struct buffer_head * ext4_find_entry (struct inode *dir,
--                                      const struct qstr *d_name,
--                                      struct ext4_dir_entry_2 ** res_dir)
-+struct buffer_head * ext4_find_entry(struct inode *dir,
-+                                    const struct qstr *d_name,
-+                                    struct ext4_dir_entry_2 ** res_dir)
- {
-       struct super_block *sb;
-       struct buffer_head *bh_use[NAMEI_RA_SIZE];
-@@ -981,6 +982,7 @@ cleanup_and_exit:
-               brelse(bh_use[ra_ptr]);
-       return ret;
- }
-+EXPORT_SYMBOL(ext4_find_entry);
- static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct qstr *d_name,
-                      struct ext4_dir_entry_2 **res_dir, int *err)
-@@ -1515,8 +1517,8 @@ static int make_indexed_dir(handle_t *ha
-  * may not sleep between calling this and putting something into
-  * the entry, as someone else might have used it while you slept.
-  */
--static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
--                        struct inode *inode)
-+int ext4_add_entry(handle_t *handle, struct dentry *dentry,
-+                 struct inode *inode)
- {
-       struct inode *dir = dentry->d_parent->d_inode;
-       struct buffer_head *bh;
-@@ -1565,6 +1567,7 @@ static int ext4_add_entry(handle_t *hand
-       brelse(bh);
-       return retval;
- }
-+EXPORT_SYMBOL(ext4_add_entry);
- /*
-  * Returns 0 for success, or a negative error value
 @@ -1704,10 +1707,10 @@ cleanup:
   * ext4_delete_entry deletes a directory entry by merging it with the
   * previous entry
  /*
   * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
   * since this indicates that nlinks count was previously 1.
-@@ -1806,6 +1809,27 @@ static unsigned ext4_dentry_goal(struct
+@@ -1806,6 +1809,29 @@ static unsigned ext4_dentry_goal(struct
        return inum;
  }
  
-+struct inode * ext4_create_inode(handle_t *handle, struct inode * dir, int mode)
++ /* Return locked inode, then the caller can modify the inode's states/flags
++  * before others finding it. The caller should unlock the inode by itself. */
++struct inode *ext4_create_inode(handle_t *handle, struct inode *dir, int mode)
 +{
 +      struct inode *inode;
 +
-+      inode = ext4_new_inode(handle, dir, mode, 0, EXT4_SB(dir->i_sb)->s_inode_goal);
++      inode = ext4_new_inode(handle, dir, mode, 0,
++                             EXT4_SB(dir->i_sb)->s_inode_goal);
 +      if (!IS_ERR(inode)) {
 +              if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
-+#ifdef CONFIG_LDISKFS_FS_XATTR
++#ifdef CONFIG_EXT4_FS_XATTR
 +                      inode->i_op = &ext4_special_inode_operations;
 +#endif
 +              } else {
 +                      inode->i_fop = &ext4_file_operations;
 +                      ext4_set_aops(inode);
 +              }
-+              unlock_new_inode(inode);
 +      }
 +      return inode;
 +}
  /*
   * By the time this is called, we already have created
   * the directory cache entry for the new file, but it
-@@ -1882,44 +1906,32 @@ retry:
+@@ -1882,44 +1908,32 @@ retry:
        return err;
  }
  
                ext4_handle_sync(handle);
  
 -      inode = ext4_new_inode(handle, dir, S_IFDIR | mode,
--                             &dentry->d_name, ext4_dentry_goal(dir->i_sb, dentry));
+-                             &dentry->d_name, 0);
 -      err = PTR_ERR(inode);
 -      if (IS_ERR(inode))
 -              goto out_stop;
        de = (struct ext4_dir_entry_2 *) dir_block->b_data;
        de->inode = cpu_to_le32(inode->i_ino);
        de->name_len = 1;
-@@ -1938,18 +1950,47 @@ retry:
+@@ -1938,18 +1952,46 @@ retry:
        BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
        err = ext4_handle_dirty_metadata(handle, inode, dir_block);
        if (err)
 +      if (IS_DIRSYNC(dir))
 +              ext4_handle_sync(handle);
 +
-+      inode = ext4_new_inode(handle, dir, S_IFDIR | mode, &dentry->d_name,
-+                             ext4_dentry_goal(dir->i_sb, dentry));
++      inode = ext4_new_inode(handle, dir, S_IFDIR | mode, &dentry->d_name, 0);
 +      err = PTR_ERR(inode);
 +      if (IS_ERR(inode))
                goto out_stop;
        ext4_inc_count(handle, dir);
        ext4_update_dx_flag(dir);
        err = ext4_mark_inode_dirty(handle, dir);
-@@ -1958,11 +1999,16 @@ out_clear_inode:
+@@ -1958,11 +2001,16 @@ out_clear_inode:
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
  out_stop: