Whamcloud - gitweb
b=24214 Discard preallocation blocks after failed allocated.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-wantedi-2.6-rhel5.patch
1 Index: linux-2.6.18-194.3.1/fs/ext4/namei.c
2 ===================================================================
3 --- linux-2.6.18-194.3.1.orig/fs/ext4/namei.c
4 +++ linux-2.6.18-194.3.1/fs/ext4/namei.c
5 @@ -148,6 +148,17 @@ struct dx_map_entry
6         u16 size;
7  };
8  
9 +/*
10 + * dentry_param used by ext4_new_inode_wantedi()
11 + */
12 +#define LVFS_DENTRY_PARAM_MAGIC                20070216UL
13 +struct lvfs_dentry_params
14 +{
15 +       unsigned long   ldp_inum;
16 +       unsigned long   ldp_flags;
17 +       u32             ldp_magic;
18 +};
19 +
20  static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
21  static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
22  static inline unsigned dx_get_hash(struct dx_entry *entry);
23 @@ -1761,6 +1772,19 @@ static int ext4_add_nondir(handle_t *han
24         return err;
25  }
26  
27 +static unsigned ext4_dentry_goal(struct super_block *sb, struct dentry *dentry)
28 +{
29 +       unsigned inum = EXT4_SB(sb)->s_inode_goal;
30 +
31 +       if (dentry->d_fsdata != NULL) {
32 +               struct lvfs_dentry_params *param = dentry->d_fsdata;
33 +
34 +               if (param->ldp_magic == LVFS_DENTRY_PARAM_MAGIC)
35 +                       inum = param->ldp_inum;
36 +       }
37 +       return inum;
38 +}
39 +
40  /*
41   * By the time this is called, we already have created
42   * the directory cache entry for the new file, but it
43 @@ -1786,7 +1810,8 @@ retry:
44         if (IS_DIRSYNC(dir))
45                 ext4_handle_sync(handle);
46  
47 -       inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0);
48 +       inode = ext4_new_inode(handle, dir, mode, &dentry->d_name,
49 +                              ext4_dentry_goal(dir->i_sb, dentry));
50         err = PTR_ERR(inode);
51         if (!IS_ERR(inode)) {
52                 inode->i_op = &ext4_file_inode_operations;
53 @@ -1820,7 +1845,8 @@ retry:
54         if (IS_DIRSYNC(dir))
55                 ext4_handle_sync(handle);
56  
57 -       inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0);
58 +       inode = ext4_new_inode(handle, dir, mode, &dentry->d_name,
59 +                              ext4_dentry_goal(dir->i_sb, dentry));
60         err = PTR_ERR(inode);
61         if (!IS_ERR(inode)) {
62                 init_special_inode(inode, inode->i_mode, rdev);
63 @@ -1857,8 +1883,8 @@ retry:
64         if (IS_DIRSYNC(dir))
65                 ext4_handle_sync(handle);
66  
67 -       inode = ext4_new_inode(handle, dir, S_IFDIR | mode,
68 -                              &dentry->d_name, 0);
69 +       inode = ext4_new_inode(handle, dir, S_IFDIR | mode, &dentry->d_name,
70 +                              ext4_dentry_goal(dir->i_sb, dentry));
71         err = PTR_ERR(inode);
72         if (IS_ERR(inode))
73                 goto out_stop;
74 @@ -2270,8 +2296,8 @@ retry:
75         if (IS_DIRSYNC(dir))
76                 ext4_handle_sync(handle);
77  
78 -       inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO,
79 -                              &dentry->d_name, 0);
80 +       inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO, &dentry->d_name,
81 +                              ext4_dentry_goal(dir->i_sb, dentry));
82         err = PTR_ERR(inode);
83         if (IS_ERR(inode))
84                 goto out_stop;