Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-osd-iop-common.patch
index bc184c5..cd9a250 100644 (file)
@@ -1,39 +1,29 @@
-diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/ext4.h linux-2.6.18-128.1.6_2//fs/ext4/ext4.h
---- linux-2.6.18-128.1.6_1//fs/ext4/ext4.h     2009-08-24 15:54:11.000000000 +0530
-+++ linux-2.6.18-128.1.6_2//fs/ext4/ext4.h     2009-08-24 15:54:52.000000000 +0530
-@@ -1144,6 +1144,18 @@ extern int ext4_fiemap(struct inode *, s
- extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
                     unsigned long);
+diff -rupN linux-2.6.27.21-0.1_1//fs/ext4/ext4.h linux-2.6.27.21-0.1_2//fs/ext4/ext4.h
+--- linux-2.6.27.21-0.1_1//fs/ext4/ext4.h      2009-08-24 15:32:00.000000000 +0530
++++ linux-2.6.27.21-0.1_2//fs/ext4/ext4.h      2009-08-24 15:32:55.000000000 +0530
+@@ -1171,6 +1171,19 @@ extern int ext4_fiemap(struct inode *, s
+ /* migrate.c */
extern int ext4_ext_migrate(struct inode *);
  /* namei.c */
 +extern struct inode *ext4_create_inode(handle_t *handle,
-+                                     struct inode * dir, int mode);
++                                        struct inode * dir, int mode);
 +extern int ext4_add_entry(handle_t *handle, struct dentry *dentry,
-+                        struct inode *inode);
++                           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 dentry *dentry,
-+                                          struct ext4_dir_entry_2
-+                                          ** res_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(dir, &(dentry)->d_name, res_dir)
 +extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
-+                             struct inode *inode);
++                                struct inode *inode);
  extern int ext4_orphan_add(handle_t *, struct inode *);
  extern int ext4_orphan_del(handle_t *, struct inode *);
  extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
-diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/inode.c linux-2.6.18-128.1.6_2//fs/ext4/inode.c
---- linux-2.6.18-128.1.6_1//fs/ext4/inode.c    2009-08-24 15:54:11.000000000 +0530
-+++ linux-2.6.18-128.1.6_2//fs/ext4/inode.c    2009-08-24 15:54:52.000000000 +0530
-@@ -2891,6 +2891,7 @@ bad_inode:
-       iput(inode);
-       return ERR_PTR(ret);
- }
-+EXPORT_SYMBOL(ext4_iget);
- static int ext4_inode_blocks_set(handle_t *handle,
-                               struct ext4_inode *raw_inode,
-diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ext4/namei.c
---- linux-2.6.18-128.1.6_1//fs/ext4/namei.c    2009-08-24 15:54:11.000000000 +0530
-+++ linux-2.6.18-128.1.6_2//fs/ext4/namei.c    2009-08-24 15:55:18.000000000 +0530
+diff -rupN linux-2.6.27.21-0.1_1//fs/ext4/namei.c linux-2.6.27.21-0.1_2//fs/ext4/namei.c
+--- linux-2.6.27.21-0.1_1//fs/ext4/namei.c     2009-08-24 15:32:00.000000000 +0530
++++ linux-2.6.27.21-0.1_2//fs/ext4/namei.c     2009-08-24 15:43:56.000000000 +0530
 @@ -24,6 +24,7 @@
   *    Theodore Ts'o, 2002
   */
@@ -42,37 +32,39 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
  #include <linux/fs.h>
  #include <linux/pagemap.h>
  #include <linux/jbd2.h>
-@@ -878,8 +879,8 @@ static inline int search_dirblock(struct
+@@ -882,9 +883,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 dentry *dentry,
+-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 dentry *dentry,
++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];
-@@ -986,6 +987,7 @@ cleanup_and_exit:
-               brelse (bh_use[ra_ptr]);
+       struct super_block *sb;
+       struct buffer_head *bh_use[NAMEI_RA_SIZE];
+@@ -991,6 +992,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 dentry *dentry,
+ 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)
-@@ -1506,8 +1508,8 @@ static int make_indexed_dir(handle_t *ha
+@@ -1511,8 +1513,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)
+-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;
-       unsigned long offset;
-@@ -1553,6 +1555,7 @@ static int ext4_add_entry (handle_t *han
+       struct buffer_head *bh;
+@@ -1557,6 +1559,7 @@ static int ext4_add_entry(handle_t *hand
        de->rec_len = ext4_rec_len_to_disk(blocksize);
        return add_dirent_to_buf(handle, dentry, inode, de, bh);
  }
@@ -80,22 +72,22 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
  
  /*
   * Returns 0 for success, or a negative error value
-@@ -1693,10 +1696,10 @@ cleanup:
+@@ -1699,10 +1702,10 @@ cleanup:
   * ext4_delete_entry deletes a directory entry by merging it with the
   * previous entry
   */
--static int ext4_delete_entry (handle_t *handle,
--                            struct inode * dir,
--                            struct ext4_dir_entry_2 * de_del,
--                            struct buffer_head * bh)
-+int ext4_delete_entry (handle_t *handle,
-+                     struct inode * dir,
-+                     struct ext4_dir_entry_2 * de_del,
-+                     struct buffer_head * bh)
+-static int ext4_delete_entry(handle_t *handle,
+-                           struct inode *dir,
+-                           struct ext4_dir_entry_2 *de_del,
+-                           struct buffer_head *bh)
++int ext4_delete_entry(handle_t *handle,
++                    struct inode *dir,
++                    struct ext4_dir_entry_2 *de_del,
++                    struct buffer_head *bh)
  {
-       struct ext4_dir_entry_2 * de, * pde;
+       struct ext4_dir_entry_2 *de, *pde;
        int i;
-@@ -1727,7 +1730,7 @@ static int ext4_delete_entry (handle_t *
+@@ -1733,7 +1736,7 @@ static int ext4_delete_entry(handle_t *h
        }
        return -ENOENT;
  }
@@ -104,15 +96,15 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
  /*
   * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
   * since this indicates that nlinks count was previously 1.
-@@ -1790,6 +1793,26 @@ static struct inode * ext4_new_inode_wan
-       return ext4_new_inode(handle, dir, mode, inum);
+@@ -1796,6 +1799,26 @@ static unsigned ext4_dentry_goal(struct
+       return inum;
  }
  
 +struct inode * ext4_create_inode(handle_t *handle, struct inode * dir, int mode)
 +{
 +      struct inode *inode;
 +
-+      inode = ext4_new_inode(handle, dir, mode, 0);
++      inode = ext4_new_inode(handle, dir, mode);
 +      if (!IS_ERR(inode)) {
 +              if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
 +#ifdef CONFIG_LDISKFS_FS_XATTR
@@ -131,46 +123,48 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
  /*
   * By the time this is called, we already have created
   * the directory cache entry for the new file, but it
-@@ -1864,38 +1887,25 @@ retry:
+@@ -1872,39 +1895,31 @@ retry:
        return err;
  }
  
--static int ext4_mkdir(struct inode * dir, struct dentry * dentry, int mode)
--{
--      handle_t *handle;
--      struct inode * inode;
+-static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 +/* Initialize @inode as a subdirectory of @dir, and add the
 + * "." and ".." entries into the first directory block. */
 +int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
-+                       struct inode *inode)
-+ {
-       struct buffer_head * dir_block;
-       struct ext4_dir_entry_2 * de;
++                      struct inode *inode)
+ {
+-      handle_t *handle;
+-      struct inode *inode;
+-      struct buffer_head *dir_block;
+-      struct ext4_dir_entry_2 *de;
 -      int err, retries = 0;
 -
 -      if (EXT4_DIR_LINK_MAX(dir))
 -              return -EMLINK;
--
++      struct buffer_head * dir_block;
++      struct ext4_dir_entry_2 * de;
++      int err = 0;
 -retry:
 -      handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
 -                                      EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
 -                                      2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
--      if (IS_ERR(handle))
--              return PTR_ERR(handle);
--
--      if (IS_DIRSYNC(dir))
--              handle->h_sync = 1;
--
--      inode = ext4_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+       if (IS_DIRSYNC(dir))
+               ext4_handle_sync(handle);
+-      inode = ext4_new_inode_goal(handle, dir, S_IFDIR | mode,
+-                                  ext4_dentry_goal(dir->i_sb, dentry));
 -      err = PTR_ERR(inode);
 -      if (IS_ERR(inode))
 -              goto out_stop;
-+      int err = 0;
+-
        inode->i_op = &ext4_dir_inode_operations;
        inode->i_fop = &ext4_dir_operations;
        inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize;
-       dir_block = ext4_bread (handle, inode, 0, 1, &err);
+       dir_block = ext4_bread(handle, inode, 0, 1, &err);
 -      if (!dir_block)
 -              goto out_clear_inode;
 +      if (!dir_block) {
@@ -182,28 +176,20 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
        BUFFER_TRACE(dir_block, "get_write_access");
        ext4_journal_get_write_access(handle, dir_block);
        de = (struct ext4_dir_entry_2 *) dir_block->b_data;
-@@ -1907,7 +1917,7 @@ retry:
-       de = ext4_next_entry(de);
-       de->inode = cpu_to_le32(dir->i_ino);
-       de->rec_len = ext4_rec_len_to_disk(inode->i_sb->s_blocksize -
--                                              EXT4_DIR_REC_LEN(1));
-+                                            EXT4_DIR_REC_LEN(1));
-       de->name_len = 2;
-       strcpy (de->name, "..");
-       ext4_set_de_type(dir->i_sb, de, S_IFDIR);
-@@ -1916,9 +1926,41 @@ retry:
+@@ -1925,9 +1940,43 @@ retry:
        ext4_journal_dirty_metadata(handle, dir_block);
-       brelse (dir_block);
+       brelse(dir_block);
        ext4_mark_inode_dirty(handle, inode);
 +get_out:
 +      return err;
 +}
 +EXPORT_SYMBOL(ext4_add_dot_dotdot);
 +
-+static int ext4_mkdir(struct inode * dir, struct dentry * dentry, int mode)
++
++static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 +{
 +      handle_t *handle;
-+      struct inode * inode;
++      struct inode *inode;
 +      int err, retries = 0;
 +
 +      if (EXT4_DIR_LINK_MAX(dir))
@@ -219,7 +205,8 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
 +      if (IS_DIRSYNC(dir))
 +              handle->h_sync = 1;
 +
-+      inode = ext4_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
++      inode = ext4_new_inode_goal(handle, dir, S_IFDIR | mode,
++                                  ext4_dentry_goal(dir->i_sb, dentry));
 +      err = PTR_ERR(inode);
 +      if (IS_ERR(inode))
 +              goto out_stop;
@@ -228,10 +215,9 @@ diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/namei.c linux-2.6.18-128.1.6_2//fs/ex
 +      if (err)
 +              goto out_stop;
 +
-       err = ext4_add_entry (handle, dentry, inode);
+       err = ext4_add_entry(handle, dentry, inode);
        if (err) {
 -out_clear_inode:
                clear_nlink(inode);
                ext4_mark_inode_dirty(handle, inode);
-               iput (inode);
-
+               iput(inode);